-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor(clerk): use ninja as backend to run tests #186
Refactor(clerk): use ninja as backend to run tests #186
Conversation
b7fca39
to
762bbec
Compare
+ ninja_utils.ml: implement helper functions for basic ninja rules and builds. + clerk.ml: for single test files, clerk now generates the wanted ninja.build file before executing ninja.
762bbec
to
22e5e4d
Compare
f23d6af
to
c640a3e
Compare
…or one given file
- there is some issue with 'bad' tests
a915c98
to
8d0c8a4
Compare
+ supported backends: Interpret, Scopelang, Dcalc, Proof, Typecheck + some minor refactoring of clerk.ml
@denismerigoux could you take a look to the CI please? I added |
Hi Émile, you can retry now, I manually installed the dependency on the runners. |
The CI is still failing but that's on you I think, you forgot to supply the scope |
Thanks!
After some investigations, I found that the error come from the last two lines:
which are printed out when executing Is it the wanted behavior? |
The two line differences comes from this piece of code: Lines 198 to 211 in b6d9d7c
When you specify a scope to print with |
I tried, but the same problem occurred: for a same file, specifying the |
That's definitely weird. I'll take a deeper look at this on Monday and will debug it thoroughly. Meanwhile you can just ignore this error :) |
1f6089e
to
18e285e
Compare
86e69f8
to
3a6450b
Compare
0edfa4e
to
ee6eb71
Compare
796ac45
to
7357654
Compare
96eafb4
to
f4ab6f5
Compare
-> catch the Sys_error if the file can't be created.
dd5a1fa
to
1e7f6fa
Compare
1e7f6fa
to
f277f27
Compare
ec84c49
to
b082914
Compare
Changes in autoformatting should be made in a separate PR in a time where there isn't too much pending PRs for the OCaml files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! I have two questions before merging:
-
Why all the empty files in
build_system/tests/catala_files
? Can't we delete them if they are empty? -
When I run
make tests
on my machine I get the following error:
cd build_system && dune test
Entering directory '/home/demerigo/catala'
test_clerk_driver alias build_system/tests/runtest (exit 1)
(cd _build/default/build_system/tests && ./test_clerk_driver.exe)
Testing `Clerk_driver'.
This run has ID `QAIQYRY7'.
[OK] Test ninja_start 0 initial ninja rules should be present....
[OK] Test add_test_builds 0 an untested file.
[OK] Test add_test_builds 1 a simple Interpret scope....
> [FAIL] Test add_test_builds 2 a simple folder....
┌──────────────────────────────────────────────────────────────────────────────┐
│ [FAIL] Test add_test_builds 2 a simple folder. │
└──────────────────────────────────────────────────────────────────────────────┘
ASSERT a test case should be found
ASSERT both formated strings should equal
FAIL both formated strings should equal
Expected: `"build test_A_Interpret_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en: test_with_scope\n scope = A\n catala_cmd = Interpret\n tested_file = ../../../../build_system/tests/catala_files/folder/file1.catala_en\n expected_output = ../../../../build_system/tests/catala_files/folder/output/file1.catala_en.A.Interpret\nbuild test_B_Interpret_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en: test_with_scope\n scope = B\n catala_cmd = Interpret\n tested_file = ../../../../build_system/tests/catala_files/folder/file1.catala_en\n expected_output = ../../../../build_system/tests/catala_files/folder/output/file1.catala_en.B.Interpret\nbuild test_Proof_..-..-..-..-build_system-tests-catala_files-folder-file3.catala_en: test_without_scope\n extra_flags = --disable_counterexamples\n catala_cmd = Proof\n tested_file = ../../../../build_system/tests/catala_files/folder/file3.catala_en\n expected_output = ../../../../build_system/tests/catala_files/folder/output/file3.catala_en.Proof\nbuild test_Typecheck_..-..-..-..-build_system-tests-catala_files-folder-file2.catala_en: test_without_scope\n catala_cmd = Typecheck\n tested_file = ../../../../build_system/tests/catala_files/folder/file2.catala_en\n expected_output = ../../../../build_system/tests/catala_files/folder/output/file2.catala_en.Typecheck\nbuild test_dir_..-..-..-..-build_system-tests-catala_files-folder: run_and_display_final_message $\n test_file_..-..-..-..-build_system-tests-catala_files-folder-file2.catala_en $\n test_file_..-..-..-..-build_system-tests-catala_files-folder-file3.catala_en $\n test_file_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en\n test_file_or_folder = in folder '../../../../build_system/tests/catala_files/folder'\nbuild test_file_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en: phony $\n test_B_Interpret_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en $\n test_A_Interpret_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en\nbuild test_file_..-..-..-..-build_system-tests-catala_files-folder-file2.catala_en: phony $\n test_Typecheck_..-..-..-..-build_system-tests-catala_files-folder-file2.catala_en\nbuild test_file_..-..-..-..-build_system-tests-catala_files-folder-file3.catala_en: phony $\n test_Proof_..-..-..-..-build_system-tests-catala_files-folder-file3.catala_en\n"'
Received: `"build test_A_Interpret_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en: test_with_scope\n scope = A\n catala_cmd = Interpret\n tested_file = ../../../../build_system/tests/catala_files/folder/file1.catala_en\n expected_output = ../../../../build_system/tests/catala_files/folder/output/file1.catala_en.A.Interpret\nbuild test_B_Interpret_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en: test_with_scope\n scope = B\n catala_cmd = Interpret\n tested_file = ../../../../build_system/tests/catala_files/folder/file1.catala_en\n expected_output = ../../../../build_system/tests/catala_files/folder/output/file1.catala_en.B.Interpret\nbuild test_Proof_..-..-..-..-build_system-tests-catala_files-folder-file3.catala_en: test_without_scope\n extra_flags = --disable_counterexamples\n catala_cmd = Proof\n tested_file = ../../../../build_system/tests/catala_files/folder/file3.catala_en\n expected_output = ../../../../build_system/tests/catala_files/folder/output/file3.catala_en.Proof\nbuild test_Typecheck_..-..-..-..-build_system-tests-catala_files-folder-file2.catala_en: test_without_scope\n catala_cmd = Typecheck\n tested_file = ../../../../build_system/tests/catala_files/folder/file2.catala_en\n expected_output = ../../../../build_system/tests/catala_files/folder/output/file2.catala_en.Typecheck\nbuild test_dir_..-..-..-..-build_system-tests-catala_files-folder: run_and_display_final_message $\n test_file_..-..-..-..-build_system-tests-catala_files-folder-file3.catala_en $\n test_file_..-..-..-..-build_system-tests-catala_files-folder-file2.catala_en $\n test_file_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en\n test_file_or_folder = in folder '../../../../build_system/tests/catala_files/folder'\nbuild test_file_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en: phony $\n test_A_Interpret_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en $\n test_B_Interpret_..-..-..-..-build_system-tests-catala_files-folder-file1.catala_en\nbuild test_file_..-..-..-..-build_system-tests-catala_files-folder-file2.catala_en: phony $\n test_Typecheck_..-..-..-..-build_system-tests-catala_files-folder-file2.catala_en\nbuild test_file_..-..-..-..-build_system-tests-catala_files-folder-file3.catala_en: phony $\n test_Proof_..-..-..-..-build_system-tests-catala_files-folder-file3.catala_en\n"'
Raised at Alcotest_engine__Test.check in file "src/alcotest-engine/test.ml", line 196, characters 4-261
Called from Alcotest_engine__Core.Make.protect_test.(fun) in file "src/alcotest-engine/core.ml", line 180, characters 17-23
Called from Alcotest_engine__Monad.Identity.catch in file "src/alcotest-engine/monad.ml", line 24, characters 31-35
Logs saved to `~/catala/_build/default/build_system/tests/_build/_tests/Clerk_driver/Test add_test_builds.002.output'.
──────────────────────────────────────────────────────────────────────────────
Full test results in `~/catala/_build/default/build_system/tests/_build/_tests/Clerk_driver'.
1 failure! in 0.001s. 4 tests run.
However the CI is green; do you know what is happening?
They are used in tests to verify that Clerk correctly founds all Catala scopes and backends from filenames.
It's really weird because both strings seem to be equal, and the test pass on my machine 🤔 |
Use ninja to run tests, following this steps:
Ninja_utils.ninja
structure is built according to them,build.ninja
file is written,ninja test
.Changelog
ninja
to perform the testsNinja_utils
build.ninja
fileocamlformat
rule:break-fun-decl = smart
)?Perfs
make tests
without ninja takes ~6 seconds.make tests
with ninja takes ~2 seconds.Screenshot