[CN-Exec] Preprocessor directives for better testing support #784
Labels
CN spec testing
cn
CN-exec
Related to CN executable spec generation, called using `cn instrument`
enhancement
New feature or request
Right now there is a
--with-test-gen
flag, which throws an error if there is amain
function.Instead, there should be a more generally named
--with-testing
(or something more descriptive) flag which performs at least the following:main
function to be absentmain
function is present, wraps it in#ifndef CN_TESTING_MODE
CN_TESTING_MODE
, for a given static globalstatic <ty> <ident>;
, hasextern <ty> <ident>;
incn.h
and<ty> <ident>;
incn.c
instead.static
functions, wrap these modifiers in#ifndef CN_TESTING_MODE
Since these changes would be behind a compiler flag, they could in theory be enabled by default rather than by a flag. However, this could add unnecessary noise to the instrumented files.
The end result is that compiling the instrumented file with
CN_TESTING_MODE
will allow various forms of testing to link against functions and globals where they otherwise could not.CN-Test-Gen currently works around this by just acting as an addendum to the instrumented file, which is far from ideal.
Once implemented, CN-Test-Gen (and other testing efforts) can be updated to work with the new flag and
--with-test-gen
can eventually be removed.The text was updated successfully, but these errors were encountered: