Merge branch 'features/valgrind-integration' into bleeding
This commit is contained in:
commit
50bc75f5fb
7 changed files with 6695 additions and 13 deletions
|
@ -20,6 +20,7 @@ include_directories(
|
|||
/usr/local/include/
|
||||
dependencies/libcsptr/include/
|
||||
dependencies/dyncall/dyncall/
|
||||
dependencies/valgrind/include/
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
|
@ -50,9 +51,14 @@ endif()
|
|||
|
||||
# Setup coveralls
|
||||
|
||||
option(CTESTS "Turn on the samples and test" OFF)
|
||||
option(COVERALLS "Turn on coveralls support" OFF)
|
||||
option(COVERALLS_UPLOAD "Upload the generated coveralls json" ON)
|
||||
option(DEV_BUILD "Compile in developer mode" OFF)
|
||||
option(CTESTS "Turn on the samples and test" ${DEV_BUILD})
|
||||
|
||||
if (DEV_BUILD)
|
||||
set(ENABLE_VALGRIND_ERRORS 1)
|
||||
endif ()
|
||||
|
||||
if (COVERALLS)
|
||||
include(Coveralls)
|
||||
|
|
6587
dependencies/valgrind/include/valgrind/valgrind.h
vendored
Normal file
6587
dependencies/valgrind/include/valgrind/valgrind.h
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,3 +1,4 @@
|
|||
# List of source files which contain translatable strings.
|
||||
src/log/normal.c
|
||||
src/string/i18n.c
|
||||
src/core/runner.c
|
||||
|
|
24
po/fr.po
24
po/fr.po
|
@ -8,7 +8,7 @@ msgid ""
|
|||
msgstr ""
|
||||
"Project-Id-Version: criterion 2.0.0\n"
|
||||
"Report-Msgid-Bugs-To: franklinmathieu+criterion@gmail.com\n"
|
||||
"POT-Creation-Date: 2015-09-16 21:18+0200\n"
|
||||
"POT-Creation-Date: 2015-09-27 12:24+0200\n"
|
||||
"PO-Revision-Date: 2015-04-03 17:58+0200\n"
|
||||
"Last-Translator: <franklinmathieu@gmail.com>\n"
|
||||
"Language-Team: French\n"
|
||||
|
@ -174,3 +174,25 @@ msgstr "L'instruction `%1$s` a levé une instance de l'exception `%2$s`."
|
|||
#, c-format
|
||||
msgid "The statement `%1$s` did not throw an instance of the `%2$s` exception."
|
||||
msgstr "L'instruction `%1$s` n'a pas levé d'instance de l'exception `%2$s`."
|
||||
|
||||
#: src/core/runner.c:54
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%1$sWarning! Criterion has detected that it is running under valgrind, but "
|
||||
"the no_early_exit option is explicitely disabled. Reports will not be "
|
||||
"accurate!%2$s\n"
|
||||
msgstr ""
|
||||
"%1$sAttention! Criterion a détecté qu'il a été lancé avec valgrind, mais "
|
||||
"l'option no_early_exit est explicitement désactivée. Les rapports d'erreur "
|
||||
"ne seront pas précis!%2$s\n"
|
||||
|
||||
#: src/core/runner.c:58
|
||||
#, c-format
|
||||
msgid ""
|
||||
"%1$sWarning! Criterion has detected that it is running under valgrind, but "
|
||||
"the number of jobs have been explicitely set. Reports might appear confusing!"
|
||||
"%2$s\n"
|
||||
msgstr ""
|
||||
"%1$sAttention! Criterion a détecté qu'il a été lancé avec valgrind, mais le "
|
||||
"nombre de tâches est explicitement défini. Les rapports d'erreur risquent "
|
||||
"d'être déroutants!%2$s\n"
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#cmakedefine ENABLE_NLS @ENABLE_NLS@
|
||||
#cmakedefine HAVE_PCRE @HAVE_PCRE@
|
||||
#cmakedefine ENABLE_VALGRIND_ERRORS @ENABLE_VALGRIND_ERRORS@
|
||||
|
||||
# define LOCALEDIR "${LOCALEDIR}"
|
||||
# define PACKAGE "${PROJECT_NAME}"
|
||||
|
|
|
@ -21,9 +21,11 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
* THE SOFTWARE.
|
||||
*/
|
||||
#define CRITERION_LOGGING_COLORS
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <csptr/smalloc.h>
|
||||
#include <valgrind/valgrind.h>
|
||||
#include "criterion/criterion.h"
|
||||
#include "criterion/options.h"
|
||||
#include "criterion/ordered-set.h"
|
||||
|
@ -46,6 +48,27 @@
|
|||
#include "string/extmatch.h"
|
||||
#endif
|
||||
|
||||
typedef const char *const msg_t;
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
static msg_t msg_valgrind_early_exit = N_("%1$sWarning! Criterion has detected "
|
||||
"that it is running under valgrind, but the no_early_exit option is "
|
||||
"explicitely disabled. Reports will not be accurate!%2$s\n");
|
||||
|
||||
static msg_t msg_valgrind_jobs = N_("%1$sWarning! Criterion has detected "
|
||||
"that it is running under valgrind, but the number of jobs have been "
|
||||
"explicitely set. Reports might appear confusing!%2$s\n");
|
||||
#else
|
||||
static msg_t msg_valgrind_early_exit = "%sWarning! Criterion has detected "
|
||||
"that it is running under valgrind, but the no_early_exit option is "
|
||||
"explicitely disabled. Reports will not be accurate!%s\n";
|
||||
|
||||
static msg_t msg_valgrind_jobs = "%sWarning! Criterion has detected "
|
||||
"that it is running under valgrind, but the number of jobs have been "
|
||||
"explicitely set. Reports might appear confusing!%s\n";
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _MSC_VER
|
||||
struct criterion_test *SECTION_START_(cr_tst);
|
||||
struct criterion_suite *SECTION_START_(cr_sts);
|
||||
|
@ -135,6 +158,10 @@ struct criterion_test_set *criterion_init(void) {
|
|||
void run_test_child(struct criterion_test *test,
|
||||
struct criterion_suite *suite) {
|
||||
|
||||
#ifndef ENABLE_VALGRIND_ERRORS
|
||||
VALGRIND_ENABLE_ERROR_REPORTING;
|
||||
#endif
|
||||
|
||||
if (suite->data && suite->data->timeout != 0 && test->data->timeout == 0)
|
||||
setup_timeout((uint64_t) (suite->data->timeout * 1e9));
|
||||
else if (test->data->timeout != 0)
|
||||
|
@ -312,6 +339,14 @@ void disable_unmatching(struct criterion_test_set *set) {
|
|||
struct criterion_test_set *criterion_initialize(void) {
|
||||
init_i18n();
|
||||
|
||||
#ifndef ENABLE_VALGRIND_ERRORS
|
||||
VALGRIND_DISABLE_ERROR_REPORTING;
|
||||
#endif
|
||||
if (RUNNING_ON_VALGRIND) {
|
||||
criterion_options.no_early_exit = 1;
|
||||
criterion_options.jobs = 1;
|
||||
}
|
||||
|
||||
if (resume_child()) // (windows only) resume from the fork
|
||||
exit(0);
|
||||
|
||||
|
@ -320,6 +355,10 @@ struct criterion_test_set *criterion_initialize(void) {
|
|||
|
||||
void criterion_finalize(struct criterion_test_set *set) {
|
||||
sfree(set);
|
||||
|
||||
#ifndef ENABLE_VALGRIND_ERRORS
|
||||
VALGRIND_ENABLE_ERROR_REPORTING;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void run_tests_async(struct criterion_test_set *set,
|
||||
|
@ -386,6 +425,15 @@ static int criterion_run_all_tests_impl(struct criterion_test_set *set) {
|
|||
report(PRE_ALL, set);
|
||||
log(pre_all, set);
|
||||
|
||||
if (RUNNING_ON_VALGRIND) {
|
||||
if (!criterion_options.no_early_exit)
|
||||
criterion_pimportant(CRITERION_PREFIX_DASHES,
|
||||
_(msg_valgrind_early_exit), FG_BOLD, RESET);
|
||||
if (criterion_options.jobs != 1)
|
||||
criterion_pimportant(CRITERION_PREFIX_DASHES,
|
||||
_(msg_valgrind_jobs), FG_BOLD, RESET);
|
||||
}
|
||||
|
||||
fflush(NULL); // flush everything before forking
|
||||
|
||||
g_worker_pipe = stdpipe();
|
||||
|
|
|
@ -144,24 +144,41 @@ int criterion_handle_args(int argc, char *argv[], bool handle_unknown_arg) {
|
|||
{0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
bool use_ascii = !strcmp("1", DEF(getenv("CRITERION_USE_ASCII"), "0"))
|
||||
|| !strcmp("dumb", DEF(getenv("TERM"), "dumb"));
|
||||
|
||||
setlocale(LC_ALL, "");
|
||||
#if ENABLE_NLS
|
||||
textdomain (PACKAGE "-test");
|
||||
#endif
|
||||
|
||||
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");
|
||||
char *env_logging_threshold = getenv("CRITERION_VERBOSITY_LEVEL");
|
||||
char *env_short_filename = getenv("CRITERION_SHORT_FILENAME");
|
||||
|
||||
bool is_term_dumb = !strcmp("dumb", DEF(getenv("TERM"), "dumb"));
|
||||
|
||||
struct criterion_options *opt = &criterion_options;
|
||||
opt->always_succeed = !strcmp("1", DEF(getenv("CRITERION_ALWAYS_SUCCEED"), "0"));
|
||||
opt->no_early_exit = !strcmp("1", DEF(getenv("CRITERION_NO_EARLY_EXIT") , "0"));
|
||||
opt->fail_fast = !strcmp("1", DEF(getenv("CRITERION_FAIL_FAST") , "0"));
|
||||
opt->use_ascii = use_ascii;
|
||||
opt->jobs = atou(DEF(getenv("CRITERION_JOBS"), "0"));
|
||||
opt->logging_threshold = atou(DEF(getenv("CRITERION_VERBOSITY_LEVEL"), "2"));
|
||||
opt->short_filename = !strcmp("1", DEF(getenv("CRITERION_SHORT_FILENAME"), "0"));
|
||||
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)
|
||||
opt->use_ascii = !strcmp("1", env_use_ascii) || is_term_dumb;
|
||||
if (env_jobs)
|
||||
opt->jobs = atou(env_jobs);
|
||||
if (env_logging_threshold)
|
||||
opt->logging_threshold = atou(env_logging_threshold);
|
||||
if (env_short_filename)
|
||||
opt->short_filename = !strcmp("1", env_short_filename);
|
||||
|
||||
#ifdef HAVE_PCRE
|
||||
opt->pattern = getenv("CRITERION_TEST_PATTERN");
|
||||
char *env_pattern = getenv("CRITERION_TEST_PATTERN");
|
||||
if (env_pattern)
|
||||
opt->pattern = env_pattern;
|
||||
#endif
|
||||
|
||||
bool use_tap = !strcmp("1", DEF(getenv("CRITERION_ENABLE_TAP"), "0"));
|
||||
|
|
Loading…
Add table
Reference in a new issue