Commit 400690ef authored by Jan Kiene's avatar Jan Kiene
Browse files

add check for testvectors being present

parent 27514000
Loading
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -69,7 +69,9 @@ stages:
  # compare to last target branch commit before pipeline was created
  - target_commit=$(git log $CI_MERGE_REQUEST_TARGET_BRANCH_NAME -1 --oneline --before=${CI_PIPELINE_CREATED_AT} --format=%H)


.check-for-testvectors: &check-for-testvectors
  # check if the testvector files specified in scripts/config/ci_linux*.json are present
  - python3 -m pytest tests/test_vectors_available.py

.merge-request-comparison-setup-codec:
  &merge-request-comparison-setup-codec ### build test binaries, initial clean for paranoia reasons
@@ -671,6 +673,7 @@ clang-format-check:
  script:
    - *print-common-info
    - *update-ltv-repo
    - *check-for-testvectors
    - cmake .
    - make -j

+19 −0
Original line number Diff line number Diff line
import pytest
import pathlib
import json
import itertools

TEST_CONFIG_DIR = pathlib.Path(__file__).parent.parent.joinpath("scripts/config")
TEST_CONFIGS = [f for f in TEST_CONFIG_DIR.iterdir() if f.name.startswith("ci_linux")]

def get_testvectors_from_config(config) -> list:
    with open(config) as f:
        cfg = json.load(f)
    return list(cfg["inpaths"].values())

TESTVECTORS = sorted(set(itertools.chain(*[get_testvectors_from_config(cfg) for cfg in TEST_CONFIGS])))

@pytest.mark.parametrize("testvector", TESTVECTORS)
def test_vectors_available(testvector):
    if not pathlib.Path(testvector).exists():
        raise FileNotFoundError(f"Testvector {testvector} can not be found")
 No newline at end of file