Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COM-12716: Fix AV1 argon test vector paths when running tests #220

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fluster/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ 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 not self.test_suite.is_single_archive else ""),
self.test_vector.input_file,
)
output_filepath = normalize_path(output_filepath)
Expand Down
20 changes: 12 additions & 8 deletions fluster/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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 not self.is_single_archive:
data.pop("is_single_archive")
if self.failing_test_vectors is None:
data.pop("failing_test_vectors")
else:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -346,7 +350,7 @@ def _callback_error(err: Any) -> None:

downloads = []

if self.name != "AV1_ARGON_VECTORS":
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(
Expand All @@ -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,
Expand 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,
)
)
Expand Down
8 changes: 6 additions & 2 deletions scripts/gen_av1_argon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion test_suites/av1/AV1-TEST-VECTORS.json
Original file line number Diff line number Diff line change
Expand Up @@ -1916,4 +1916,4 @@
"result": "392a4adc567fa05b210eebe15bcbb491"
}
]
}
}
1 change: 1 addition & 0 deletions test_suites/av1/AV1_ARGON_VECTORS.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "AV1_ARGON_VECTORS",
"codec": "AV1",
"description": "AV1 Argon Streams",
"is_single_archive": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

"test_vectors": [
{
"name": "test3795_6754",
Expand Down