Skip to content
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

Some invalid tests may only succeed due to linker errors #93

Open
meithecatte opened this issue Oct 27, 2024 · 1 comment
Open

Some invalid tests may only succeed due to linker errors #93

meithecatte opened this issue Oct 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@meithecatte
Copy link

Take for example tests/chapter_9/invalid_types/conflicting_local_function_declaration.c. If compilation fails during linking because of the missing definition of foo, the test will still succeed, even though the compiler did not catch the conflicting declaration.

@nlsandler nlsandler added the bug Something isn't working label Nov 4, 2024
@nlsandler
Copy link
Owner

Good catch, thank you!

There are two ways to work around this issue for now and make sure these tests still fail:

  1. Test an intermediate stage with the --stage option. Your compiler will need a --validate option that tells it validate the program and return with a 0 or non-zero exit code based on the result, but not produce any output files. Then you can run the test script with --stage validate to just make sure validation is working properly.

  2. Use the --expected-error-codes option to specify the exit codes your compiler uses when it rejects an invalid program. As long as those aren't the same exit codes it uses when it hits a linker error, that should address this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants