diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 27f3b1d..9b81817 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,7 @@ jobs: needs: build strategy: matrix: - suite: ["pkcs11", "pytest"] + suite: ["pkcs11", "pytest", "sc-hsm-pkcs11"] steps: - name: Checkout repository and submodules uses: actions/checkout@v3 diff --git a/tests/run-test-in-docker.sh b/tests/run-test-in-docker.sh index de7018a..367ecf1 100755 --- a/tests/run-test-in-docker.sh +++ b/tests/run-test-in-docker.sh @@ -4,6 +4,8 @@ source tests/docker_env.sh if [[ $1 == "pkcs11" ]]; then run_in_docker ./tests/start-up-and-test-pkcs11.sh +elif [[ $1 == "sc-hsm-pkcs11" ]]; then + run_in_docker ./tests/scripts/sc_hsm_test.sh else run_in_docker ./tests/start-up-and-test.sh fi diff --git a/tests/scripts/sc_hsm_test.sh b/tests/scripts/sc_hsm_test.sh new file mode 100755 index 0000000..0885439 --- /dev/null +++ b/tests/scripts/sc_hsm_test.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +source ./tests/startup.sh + +echo "==== Test SC HSM ====" +echo -n " Running sc-hsm-pkcs11-test..." +pkcs11-tool -l --pin 648219 --keypairgen --key-type ec:secp256r1 --id 1 --label "TestLabel" > /dev/null 2>&1 +test $? -eq 0 && echo -n "." || { + echo -e "\t${FAIL}" + exit 1 +} +e=$(/usr/local/bin/sc-hsm-pkcs11-test --module /usr/local/lib/libsc-hsm-pkcs11.so --pin 648219 --invasive 2>&1) +test $? -eq 0 && echo -n "." || { + echo -e "\t${FAIL}" + exit 1 +} +grep -q "338 tests performed" <<< $e && echo -n "." || { + echo -e "\t${FAIL}" + exit 1 +} +grep -q "0 tests failed" <<< $e && echo -e ".\t${OK}" || { + echo -e "\t${FAIL}" + exit 1 +} \ No newline at end of file