diff --git a/scripts/ci_checks/linux-arm/run-tests-in-qemu.sh b/scripts/ci_checks/linux-arm/run-tests-in-qemu.sh index c9d5c21b4..54c2a3c62 100755 --- a/scripts/ci_checks/linux-arm/run-tests-in-qemu.sh +++ b/scripts/ci_checks/linux-arm/run-tests-in-qemu.sh @@ -20,6 +20,6 @@ find bin/"$toolchain" -name 'roc-test-*' | \ do LD_LIBRARY_PATH="/opt/sysroot/lib:$(echo \ "$PWD/build/3rdparty/$toolchain/$compiler"/*/rpath | tr ' ' ':')" \ - python3 scripts/scons_helpers/timeout-run.py 300 \ + python3 scripts/scons_helpers/timeout-run.py 900 \ "$qemu_cmd" -L "/opt/sysroot" -cpu "$cpu" "$tst" done diff --git a/scripts/ci_checks/linux-checks/run-tests-in-valgrind.sh b/scripts/ci_checks/linux-checks/run-tests-in-valgrind.sh index 295d07f57..4a5f39a84 100755 --- a/scripts/ci_checks/linux-checks/run-tests-in-valgrind.sh +++ b/scripts/ci_checks/linux-checks/run-tests-in-valgrind.sh @@ -2,11 +2,14 @@ set -eux -o pipefail +export RUNNING_IN_VALGRIND=1 + find bin/x86_64-pc-linux-gnu -name 'roc-test-*' |\ while read tst do - python3 scripts/scons_helpers/timeout-run.py 3000 \ + python3 scripts/scons_helpers/timeout-run.py 900 \ valgrind \ + --suppressions=src/valgrind_suppressions.supp \ --max-stackframe=10475520 \ --error-exitcode=1 --exit-on-first-error=yes \ ${tst} diff --git a/src/tests/public_api/test_loopback_sender_2_receiver.cpp b/src/tests/public_api/test_loopback_sender_2_receiver.cpp index 277ff7ae3..a83415afc 100644 --- a/src/tests/public_api/test_loopback_sender_2_receiver.cpp +++ b/src/tests/public_api/test_loopback_sender_2_receiver.cpp @@ -117,6 +117,10 @@ TEST_GROUP(loopback_sender_2_receiver) { bool is_ldpc_supported() { return fec::CodecMap::instance().has_scheme(packet::FEC_LDPC_Staircase); } + + bool running_in_valgrind() { + return ExtTestRunner::getCurrent()->runningInValgrind(); + } }; TEST(loopback_sender_2_receiver, bare_rtp) { @@ -630,7 +634,7 @@ TEST(loopback_sender_2_receiver, multitrack_separate_contexts) { // Smoke test for various counters, durations, etc. TEST(loopback_sender_2_receiver, metrics_measurements) { - if (!is_rs8m_supported()) { + if (!is_rs8m_supported() || running_in_valgrind()) { TEST_SKIP(); } diff --git a/src/tests/test_harness.cpp b/src/tests/test_harness.cpp index abb0eb478..9f09f0e69 100644 --- a/src/tests/test_harness.cpp +++ b/src/tests/test_harness.cpp @@ -8,6 +8,8 @@ #include "test_harness.h" +#include "roc_core/stddefs.h" + ExtTestOutput::ExtTestOutput() : ConsoleTestOutput() { } @@ -36,8 +38,14 @@ ExtTestRunner* ExtTestRunner::getCurrent() { ExtTestRunner::ExtTestRunner(int argc, const char* const* argv) : CommandLineTestRunner(argc, argv, TestRegistry::getCurrentRegistry()) - , test_skipped_(false) { + , test_skipped_(false) + , valgrind_detected_(false) { current_runner_ = this; + + const char* valgrind = getenv("RUNNING_IN_VALGRIND"); + if (valgrind && valgrind[0] && strcmp(valgrind, "0") != 0) { + valgrind_detected_ = true; + } } void ExtTestRunner::markTestStarted() { @@ -56,6 +64,10 @@ bool ExtTestRunner::isTestSkipped() const { return test_skipped_; } +bool ExtTestRunner::runningInValgrind() const { + return valgrind_detected_; +} + TestOutput* ExtTestRunner::createConsoleOutput() { return new ExtTestOutput; } diff --git a/src/tests/test_harness.h b/src/tests/test_harness.h index a66c459f5..367c2e182 100644 --- a/src/tests/test_harness.h +++ b/src/tests/test_harness.h @@ -39,6 +39,7 @@ class ExtTestRunner : public CommandLineTestRunner { void markTestEnded(); bool isTestSkipped() const; + bool runningInValgrind() const; protected: virtual TestOutput* createConsoleOutput(); @@ -46,6 +47,7 @@ class ExtTestRunner : public CommandLineTestRunner { private: static ExtTestRunner* current_runner_; bool test_skipped_; + bool valgrind_detected_; }; #endif // ROC_TEST_HARNESS_H_ diff --git a/src/valgrind_suppressions.supp b/src/valgrind_suppressions.supp new file mode 100644 index 000000000..1a81ef4ed --- /dev/null +++ b/src/valgrind_suppressions.supp @@ -0,0 +1,19 @@ +{ + cpputest_NormalTestTerminator_exitCurrentTest + Memcheck:Param + write(buf) + ... + fun:_ZNK20NormalTestTerminator15exitCurrentTestEv +} +{ + cpputest_PlatformSpecificSetJmpImplementation + Memcheck:Addr8 + ... + fun:PlatformSpecificSetJmpImplementation +} +{ + cpputest_CommandLineTestRunner_dtor + Memcheck:Free + fun:_ZdlPvm + fun:_ZN21CommandLineTestRunnerD1Ev +}