Skip to content

Commit

Permalink
Remove hardcoded build patch from test script (#1938)
Browse files Browse the repository at this point in the history
If a user has passed a custom build path to cmake, and then calls for
example `ninja -C <custom_build_path> run_tests`, the script
test_acvp_vectors.py fails due to having "build" harcoded in the calls.

Instead, let's use `helpers.get_current_build_dir_name()` to get the build
path and use that instead. This is already done in other scripts (e.g.,
test_binary.py)

Signed-off-by: Iyán Méndez Veiga <[email protected]>
  • Loading branch information
iyanmv authored Sep 27, 2024
1 parent c4a5476 commit a552876
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/test_acvp_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ def test_acvp_vec_kem_keygen(kem_name):
z = testCase["z"]
pk = testCase["ek"]
sk = testCase["dk"]


build_dir = helpers.get_current_build_dir_name()
helpers.run_subprocess(
['build/tests/vectors_kem', kem_name, "keyGen", d+z, pk, sk]
[f'{build_dir}/tests/vectors_kem', kem_name, "keyGen", d+z, pk, sk]
)

assert(variantFound == True)
Expand Down Expand Up @@ -66,9 +67,10 @@ def test_acvp_vec_kem_encdec_aft(kem_name):
#expected results
k = testCase["k"]
c = testCase["c"]


build_dir = helpers.get_current_build_dir_name()
helpers.run_subprocess(
['build/tests/vectors_kem', kem_name, "encDecAFT", m, pk, k, c]
[f'{build_dir}/tests/vectors_kem', kem_name, "encDecAFT", m, pk, k, c]
)

assert(variantFound == True)
Expand All @@ -94,9 +96,10 @@ def test_acvp_vec_kem_encdec_val(kem_name):
c = testCase["c"]
#expected results
k = testCase["k"]


build_dir = helpers.get_current_build_dir_name()
helpers.run_subprocess(
['build/tests/vectors_kem', kem_name, "encDecVAL", sk, k, c]
[f'{build_dir}/tests/vectors_kem', kem_name, "encDecVAL", sk, k, c]
)

assert(variantFound == True)
Expand Down

0 comments on commit a552876

Please sign in to comment.