Valgrind cleanup Remove unneeded compiler flags, check for LUCY_VALGRIND environment variable at run time.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/af6e18eb Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/af6e18eb Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/af6e18eb Branch: refs/heads/master Commit: af6e18eb81383367ff24698797e8833f42fd23e0 Parents: 751c3b3 Author: Nick Wellnhofer <[email protected]> Authored: Sat Dec 24 18:12:01 2016 +0100 Committer: Nick Wellnhofer <[email protected]> Committed: Mon Jan 2 16:35:05 2017 +0100 ---------------------------------------------------------------------- common/charmonizer.c | 4 --- common/charmonizer.main | 4 --- perl/buildlib/Lucy/Build.pm | 12 +------- test/Lucy/Test/Search/TestSortSpec.c | 47 ++++++++++++++++--------------- test/Lucy/Test/Util/TestFreezer.c | 15 +++++----- test/Lucy/Test/Util/TestJson.c | 12 ++++---- 6 files changed, 39 insertions(+), 55 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/af6e18eb/common/charmonizer.c ---------------------------------------------------------------------- diff --git a/common/charmonizer.c b/common/charmonizer.c index 8878f6c..3abadd5 100644 --- a/common/charmonizer.c +++ b/common/charmonizer.c @@ -8793,10 +8793,6 @@ S_add_compiler_flags(struct chaz_CLI *cli) { } if (chaz_Probe_gcc_version_num()) { - if (getenv("LUCY_VALGRIND")) { - chaz_CFlags_append(extra_cflags, - "-DLUCY_VALGRIND -fno-inline-functions"); - } chaz_CFlags_append(extra_cflags, "-pedantic -Wall -Wextra -Wno-variadic-macros"); if (chaz_CLI_defined(cli, "enable-perl")) { http://git-wip-us.apache.org/repos/asf/lucy/blob/af6e18eb/common/charmonizer.main ---------------------------------------------------------------------- diff --git a/common/charmonizer.main b/common/charmonizer.main index cb8f0e6..6d08422 100644 --- a/common/charmonizer.main +++ b/common/charmonizer.main @@ -189,10 +189,6 @@ S_add_compiler_flags(struct chaz_CLI *cli) { } if (chaz_Probe_gcc_version_num()) { - if (getenv("LUCY_VALGRIND")) { - chaz_CFlags_append(extra_cflags, - "-DLUCY_VALGRIND -fno-inline-functions"); - } chaz_CFlags_append(extra_cflags, "-pedantic -Wall -Wextra -Wno-variadic-macros"); if (chaz_CLI_defined(cli, "enable-perl")) { http://git-wip-us.apache.org/repos/asf/lucy/blob/af6e18eb/perl/buildlib/Lucy/Build.pm ---------------------------------------------------------------------- diff --git a/perl/buildlib/Lucy/Build.pm b/perl/buildlib/Lucy/Build.pm index 747c45f..5e802c5 100644 --- a/perl/buildlib/Lucy/Build.pm +++ b/perl/buildlib/Lucy/Build.pm @@ -64,12 +64,6 @@ sub new { $self->extra_compiler_flags(@$extra_cflags); - if ( $ENV{LUCY_VALGRIND} ) { - my $optimize = $self->config('optimize') || ''; - $optimize =~ s/\-O\d+/-O1/g; - $self->config( optimize => $optimize ); - } - $self->charmonizer_params( create_makefile => 1 ); $self->charmonizer_params( charmonizer_c => $CHARMONIZER_C ); @@ -97,8 +91,7 @@ sub _valgrind_base_command { # Run the entire test suite under Valgrind. # -# For this to work, Lucy must be compiled with the LUCY_VALGRIND environment -# variable set to a true value, under a debugging Perl. +# For this to work, the test suite must be run under a debugging Perl. # # A custom suppressions file will probably be needed -- use your judgment. # To pass in one or more local suppressions files, provide a comma separated @@ -112,9 +105,6 @@ sub ACTION_test_valgrind { die "Must be run under a perl that was compiled with -DDEBUGGING" unless $self->config('ccflags') =~ /-D?DEBUGGING\b/ || $^X =~ /\bdebugperl\b/; - if ( !$ENV{LUCY_VALGRIND} ) { - warn "\$ENV{LUCY_VALGRIND} not true -- possible false positives"; - } $self->depends_on('code'); # Unbuffer STDOUT, grab test file names. http://git-wip-us.apache.org/repos/asf/lucy/blob/af6e18eb/test/Lucy/Test/Search/TestSortSpec.c ---------------------------------------------------------------------- diff --git a/test/Lucy/Test/Search/TestSortSpec.c b/test/Lucy/Test/Search/TestSortSpec.c index be6d23f..1dd704b 100644 --- a/test/Lucy/Test/Search/TestSortSpec.c +++ b/test/Lucy/Test/Search/TestSortSpec.c @@ -456,29 +456,30 @@ test_sort_spec(TestBatchRunner *runner) { TEST_TRUE(runner, Vec_Equals(results, (Obj*)wanted), "sort by one criteria"); DECREF(results); -#ifdef LUCY_VALGRIND - SKIP(runner, 2, "known leaks"); -#else - Err *error; - SortContext sort_ctx; - sort_ctx.searcher = searcher; - - sort_ctx.sort_field = nope_str; - error = Err_trap(S_attempt_sorted_search, &sort_ctx); - TEST_TRUE(runner, error != NULL - && Err_is_a(error, ERR) - && Str_Contains_Utf8(Err_Get_Mess(error), "sortable", 8), - "sorting on a non-sortable field throws an error"); - DECREF(error); - - sort_ctx.sort_field = unknown_str; - error = Err_trap(S_attempt_sorted_search, &sort_ctx); - TEST_TRUE(runner, error != NULL - && Err_is_a(error, ERR) - && Str_Contains_Utf8(Err_Get_Mess(error), "sortable", 8), - "sorting on an unknown field throws an error"); - DECREF(error); -#endif + if (getenv("LUCY_VALGRIND")) { + SKIP(runner, 2, "known leaks"); + } + else { + Err *error; + SortContext sort_ctx; + sort_ctx.searcher = searcher; + + sort_ctx.sort_field = nope_str; + error = Err_trap(S_attempt_sorted_search, &sort_ctx); + TEST_TRUE(runner, error != NULL + && Err_is_a(error, ERR) + && Str_Contains_Utf8(Err_Get_Mess(error), "sortable", 8), + "sorting on a non-sortable field throws an error"); + DECREF(error); + + sort_ctx.sort_field = unknown_str; + error = Err_trap(S_attempt_sorted_search, &sort_ctx); + TEST_TRUE(runner, error != NULL + && Err_is_a(error, ERR) + && Str_Contains_Utf8(Err_Get_Mess(error), "sortable", 8), + "sorting on an unknown field throws an error"); + DECREF(error); + } results = S_test_sorted_search(searcher, vehicle_str, 100, weight_str, false, NULL); http://git-wip-us.apache.org/repos/asf/lucy/blob/af6e18eb/test/Lucy/Test/Util/TestFreezer.c ---------------------------------------------------------------------- diff --git a/test/Lucy/Test/Util/TestFreezer.c b/test/Lucy/Test/Util/TestFreezer.c index 2cfba78..6eecab7 100644 --- a/test/Lucy/Test/Util/TestFreezer.c +++ b/test/Lucy/Test/Util/TestFreezer.c @@ -129,13 +129,14 @@ test_num(TestBatchRunner *runner) { TEST_TRUE(runner, Int_Equals(i64, (Obj*)i64_thaw), "Integer freeze/thaw"); -#ifdef LUCY_VALGRIND - SKIP(runner, 1, "known leaks"); -#else - Boolean *true_thaw = (Boolean*)S_freeze_thaw((Obj*)CFISH_TRUE); - TEST_TRUE(runner, Bool_Equals(CFISH_TRUE, (Obj*)true_thaw), - "Boolean freeze/thaw"); -#endif + if (getenv("LUCY_VALGRIND")) { + SKIP(runner, 1, "known leaks"); + } + else { + Boolean *true_thaw = (Boolean*)S_freeze_thaw((Obj*)CFISH_TRUE); + TEST_TRUE(runner, Bool_Equals(CFISH_TRUE, (Obj*)true_thaw), + "Boolean freeze/thaw"); + } DECREF(i64_thaw); DECREF(f64_thaw); http://git-wip-us.apache.org/repos/asf/lucy/blob/af6e18eb/test/Lucy/Test/Util/TestJson.c ---------------------------------------------------------------------- diff --git a/test/Lucy/Test/Util/TestJson.c b/test/Lucy/Test/Util/TestJson.c index 78fa959..af71203 100644 --- a/test/Lucy/Test/Util/TestJson.c +++ b/test/Lucy/Test/Util/TestJson.c @@ -342,9 +342,9 @@ test_max_depth(TestBatchRunner *runner) { void TestJson_Run_IMP(TestJson *self, TestBatchRunner *runner) { uint32_t num_tests = 105; -#ifndef LUCY_VALGRIND - num_tests += 30; // FIXME: syntax errors leak memory. -#endif + if (!getenv("LUCY_VALGRIND")) { + num_tests += 30; // FIXME: syntax errors leak memory. + } TestBatchRunner_Plan(runner, (TestBatch*)self, num_tests); // Test tolerance, then liberalize for testing. @@ -359,8 +359,8 @@ TestJson_Run_IMP(TestJson *self, TestBatchRunner *runner) { test_floats(runner); test_max_depth(runner); -#ifndef LUCY_VALGRIND - test_syntax_errors(runner); -#endif + if (!getenv("LUCY_VALGRIND")) { + test_syntax_errors(runner); + } }
