From e6615d6435c2cbac92e6240cbbaf177ddd864d2e Mon Sep 17 00:00:00 2001 From: Michalis Dimopoulos Date: Mon, 2 Dec 2024 20:14:10 +0100 Subject: [PATCH 1/3] COM-12716: Fix AV1 argon test vector paths when running tests - added new is_single_archive optional member in TestSuite class - excluded this member from json export function - adapted AV1 argon test suite generator script and .json --- fluster/test.py | 6 +++++- fluster/test_suite.py | 20 ++++++++++++-------- scripts/gen_av1_argon.py | 8 ++++++-- test_suites/av1/AV1-TEST-VECTORS.json | 2 +- test_suites/av1/AV1_ARGON_VECTORS.json | 1 + 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/fluster/test.py b/fluster/test.py index 6df333f..c88136e 100644 --- a/fluster/test.py +++ b/fluster/test.py @@ -69,7 +69,11 @@ def _test(self) -> None: input_filepath = os.path.join( self.resources_dir, self.test_suite.name, - self.test_vector.name, + ( + self.test_vector.name + if self.test_suite.is_single_archive is False + else "" + ), self.test_vector.input_file, ) output_filepath = normalize_path(output_filepath) diff --git a/fluster/test_suite.py b/fluster/test_suite.py index e306243..433b9c1 100644 --- a/fluster/test_suite.py +++ b/fluster/test_suite.py @@ -63,8 +63,8 @@ def set_test_vector(self, test_vector: TestVector) -> None: self.test_vector = test_vector -class DownloadWorkAV1Argon(DownloadWork): - """Context to pass to AV1 Argon download worker""" +class DownloadWorkSingleArchive(DownloadWork): + """Context to pass to single archive download worker""" def __init__( self, @@ -134,12 +134,14 @@ def __init__( codec: Codec, description: str, test_vectors: Dict[str, TestVector], + is_single_archive: Optional[bool] = False, failing_test_vectors: Optional[Dict[str, TestVector]] = None, ): # JSON members self.name = name self.codec = codec self.description = description + self.is_single_archive = is_single_archive self.test_vectors = test_vectors self.failing_test_vectors = failing_test_vectors @@ -176,6 +178,8 @@ def to_json_file(self, filename: str) -> None: data.pop("filename") data.pop("test_vectors_success") data.pop("time_taken") + if self.is_single_archive is False: + data.pop("is_single_archive") if self.failing_test_vectors is None: data.pop("failing_test_vectors") else: @@ -250,8 +254,8 @@ def _download_worker(ctx: DownloadWork) -> None: os.remove(dest_path) @staticmethod - def _download_worker_av1_argon(ctx: DownloadWorkAV1Argon) -> None: - """Download AV1 Argon test suite and extract all test vectors""" + def _download_worker_single_archive(ctx: DownloadWorkSingleArchive) -> None: + """Download single archive test suite and extract all test vectors""" test_vectors = ctx.test_vectors # Extract 1st test vector from the Dict to use as reference for the download process of .zip source file that @@ -346,7 +350,7 @@ def _callback_error(err: Any) -> None: downloads = [] - if self.name != "AV1_ARGON_VECTORS": + if self.is_single_archive is False: print(f"Downloading test suite {self.name} using {jobs} parallel jobs") for test_vector in self.test_vectors.values(): dwork = DownloadWork( @@ -369,7 +373,7 @@ def _callback_error(err: Any) -> None: print( f"Downloading test suite {self.name} using 1 job (no parallel execution possible)" ) - dwork_av1 = DownloadWorkAV1Argon( + dwork_single_archive = DownloadWorkSingleArchive( out_dir, verify, extract_all, @@ -381,8 +385,8 @@ def _callback_error(err: Any) -> None: # We can only use 1 parallel job because all test vectors are inside the same .zip source file downloads.append( pool.apply_async( - self._download_worker_av1_argon, - args=(dwork_av1,), + self._download_worker_single_archive, + args=(dwork_single_archive,), error_callback=_callback_error, ) ) diff --git a/scripts/gen_av1_argon.py b/scripts/gen_av1_argon.py index e0faac3..91353a0 100755 --- a/scripts/gen_av1_argon.py +++ b/scripts/gen_av1_argon.py @@ -54,6 +54,7 @@ def __init__( self.description = description self.site = site self.use_ffprobe = use_ffprobe + self.is_single_archive = True def generate(self, download): """Generates the test suite and saves it to a file""" @@ -66,6 +67,7 @@ def generate(self, download): self.codec, self.description, dict(), + self.is_single_archive, ) os.makedirs(extract_folder, exist_ok=True) # Download the zip file @@ -100,10 +102,12 @@ def generate(self, download): ): zip_ref.extract(file_info, extract_folder) - # Create the test vector and test suite + # Create test vectors and test suite print("Creating test vectors and test suite") source_checksum = utils.file_checksum(extract_folder + "/" + self.name) - for file in test_vector_files: + for idx, file in enumerate(test_vector_files): + if (idx+1) % 500 == 0: + print("Processing vector {} out of a total of {}".format(idx+1, len(test_vector_files))) filename = os.path.splitext(os.path.basename(file))[0] # ffprobe execution if self.use_ffprobe: diff --git a/test_suites/av1/AV1-TEST-VECTORS.json b/test_suites/av1/AV1-TEST-VECTORS.json index 6b0c519..bedf85b 100644 --- a/test_suites/av1/AV1-TEST-VECTORS.json +++ b/test_suites/av1/AV1-TEST-VECTORS.json @@ -1916,4 +1916,4 @@ "result": "392a4adc567fa05b210eebe15bcbb491" } ] -} \ No newline at end of file +} diff --git a/test_suites/av1/AV1_ARGON_VECTORS.json b/test_suites/av1/AV1_ARGON_VECTORS.json index 1c959de..50a533b 100644 --- a/test_suites/av1/AV1_ARGON_VECTORS.json +++ b/test_suites/av1/AV1_ARGON_VECTORS.json @@ -2,6 +2,7 @@ "name": "AV1_ARGON_VECTORS", "codec": "AV1", "description": "AV1 Argon Streams", + "is_single_archive": true, "test_vectors": [ { "name": "test3795_6754", From 682c25b36cbff982d7f386f0269f03fe7b98c838 Mon Sep 17 00:00:00 2001 From: Michalis Dimopoulos Date: Tue, 3 Dec 2024 11:57:43 +0100 Subject: [PATCH 2/3] fixup! COM-12716: Fix AV1 argon test vector paths when running tests --- fluster/test.py | 2 +- fluster/test_suite.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fluster/test.py b/fluster/test.py index c88136e..18427f2 100644 --- a/fluster/test.py +++ b/fluster/test.py @@ -71,7 +71,7 @@ def _test(self) -> None: self.test_suite.name, ( self.test_vector.name - if self.test_suite.is_single_archive is False + if not self.test_suite.is_single_archive else "" ), self.test_vector.input_file, diff --git a/fluster/test_suite.py b/fluster/test_suite.py index 433b9c1..8d11fa6 100644 --- a/fluster/test_suite.py +++ b/fluster/test_suite.py @@ -178,7 +178,7 @@ def to_json_file(self, filename: str) -> None: data.pop("filename") data.pop("test_vectors_success") data.pop("time_taken") - if self.is_single_archive is False: + if not self.is_single_archive: data.pop("is_single_archive") if self.failing_test_vectors is None: data.pop("failing_test_vectors") @@ -350,7 +350,7 @@ def _callback_error(err: Any) -> None: downloads = [] - if self.is_single_archive is False: + if not self.is_single_archive: print(f"Downloading test suite {self.name} using {jobs} parallel jobs") for test_vector in self.test_vectors.values(): dwork = DownloadWork( From af8cfcfd6c0782bfe73ce1edc58820f0600409a4 Mon Sep 17 00:00:00 2001 From: Michalis Dimopoulos Date: Tue, 3 Dec 2024 12:05:37 +0100 Subject: [PATCH 3/3] fixup! fixup! COM-12716: Fix AV1 argon test vector paths when running tests --- fluster/test.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fluster/test.py b/fluster/test.py index 18427f2..08241db 100644 --- a/fluster/test.py +++ b/fluster/test.py @@ -69,11 +69,7 @@ def _test(self) -> None: input_filepath = os.path.join( self.resources_dir, self.test_suite.name, - ( - self.test_vector.name - if not self.test_suite.is_single_archive - else "" - ), + (self.test_vector.name if not self.test_suite.is_single_archive else ""), self.test_vector.input_file, ) output_filepath = normalize_path(output_filepath)