Skip to content

Commit

Permalink
Merge pull request #250 from pq-code-package/ci_tests
Browse files Browse the repository at this point in the history
Add `tests func` to quickcheck CI
  • Loading branch information
hanno-becker authored Oct 17, 2024
2 parents 367e5ff + 00ac064 commit bc4d1fd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 28 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ jobs:
runs-on: ${{ matrix.target.runner }}
steps:
- uses: actions/checkout@v4
- name: quickcheck
- name: make quickcheck
run: |
OPT=0 make quickcheck >/dev/null
make clean >/dev/null
OPT=1 make quickcheck >/dev/null
- uses: ./.github/actions/setup-ubuntu
- name: tests func
run: |
./scripts/tests func
build_kat:
needs: quickcheck
strategy:
Expand Down
17 changes: 7 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildall:
$(Q)$(MAKE) mlkem
$(Q)$(MAKE) nistkat
$(Q)$(MAKE) kat
$(Q)echo " ALL GOOD!"
$(Q)echo " Everything builds fine!"

include mk/config.mk
-include mk/$(MAKECMDGOALS).mk
Expand All @@ -16,19 +16,16 @@ include mk/schemes.mk
include mk/rules.mk

quickcheck:
# Check that everything builds
$(Q)$(MAKE) mlkem
$(Q)$(MAKE) nistkat
$(Q)$(MAKE) kat
$(Q)echo " Everything builds fine!"
# Run basic functionality checks
$(MLKEM512_DIR)/bin/test_kyber512
$(MLKEM768_DIR)/bin/test_kyber768
$(MLKEM1024_DIR)/bin/test_kyber1024
$(Q)$(MAKE) nistkat
$(MLKEM512_DIR)/bin/gen_NISTKAT512
$(MLKEM768_DIR)/bin/gen_NISTKAT768
$(MLKEM1024_DIR)/bin/gen_NISTKAT1024
$(Q)$(MAKE) kat
$(MLKEM512_DIR)/bin/gen_KAT512
$(MLKEM768_DIR)/bin/gen_KAT768
$(MLKEM1024_DIR)/bin/gen_KAT1024
$(Q)echo " ALL GOOD!"
$(Q)echo " Functionality tests passed!"

mlkem: \
$(MLKEM512_DIR)/bin/test_kyber512 \
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
qemu; # 8.2.4

inherit (pkgs.python3Packages)
pyyaml
python
click;
};
Expand Down
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# SPDX-License-Identifier: Apache-2.0
click
yq==3.4.3
jq==1.8.0
pyyaml==6.0.2
19 changes: 4 additions & 15 deletions scripts/tests
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import subprocess
import logging
import click
import hashlib
import yaml
import asyncio
from functools import reduce
from enum import IntEnum
Expand Down Expand Up @@ -100,21 +101,9 @@ class SCHEME(IntEnum):


def parse_meta(scheme: SCHEME, field: str) -> str:
result = subprocess.run(
[
"yq",
"-r",
"--arg",
"scheme",
str(scheme),
f'.implementations.[] | select(.name == $scheme) | ."{field}"',
"./META.yml",
],
capture_output=True,
encoding="utf-8",
universal_newlines=False,
)
return result.stdout.strip()
with open("META.yml", "r") as f:
meta = yaml.safe_load(f)
return meta["implementations"][int(scheme) - 1][field]


def github_summary(title: str, test: TEST_TYPES, results: TypedDict):
Expand Down

0 comments on commit bc4d1fd

Please sign in to comment.