diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0051d0cdd956ab04b5da24ef9ca65416cf3ff6d2..27212c8646895fe39240c459338d0ac6ff8f98ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,7 +4,7 @@ variables: BUILD_OUTPUT: "build_output.txt" EVS_BE_TEST_DIR: "/usr/local/be_2_evs_test" EVS_BE_WIN_TEST_DIR: "C:/Users/gitlab-runner/testvec" - SANITIZER_TESTS: "CLANG1 CLANG2" + SANITIZER_TESTS: "CLANG1 CLANG2 CLANG3" OUT_FORMATS_CHANNEL_BASED: "stereo mono 5_1 5_1_2 5_1_4 7_1 7_1_4" OUT_FORMATS_SCENE_BASED: "FOA HOA2 HOA3" OUT_FORMATS_BINAURAL: "BINAURAL BINAURAL_ROOM_IR BINAURAL_ROOM_REVERB" diff --git a/ci/run_scheduled_sanitizer_test.py b/ci/run_scheduled_sanitizer_test.py index c6d3d78d45598d3a3d68933dc024b3969acd7bd6..5007914b957d3e7a22cacb992ee370ea57c7a91d 100755 --- a/ci/run_scheduled_sanitizer_test.py +++ b/ci/run_scheduled_sanitizer_test.py @@ -46,7 +46,8 @@ from combine_genpatt_and_jbm_profile import combine_error_profiles SCRIPT_DIR = pathlib.Path("./scripts").resolve() DURATION = "120" CFG = "ci_linux_ltv.json" -SUPPORTED_TESTS = ["CLANG1", "CLANG2", "CLANG3", "VALGRIND"] +SUPPORTED_TESTS = ["CLANG1", "CLANG2", "CLANG3"] +USAN_SUPP_FILE = str(SCRIPT_DIR.joinpath("ubsan.supp")) EP_FILE = "ep_015.g192" DLY_PROFILE_IN = SCRIPT_DIR.joinpath("dly_error_profiles/dly_error_profile_5.dat") DLY_PROFILE_OUT = "dly_profile.dat" @@ -145,6 +146,8 @@ def run_check(in_format: str, out_formats: list, tests: list, run_fec: bool = Tr "--oc", *out_formats, *md_file_command, + "--usan_supp_file", + USAN_SUPP_FILE, ] print( diff --git a/scripts/IvasBuildAndRunChecks.py b/scripts/IvasBuildAndRunChecks.py index f32ade77733d567f2dd235dea577d781383785f1..523eee3a980d2879dada4cc241fa5dc4668e8d8e 100755 --- a/scripts/IvasBuildAndRunChecks.py +++ b/scripts/IvasBuildAndRunChecks.py @@ -91,6 +91,10 @@ class IvasBuildAndRunChecks(IvasScriptsCommon.IvasScript): self.parser.add_argument( "--rebuild", help="force a rebuild of the binaries", action="store_true" ) + self.parser.add_argument( + "--usan_supp_file", help="suppression file for undef behaviour sanitizer", + default=None, + ) def run(self): @@ -157,6 +161,7 @@ class IvasBuildAndRunChecks(IvasScriptsCommon.IvasScript): format_select_list=modes, formats_fname=self.args["format_file"], max_workers=self.args["max_workers"], + usan_supp_file=self.args["usan_supp_file"], ) IvasScriptsCommon.runner_setup( br.build_and_run_dict[check]["runner"], self.args diff --git a/scripts/pyivastest/IvasModeRunner.py b/scripts/pyivastest/IvasModeRunner.py index 2ab5f162436eed9f098b182d46b86b442ab86156..c67f252e1d073198a2360920e344162a8b6cc8af 100644 --- a/scripts/pyivastest/IvasModeRunner.py +++ b/scripts/pyivastest/IvasModeRunner.py @@ -68,6 +68,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): dir_name=".", bin_suffix="", test_tool="", + run_env={}, silent=False, site_config="", sample_rate_enc_in=None, @@ -115,6 +116,8 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): self.decoder = "" self.bin_suffix = bin_suffix self.test_tool = test_tool + self.run_env = os.environ.copy() + self.run_env.update(run_env) self.silent = silent self.failed_threads = None self.max_workers = max_workers @@ -314,7 +317,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): + [enc_file_name, dec_file_name] ) - cur_dec_result = subprocess.run(dec_cmd, capture_output=True, text=True) + cur_dec_result = subprocess.run(dec_cmd, capture_output=True, text=True, env=self.run_env) dec_log.write(" ".join(dec_cmd)) dec_log.write(cur_dec_result.stderr) dec_log.write(cur_dec_result.stdout) @@ -703,7 +706,7 @@ class IvasModeRunner(IvasModeCollector.IvasModeCollector): enc_log = open(enc_log_name, "w") enc_log.write(" ".join(enc_cmd)) - enc_result = subprocess.run(enc_cmd, capture_output=True, text=True) + enc_result = subprocess.run(enc_cmd, capture_output=True, text=True, env=self.run_env) error = enc_result.returncode enc_log.write(enc_result.stderr) enc_log.write(enc_result.stdout) diff --git a/scripts/pyivastest/IvasSvnBuilder.py b/scripts/pyivastest/IvasSvnBuilder.py index 0d7cc9c847c14c5a241c5b958102851136641e83..a6c7825ebe7548a939b402ab368cea3bce71fdfb 100644 --- a/scripts/pyivastest/IvasSvnBuilder.py +++ b/scripts/pyivastest/IvasSvnBuilder.py @@ -763,6 +763,7 @@ class IvasBuilderAndRunner(IvasBaseClass): self, cfg_name, run_tool="", + run_env={}, make_options=[], defines_to_enable=[], defines_to_disable=[], @@ -829,6 +830,7 @@ class IvasBuilderAndRunner(IvasBaseClass): dir_name=run_dir, bin_suffix=self.builder.binary_ext, test_tool=run_tool, + run_env=run_env, site_config=self.site_config, sample_rate_enc_in=sample_rate_enc_in, formats_fname=formats_fname, @@ -1175,12 +1177,14 @@ class IvasBuilderAndRunner(IvasBaseClass): defines_to_disable=None, formats_fname="", max_workers=1, + usan_supp_file=None, ): n_cpus = cpu_count() # do not use all cores to avoid weird getting-stuck issues observed on Mac... make_options = ["-j" ,f"{n_cpus - 2}"] run_tool = "" + run_env = dict() if defines_to_enable is None: defines_to_enable_check = [] else: @@ -1190,8 +1194,14 @@ class IvasBuilderAndRunner(IvasBaseClass): else: defines_to_disable_check = defines_to_disable.copy() if check.startswith("CLANG"): - make_options.append("CLANG=" + check[-1]) + clang_n = check[-1] + make_options.append("CLANG=" + clang_n) defines_to_disable_check.extend(["RAM_COUNTING_TOOL"]) + + # for undefined behaviou sanitizer, pass suppression file if given + if clang_n == "3" and usan_supp_file is not None: + run_env["UBSAN_OPTIONS"] = f"suppressions={usan_supp_file},report_error_type=1" + elif check == "VALGRIND": defines_to_disable_check.extend(["RAM_COUNTING_TOOL"]) run_tool = [ @@ -1206,6 +1216,7 @@ class IvasBuilderAndRunner(IvasBaseClass): self.add_build_and_run_config( check, run_tool=run_tool, + run_env=run_env, make_options=make_options, format_select_list=format_select_list, mode_select_list=mode_select_list,