options: Deprecate no-early-exit

This commit is contained in:
Snaipe 2016-09-03 16:05:53 +02:00
parent 37da81191a
commit a4ad3084a9
9 changed files with 3 additions and 42 deletions

View file

@ -26,7 +26,6 @@ endif ()
set(ENV{LC_ALL} "en_US.utf8")
set(ENV{CRITERION_ALWAYS_SUCCEED} "1")
set(ENV{CRITERION_SHORT_FILENAME} "1")
set(ENV{CRITERION_NO_EARLY_EXIT} "1")
set(ENV{CRITERION_JOBS} "1")
set(ENV{CRITERION_DISABLE_TIME_MEASUREMENTS} "1")

View file

@ -18,9 +18,7 @@ Command line arguments
a number of jobs ideal for your hardware configuration.
* ``--pattern [PATTERN]``: Run tests whose string identifier matches
the given shell wildcard pattern (see dedicated section below). (\*nix only)
* ``--no-early-exit``: The test workers shall not prematurely exit when done and
will properly return from the main, cleaning up their process space.
This is useful when tracking memory leaks with ``valgrind --tool=memcheck``.
* ``--no-early-exit``: This flag is deprecated and no longer does anything.
* ``-S or --short-filename``: The filenames are displayed in their short form.
* ``--always-succeed``: The process shall exit with a status of ``0``.
* ``--tap[=FILE]``: Writes a TAP (Test Anything Protocol) report to FILE.
@ -81,7 +79,6 @@ Environment Variables
Environment variables are alternatives to command line switches when set to 1.
* ``CRITERION_ALWAYS_SUCCEED``: Same as ``--always-succeed``.
* ``CRITERION_NO_EARLY_EXIT``: Same as ``--no-early-exit``.
* ``CRITERION_FAIL_FAST``: Same as ``--fail-fast``.
* ``CRITERION_USE_ASCII``: Same as ``--ascii``.
* ``CRITERION_JOBS``: Same as ``--jobs``. Sets the number of jobs to

View file

@ -16,8 +16,3 @@ There are plenty of ways to fix that behaviour:
A. Open a new issue on the `github issue tracker <https://github.com/Snaipe/Criterion/issues>`_,
and describe the problem you are experiencing, along with the platform you are
running criterion on.
**Q. Why does Gcov show 0% coverage after I run my tests?**
You need to either pass ``--no-early-exit`` or define
``CRITERION_NO_EARLY_EXIT=1`` in your environment to get proper coverage.

View file

@ -30,8 +30,6 @@ logging_threshold enum criterion_logging_level The logging level
------------------- ---------------------------------- --------------------------------------------------------------
logger struct criterion_logger * The logger (see below)
------------------- ---------------------------------- --------------------------------------------------------------
no_early_exit bool True iff the test worker should exit early
------------------- ---------------------------------- --------------------------------------------------------------
always_succeed bool True iff criterion_run_all_tests should always returns 1
------------------- ---------------------------------- --------------------------------------------------------------
use_ascii bool True iff the outputs should use the ASCII charset

View file

@ -77,13 +77,7 @@ struct criterion_options {
struct criterion_logger *logger;
/**
* Don't exit the child immediately after finishing to run the test
* function, and perform a full cleanup.
*
* Useful when tracking memory leaks, and is immediately implied when
* running the process under valgrind.
*
* default: false
* This option doesn't do anything and is deprecated.
*/
bool no_early_exit;

View file

@ -72,7 +72,6 @@ macro(add_samples DIR_ SAMPLES_)
add_test(${sample} ${sample}.bin)
set_property(TEST ${sample} PROPERTY
ENVIRONMENT "CRITERION_ALWAYS_SUCCEED=1"
ENVIRONMENT "CRITERION_NO_EARLY_EXIT=1" # for coverage
)
endforeach()
endmacro()

View file

@ -65,8 +65,6 @@
" --xml[=FILE]: writes XML report in FILE " \
"(no file or \"-\" means stderr)\n" \
" --always-succeed: always exit with 0\n" \
" --no-early-exit: do not exit the test worker " \
"prematurely after the test\n" \
" --verbose[=level]: sets verbosity to level " \
"(1 by default)\n" \
" --crash: crash failing assertions rather than " \
@ -196,7 +194,6 @@ CR_API int criterion_handle_args(int argc, char *argv[],
opterr = 0;
char *env_always_succeed = getenv("CRITERION_ALWAYS_SUCCEED");
char *env_no_early_exit = getenv("CRITERION_NO_EARLY_EXIT");
char *env_fail_fast = getenv("CRITERION_FAIL_FAST");
char *env_use_ascii = getenv("CRITERION_USE_ASCII");
char *env_jobs = getenv("CRITERION_JOBS");
@ -208,8 +205,6 @@ CR_API int criterion_handle_args(int argc, char *argv[],
struct criterion_options *opt = &criterion_options;
if (env_always_succeed)
opt->always_succeed = !strcmp("1", env_always_succeed);
if (env_no_early_exit)
opt->no_early_exit = !strcmp("1", env_no_early_exit);
if (env_fail_fast)
opt->fail_fast = !strcmp("1", env_fail_fast);
if (env_use_ascii)
@ -267,7 +262,7 @@ CR_API int criterion_handle_args(int argc, char *argv[],
switch (c) {
case 'b': criterion_options.logging_threshold = (enum criterion_logging_level) atou(DEF(optarg, "1")); break;
case 'y': criterion_options.always_succeed = true; break;
case 'z': criterion_options.no_early_exit = true; break;
case 'z': fprintf(stderr, "--no-early-exit is now deprecated as it no longer does anything.\n");
case 'k': criterion_options.use_ascii = true; break;
case 'j': criterion_options.jobs = atou(optarg); break;
case 'f': criterion_options.fail_fast = true; break;

View file

@ -34,9 +34,6 @@ target_link_libraries(criterion_unit_tests criterion)
add_dependencies(criterion_tests criterion_unit_tests)
add_test(criterion_unit_tests criterion_unit_tests)
set_property(TEST criterion_unit_tests PROPERTY
ENVIRONMENT "CRITERION_NO_EARLY_EXIT=1" # for coverage
)
if (NOT MSVC) # we disable the scripted tests when building with MSVC
add_custom_target(cram_tests)

View file

@ -1,13 +0,0 @@
Testing --no-early-exit
$ simple.c.bin --no-early-exit
[\x1b[0;34m----\x1b[0m] \x1b[0;1msimple.c\x1b[0m:\x1b[0;31m4\x1b[0m: Assertion failed: The expression 0 is false. (esc)
[\x1b[0;31mFAIL\x1b[0m] misc::failing (esc)
[\x1b[0;34m====\x1b[0m] \x1b[0;1mSynthesis: Tested: \x1b[0;34m2\x1b[0;1m | Passing: \x1b[0;32m1\x1b[0;1m | Failing: \x1b[0;31m1\x1b[0;1m | Crashing: \x1b[0m0\x1b[0;1m \x1b[0m (esc)
Testing CRITERION_NO_EARLY_EXIT
$ CRITERION_NO_EARLY_EXIT=0 simple.c.bin
[\x1b[0;34m----\x1b[0m] \x1b[0;1msimple.c\x1b[0m:\x1b[0;31m4\x1b[0m: Assertion failed: The expression 0 is false. (esc)
[\x1b[0;31mFAIL\x1b[0m] misc::failing (esc)
[\x1b[0;34m====\x1b[0m] \x1b[0;1mSynthesis: Tested: \x1b[0;34m2\x1b[0;1m | Passing: \x1b[0;32m1\x1b[0;1m | Failing: \x1b[0;31m1\x1b[0;1m | Crashing: \x1b[0m0\x1b[0;1m \x1b[0m (esc)