Commit ca3bd0d1 authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'ci/usan_ltv' into 'main'

[CI] Add Usan to ltv sanitizer tests

See merge request !1314
parents 443d8047 e87890ae
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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"
+4 −1
Original line number Diff line number Diff line
@@ -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(
+5 −0
Original line number Diff line number Diff line
@@ -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
+5 −2
Original line number Diff line number Diff line
@@ -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)
+12 −1
Original line number Diff line number Diff line
@@ -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,