zig icon indicating copy to clipboard operation
zig copied to clipboard

Tests in test/cases/translate_c and test/cases/run_translated_c aren't run when using `test-translate-c` and `test-run-translated-c`

Open silver-signal opened this issue 2 years ago • 1 comments

Zig Version

0.12.0-dev.1769+bf5ab5451

Steps to Reproduce and Observed Behavior

When I add new translate-c/run-translated-c tests in the appropriate folder, the test isn't run when using the command zig build test-translate-c or zig build test-run-translated-c. However, I can see that the test fails when I run the larger test-suite.

Reproducible Example

Add the following test to test/cases/run_translated_c/

failing_test.c:

int main() {
    return 1;
}

// run-translated-c
// c_frontend=clang
// link_libc=true

Command output:

> stage4/bin/zig build test-translate-c test-run-translated-c  # Everything passes
> stage4/bin/zig build test -Denable-llvm -Dskip-release -Dskip-non-native
run-translated-c  failing_test run: error: the following command exited with code 1 (expected exited with code 0):
/home/february/projects/zig/zig-cache/o/ac2288d51cb8981d4c97f1457a1d99b5/translated_c
>

A similar test can be done with test-translate-c.

Expected Behavior

test-translate-c and test-run-translated-c should run the tests that are in the test folders.

silver-signal avatar Dec 08 '23 03:12 silver-signal

This is happening because the translate-c/run-translated-c tests are being added in tests.addCases test harness rather than in tests.addTranslateCTests / tests.addRunTranslatedCTests. This also means that the -Dskip-run-translated-c option doesn't skip the tests in test/cases/run_translated_c/.

silver-signal avatar Dec 22 '23 02:12 silver-signal