From e7f7a16fd97eb17c16c6c2f5920872d3d6944d34 Mon Sep 17 00:00:00 2001 From: knj Date: Fri, 22 Jul 2022 14:14:25 +0200 Subject: [PATCH 1/6] add small sanitizer test run to MR pipeline --- .gitlab-ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 82f826e6ff..4124b91080 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -135,6 +135,20 @@ codec-smoke-test: - out/logs +run-selftest-with-msan: + extends: .test-job-linux + stage: test + needs: [ "build-codec-sanitizers-linux" ] + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + script: + - make clean + - make -j CLANG=1 + - python3 scripts/self_test.py --create | tee test_output.txt + - run_errors=$(cat test_output.txt | grep -c "test conditions had run errors") || true + - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang memory-sanitizer"; exit $EXIT_CODE_FAIL; fi + + # compare bit exactness between target and source branch self-test-on-merge-request: extends: .test-job-linux -- GitLab From f65775c0838b59184bde3862de9a5c856a9f49f4 Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 25 Jul 2022 12:02:21 +0200 Subject: [PATCH 2/6] add also asan test to MR pipeline --- .gitlab-ci.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4124b91080..32e8729fb2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -135,7 +135,8 @@ codec-smoke-test: - out/logs -run-selftest-with-msan: +# code selftest testvectors with memory-sanitizer binaries +msan-on-merge-request-linux: extends: .test-job-linux stage: test needs: [ "build-codec-sanitizers-linux" ] @@ -149,6 +150,21 @@ run-selftest-with-msan: - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang memory-sanitizer"; exit $EXIT_CODE_FAIL; fi +# code selftest testvectors with address-sanitizer binaries +asan-on-merge-request-linux: + extends: .test-job-linux + stage: test + needs: [ "build-codec-sanitizers-linux" ] + rules: + - if: $CI_PIPELINE_SOURCE == 'merge_request_event' + script: + - make clean + - make -j CLANG=2 + - python3 scripts/self_test.py --create | tee test_output.txt + - run_errors=$(cat test_output.txt | grep -c "test conditions had run errors") || true + - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang address-sanitizer"; exit $EXIT_CODE_FAIL; fi + + # compare bit exactness between target and source branch self-test-on-merge-request: extends: .test-job-linux -- GitLab From 5bb939944fb42ab61a2b32aa88983c22acffb4be Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 25 Jul 2022 12:21:06 +0200 Subject: [PATCH 3/6] fix run error detection --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 32e8729fb2..3ecdb6d46c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -146,7 +146,7 @@ msan-on-merge-request-linux: - make clean - make -j CLANG=1 - python3 scripts/self_test.py --create | tee test_output.txt - - run_errors=$(cat test_output.txt | grep -c "test conditions had run errors") || true + - run_errors=$(cat test_output.txt | grep -ic "run errors") || true - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang memory-sanitizer"; exit $EXIT_CODE_FAIL; fi @@ -161,7 +161,7 @@ asan-on-merge-request-linux: - make clean - make -j CLANG=2 - python3 scripts/self_test.py --create | tee test_output.txt - - run_errors=$(cat test_output.txt | grep -c "test conditions had run errors") || true + - run_errors=$(cat test_output.txt | grep -ic "run errors") || true - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang address-sanitizer"; exit $EXIT_CODE_FAIL; fi -- GitLab From 2333fdca64a5325f4ed3fecb84ab6e286b054e60 Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 25 Jul 2022 13:21:36 +0200 Subject: [PATCH 4/6] deliberately introduce memory error to test sanitizer pipeline --- lib_enc/ivas_mdct_core_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index 6385d20b2d..ad8322b1c7 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -1192,7 +1192,7 @@ void ivas_mdct_quant_coder( sts = hCPE->hCoreCoder; - for ( ch = 0; ch < CPE_CHANNELS; ch++ ) + for ( ch = 0; ch < CPE_CHANNELS + 1; ch++ ) { set_f( fac_ns[ch], 0.0f, 2 ); set_s( nf_seed[ch], 0, 2 ); -- GitLab From 0cb57d326b64c5cf4982f935818c3bf82f4a5429 Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 25 Jul 2022 13:27:06 +0200 Subject: [PATCH 5/6] correct exit code to trigger failure on error --- .gitlab-ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3ecdb6d46c..82c39305a0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -147,7 +147,7 @@ msan-on-merge-request-linux: - make -j CLANG=1 - python3 scripts/self_test.py --create | tee test_output.txt - run_errors=$(cat test_output.txt | grep -ic "run errors") || true - - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang memory-sanitizer"; exit $EXIT_CODE_FAIL; fi + - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang memory-sanitizer"; exit 1; fi # code selftest testvectors with address-sanitizer binaries @@ -162,7 +162,7 @@ asan-on-merge-request-linux: - make -j CLANG=2 - python3 scripts/self_test.py --create | tee test_output.txt - run_errors=$(cat test_output.txt | grep -ic "run errors") || true - - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang address-sanitizer"; exit $EXIT_CODE_FAIL; fi + - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py with Clang address-sanitizer"; exit 1; fi # compare bit exactness between target and source branch -- GitLab From c0f5ff59e1830d7af8df76d3332cf63660828c64 Mon Sep 17 00:00:00 2001 From: knj Date: Mon, 25 Jul 2022 13:41:48 +0200 Subject: [PATCH 6/6] Revert "deliberately introduce memory error to test sanitizer pipeline" This reverts commit 2333fdca64a5325f4ed3fecb84ab6e286b054e60. --- lib_enc/ivas_mdct_core_enc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_enc/ivas_mdct_core_enc.c b/lib_enc/ivas_mdct_core_enc.c index ad8322b1c7..6385d20b2d 100644 --- a/lib_enc/ivas_mdct_core_enc.c +++ b/lib_enc/ivas_mdct_core_enc.c @@ -1192,7 +1192,7 @@ void ivas_mdct_quant_coder( sts = hCPE->hCoreCoder; - for ( ch = 0; ch < CPE_CHANNELS + 1; ch++ ) + for ( ch = 0; ch < CPE_CHANNELS; ch++ ) { set_f( fac_ns[ch], 0.0f, 2 ); set_s( nf_seed[ch], 0, 2 ); -- GitLab