Skip to content

Commit

Permalink
use jq in interp tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rachitnigam committed Nov 5, 2024
1 parent 2a547c3 commit ae99d5f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 28 deletions.
4 changes: 2 additions & 2 deletions fud2/scripts/jq.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import "rtl_sim" as sim;
export const jq_state = state("jq", ["jq"]);

defop dat_to_jq(json: sim::dat) >> out: jq_state {
let expr = config("jq.expr");
let expr = config_or("jq.expr", ".");
let jq = config_or("jq.exe", "jq");
let flags = config_or("jq.flags", "");

shell(`${jq} '${expr}' ${flags} -j ${json} > ${out}`);
shell(`${jq} '${expr}' ${flags} ${json} > ${out}`);
}
67 changes: 41 additions & 26 deletions interp/tests/runt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ expect_dir = "unit"
name = "multi-comp"
paths = ["multi-comp/*.futil"]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s cider.flags="--dump-registers" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""
timeout = 10

Expand All @@ -37,10 +38,11 @@ name = "complex"
paths = ["complex/*.futil"]

cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s cider.flags="--dump-registers" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""
timeout = 10
expect_dir = "complex"
Expand All @@ -49,11 +51,12 @@ expect_dir = "complex"
name = "primitives"
paths = ["primitives/*.futil"]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s calyx.args="--log off" \
-s cider.flags="--dump-registers" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""
timeout = 10
expect_dir = "primitives"
Expand All @@ -71,10 +74,11 @@ expect_dir = "par-to-seq"
name = "control"
paths = ["control/*.futil", "control/iteration/*.futil"]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s cider.flags="--dump-registers" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""
timeout = 10
expect_dir = "control"
Expand All @@ -83,15 +87,18 @@ expect_dir = "control"
name = "invoke"
paths = ["control/invoke/*.futil"]
cmd = """
fud2 {} --from calyx --to dat --through cider -s sim.data={}.data -s calyx.args="--log off" | jq --sort-keys
fud2 {} --from calyx --to jq --through cider -s sim.data={}.data -s calyx.args="--log off" -s jq.flags="--sort-keys"
"""
timeout = 10

[[tests]]
name = "invoke compiled"
paths = ["control/invoke/*.futil"]
cmd = """
fud2 {} --from calyx --to dat --through cider -s calyx.flags=" -p compile-invoke" -s sim.data={}.data -s calyx.args="--log off" | jq --sort-keys
fud2 {} --from calyx --to jq --through cider \
-s calyx.flags=" -p compile-invoke" \
-s sim.data={}.data -s calyx.args="--log off" \
-s jq.flags="--sort-keys"
"""

[[tests]]
Expand All @@ -116,11 +123,12 @@ expect_dir = "tests/lowered/"
name = "correctness dynamic"
paths = ["../../tests/correctness/*.futil"]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s sim.data={}.data \
-s calyx.args="--log off" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""

[[tests]]
Expand All @@ -134,13 +142,14 @@ cmd = """
name = "correctness lowered"
paths = ["../../tests/correctness/*.futil"]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s sim.data={}.data \
-s calyx.args="--log off" \
-s calyx.flags="-p all" \
-s cider.flags="--no-verify" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""
timeout = 60

Expand All @@ -149,23 +158,25 @@ timeout = 60
name = "correctness ref cells"
paths = ["../../tests/correctness/ref-cells/*.futil"]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s sim.data={}.data \
-s calyx.args="--log off" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""

[[tests]]
name = "correctness ref cells compiled"
paths = ["../../tests/correctness/ref-cells/*.futil"]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s sim.data={}.data \
-s calyx.args="--log off" \
-s calyx.flags=" -p compile-invoke" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""

[[tests]]
Expand All @@ -176,45 +187,49 @@ paths = [
"../../tests/correctness/numeric-types/fixed-point/*.futil",
]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s sim.data={}.data \
-s calyx.args="--log off" \
-s cider.converter-flags="-r --legacy-quotes" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""

[[tests]]
name = "[frontend] tcam testing"
paths = ["../../tests/correctness/tcam/*.futil"]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s calyx.args="--log off" \
-s sim.data={}.data \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""

[[tests]]
name = "benchmark misc"
paths = ["benchmarks/*.futil"]
cmd = """
fud2 --from calyx --to dat \
fud2 --from calyx --to jq \
--through cider \
-s sim.data={}.data \
-s calyx.args="--log off" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""

[[tests]]
name = "benchmark polybench"
paths = ["benchmarks/polybench/*.fuse"]
cmd = """
fud2 --from dahlia --to dat \
fud2 --from dahlia --to jq \
--through cider \
-s sim.data={}.data \
-s calyx.args="--log off" \
{} | jq --sort-keys
-s jq.flags="--sort-keys" \
{}
"""
timeout = 180

Expand Down

0 comments on commit ae99d5f

Please sign in to comment.