Loading tests/codec_be_on_mr_nonselection/test_param_file.py +51 −37 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ def convert_test_string_to_tag(test_string): @pytest.mark.parametrize("test_tag", list(param_file_test_dict.keys())) def test_param_file_tests( record_property, decoder_only, dut_encoder_frontend: EncoderFrontend, dut_decoder_frontend: DecoderFrontend, ref_encoder_frontend: EncoderFrontend, Loading Loading @@ -185,6 +186,7 @@ def test_param_file_tests( # -> construct bitstream filename bitstream_file = f"{testv_base}_{tag_str}.192" if not decoder_only: encode( dut_encoder_frontend, ref_encoder_frontend, Loading Loading @@ -230,6 +232,7 @@ def test_param_file_tests( sim_split, update_ref, rootdir, decoder_only, ) # check for eid-xor command line Loading @@ -255,6 +258,7 @@ def test_param_file_tests( eid_split, update_ref, rootdir, decoder_only, ) # evaluate decoder options Loading Loading @@ -320,6 +324,7 @@ def test_param_file_tests( dec_split, update_ref, tracefile_dec, decoder_only, ) if update_ref in [0, 2]: Loading Loading @@ -373,8 +378,9 @@ def test_param_file_tests( # remove DUT output files when test result is OK (to save disk space) if not keep_files: os.remove(f"{dut_base_path}/param_file/enc/{bitstream_file}") os.remove(f"{dut_base_path}/param_file/dec/{output_file}") if not decoder_only: os.remove(f"{dut_base_path}/param_file/enc/{bitstream_file}") if sim_opts != "": os.remove(f"{dut_base_path}/param_file/enc/{testv_base}_{tag_str}.192") os.remove(f"{dut_base_path}/param_file/enc/{netsim_trace_outfile}") Loading Loading @@ -449,6 +455,7 @@ def simulate( sim_opts_list, update_ref, rootdir, decoder_only, ): """ Call network simulator on REF and/or DUT encoder output. Loading Loading @@ -477,20 +484,19 @@ def simulate( else: assert False, f"networkSimulator_g192 not available for {platform.system()}" if update_ref == 1 or update_ref == 2 and not os.path.exists(ref_out_file): # call network simulator on REF encoder output cmd_opts = sim_opts_list if update_ref == 1 or (update_ref == 2 and not os.path.exists(ref_out_file)) or decoder_only: # call network simulator on REF encoder output cmd_opts[1] = f"{ref_out_dir}/{netsim_infile}" cmd_opts[2] = f"{ref_out_dir}/{netsim_outfile}" # ref_out_file cmd_opts[3] = f"{ref_out_dir}/{netsim_tracefile}" run(netsim + cmd_opts, check=False) if update_ref in [0, 2]: elif update_ref in [0, 2]: # call network simulator on DUT encoder output cmd_opts = sim_opts_list cmd_opts[1] = f"{dut_out_dir}/{netsim_infile}" cmd_opts[2] = f"{dut_out_dir}/{netsim_outfile}" # dut_out_file if update_ref == 1 or (update_ref == 2 and not os.path.exists(ref_out_file)): cmd_opts[3] = f"{ref_out_dir}/{netsim_tracefile}" elif update_ref in [0, 2]: cmd_opts[3] = f"{dut_out_dir}/{netsim_tracefile}" run(netsim + cmd_opts, check=False) Loading @@ -500,6 +506,7 @@ def error_insertion( eid_opts_list, update_ref, rootdir, decoder_only, ): """ Call eid-xor to insert frame erasure on REF and/or DUT encoder output. Loading @@ -522,18 +529,20 @@ def error_insertion( else: assert False, f"eid-xor not available for {platform.system()}" if update_ref == 1 or update_ref == 2 and not os.path.exists(ref_out_file): # call eid-xor on REF encoder output cmd_opts = eid_opts_list cmd_opts[-3] = f"{ref_out_dir}/{eid_xor_infile}" cmd_opts[-1] = f"{ref_out_dir}/{eid_xor_outfile}" # ref_out_file run(eid_xor + cmd_opts, check=False) if update_ref in [0, 2]: if update_ref == 1 or (update_ref == 2 and not os.path.exists(ref_out_file)) or decoder_only: # call eid-xor on REF encoder output cmd_opts[-3] = f"{ref_out_dir}/{eid_xor_infile}" elif update_ref in [0, 2]: # call eid-xor on DUT encoder output cmd_opts = eid_opts_list cmd_opts[-3] = f"{dut_out_dir}/{eid_xor_infile}" if update_ref == 1 or (update_ref == 2 and not os.path.exists(ref_out_file)): cmd_opts[-1] = f"{ref_out_dir}/{eid_xor_outfile}" # ref_out_file elif update_ref in [0, 2]: cmd_opts[-1] = f"{dut_out_dir}/{eid_xor_outfile}" # ref_out_file run(eid_xor + cmd_opts, check=False) Loading @@ -549,6 +558,7 @@ def decode( dec_opts_list, update_ref, tracefile_dec, decoder_only, ): """ Call REF and/or DUT decoder. Loading Loading @@ -589,6 +599,10 @@ def decode( x if x != "tracefile_dec" else f"{dut_out_dir}/{tracefile_dec}" for x in dec_opts_list ] if decoder_only: dut_in_file = ref_in_file # call DUT decoder decoder_frontend.run( output_config, Loading tests/conftest.py +15 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,13 @@ def pytest_addoption(parser): default=20, ) parser.addoption( "--decoder_only", help="Only run decoder parts of tests in 'codec_be_on_mr_nonselection'. Use ref encoder output bitstreams.", action="store_true", default=False, ) @pytest.fixture(scope="session", autouse=True) def update_ref(request): """ Loading Loading @@ -692,6 +699,14 @@ def dut_base_path(request) -> str: return path @pytest.fixture(scope="session", autouse=True) def decoder_only(request) -> bool: """ Return value of cmdl param --decoder_only """ return request.config.getoption("--decoder_only") def pytest_configure(config): config.addinivalue_line("markers", "serial: mark test to run only in serial") config.addinivalue_line( Loading Loading
tests/codec_be_on_mr_nonselection/test_param_file.py +51 −37 Original line number Diff line number Diff line Loading @@ -127,6 +127,7 @@ def convert_test_string_to_tag(test_string): @pytest.mark.parametrize("test_tag", list(param_file_test_dict.keys())) def test_param_file_tests( record_property, decoder_only, dut_encoder_frontend: EncoderFrontend, dut_decoder_frontend: DecoderFrontend, ref_encoder_frontend: EncoderFrontend, Loading Loading @@ -185,6 +186,7 @@ def test_param_file_tests( # -> construct bitstream filename bitstream_file = f"{testv_base}_{tag_str}.192" if not decoder_only: encode( dut_encoder_frontend, ref_encoder_frontend, Loading Loading @@ -230,6 +232,7 @@ def test_param_file_tests( sim_split, update_ref, rootdir, decoder_only, ) # check for eid-xor command line Loading @@ -255,6 +258,7 @@ def test_param_file_tests( eid_split, update_ref, rootdir, decoder_only, ) # evaluate decoder options Loading Loading @@ -320,6 +324,7 @@ def test_param_file_tests( dec_split, update_ref, tracefile_dec, decoder_only, ) if update_ref in [0, 2]: Loading Loading @@ -373,8 +378,9 @@ def test_param_file_tests( # remove DUT output files when test result is OK (to save disk space) if not keep_files: os.remove(f"{dut_base_path}/param_file/enc/{bitstream_file}") os.remove(f"{dut_base_path}/param_file/dec/{output_file}") if not decoder_only: os.remove(f"{dut_base_path}/param_file/enc/{bitstream_file}") if sim_opts != "": os.remove(f"{dut_base_path}/param_file/enc/{testv_base}_{tag_str}.192") os.remove(f"{dut_base_path}/param_file/enc/{netsim_trace_outfile}") Loading Loading @@ -449,6 +455,7 @@ def simulate( sim_opts_list, update_ref, rootdir, decoder_only, ): """ Call network simulator on REF and/or DUT encoder output. Loading Loading @@ -477,20 +484,19 @@ def simulate( else: assert False, f"networkSimulator_g192 not available for {platform.system()}" if update_ref == 1 or update_ref == 2 and not os.path.exists(ref_out_file): # call network simulator on REF encoder output cmd_opts = sim_opts_list if update_ref == 1 or (update_ref == 2 and not os.path.exists(ref_out_file)) or decoder_only: # call network simulator on REF encoder output cmd_opts[1] = f"{ref_out_dir}/{netsim_infile}" cmd_opts[2] = f"{ref_out_dir}/{netsim_outfile}" # ref_out_file cmd_opts[3] = f"{ref_out_dir}/{netsim_tracefile}" run(netsim + cmd_opts, check=False) if update_ref in [0, 2]: elif update_ref in [0, 2]: # call network simulator on DUT encoder output cmd_opts = sim_opts_list cmd_opts[1] = f"{dut_out_dir}/{netsim_infile}" cmd_opts[2] = f"{dut_out_dir}/{netsim_outfile}" # dut_out_file if update_ref == 1 or (update_ref == 2 and not os.path.exists(ref_out_file)): cmd_opts[3] = f"{ref_out_dir}/{netsim_tracefile}" elif update_ref in [0, 2]: cmd_opts[3] = f"{dut_out_dir}/{netsim_tracefile}" run(netsim + cmd_opts, check=False) Loading @@ -500,6 +506,7 @@ def error_insertion( eid_opts_list, update_ref, rootdir, decoder_only, ): """ Call eid-xor to insert frame erasure on REF and/or DUT encoder output. Loading @@ -522,18 +529,20 @@ def error_insertion( else: assert False, f"eid-xor not available for {platform.system()}" if update_ref == 1 or update_ref == 2 and not os.path.exists(ref_out_file): # call eid-xor on REF encoder output cmd_opts = eid_opts_list cmd_opts[-3] = f"{ref_out_dir}/{eid_xor_infile}" cmd_opts[-1] = f"{ref_out_dir}/{eid_xor_outfile}" # ref_out_file run(eid_xor + cmd_opts, check=False) if update_ref in [0, 2]: if update_ref == 1 or (update_ref == 2 and not os.path.exists(ref_out_file)) or decoder_only: # call eid-xor on REF encoder output cmd_opts[-3] = f"{ref_out_dir}/{eid_xor_infile}" elif update_ref in [0, 2]: # call eid-xor on DUT encoder output cmd_opts = eid_opts_list cmd_opts[-3] = f"{dut_out_dir}/{eid_xor_infile}" if update_ref == 1 or (update_ref == 2 and not os.path.exists(ref_out_file)): cmd_opts[-1] = f"{ref_out_dir}/{eid_xor_outfile}" # ref_out_file elif update_ref in [0, 2]: cmd_opts[-1] = f"{dut_out_dir}/{eid_xor_outfile}" # ref_out_file run(eid_xor + cmd_opts, check=False) Loading @@ -549,6 +558,7 @@ def decode( dec_opts_list, update_ref, tracefile_dec, decoder_only, ): """ Call REF and/or DUT decoder. Loading Loading @@ -589,6 +599,10 @@ def decode( x if x != "tracefile_dec" else f"{dut_out_dir}/{tracefile_dec}" for x in dec_opts_list ] if decoder_only: dut_in_file = ref_in_file # call DUT decoder decoder_frontend.run( output_config, Loading
tests/conftest.py +15 −0 Original line number Diff line number Diff line Loading @@ -191,6 +191,13 @@ def pytest_addoption(parser): default=20, ) parser.addoption( "--decoder_only", help="Only run decoder parts of tests in 'codec_be_on_mr_nonselection'. Use ref encoder output bitstreams.", action="store_true", default=False, ) @pytest.fixture(scope="session", autouse=True) def update_ref(request): """ Loading Loading @@ -692,6 +699,14 @@ def dut_base_path(request) -> str: return path @pytest.fixture(scope="session", autouse=True) def decoder_only(request) -> bool: """ Return value of cmdl param --decoder_only """ return request.config.getoption("--decoder_only") def pytest_configure(config): config.addinivalue_line("markers", "serial: mark test to run only in serial") config.addinivalue_line( Loading