tweag / topiary

https://topiary.tweag.io/
MIT License
579 stars 29 forks source link

`cargo test` fails when JSON grammar hasn't been fetched #767

Closed nbacquey closed 1 month ago

nbacquey commented 1 month ago

Describe the bug Tests fail with

running 8 tests
test test_fmt_invalid ... ok
test test_vis_invalid ... ok
test test_cfg ... ok
test test_vis ... FAILED
test test_fmt_dir ... ok
test test_fmt_stdin_query ... ok
test test_fmt_stdin ... ok
test test_fmt_files ... ok

failures:

---- test_vis stdout ----
thread 'test_vis' panicked at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/ops/function.rs:250:5:
Unexpected failure.
code=10
stderr=```"[2024-10-15T16:01:58Z ERROR topiary] Error Fetching Language: LibLoading(DlOpen { desc: \"/home/yago/.cache/topiary/json/94f5c527b2965465956c2000ed6134dd24daf2a7.so: file too short\" })\n"```
command=`TOPIARY_LANGUAGE_DIR="../topiary-queries/queries" "/home/yago/Pro/Tweag/projects/nickel/topiary/target/debug/topiary" "vis" "--language" "json"`
stdin=`"{   \"test\"  :123}"`
code=10
stdout=""
stderr="[2024-10-15T16:01:58Z ERROR topiary] Error Fetching Language: LibLoading(DlOpen { desc: \"/home/yago/.cache/topiary/json/94f5c527b2965465956c2000ed6134dd24daf2a7.so: file too short\" })\n"

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

To Reproduce

rm -rf ~/.cache/topiary/json && cargo test -p topiary-cli --test cli-tester

Expected behavior Topiary should fetch the grammars required to run the tests beforehand

nbacquey commented 1 month ago

~Can no longer reproduce~

nbacquey commented 1 month ago

Can reproduce with

rm -rf ~/.cache/topiary/json && cargo test -p topiary-cli --test cli-tester