mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-17 01:18:06 +00:00
Refactor test workflow
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
2f177eb8df
commit
11a3472941
6 changed files with 41 additions and 39 deletions
26
.github/workflows/test.yml
vendored
26
.github/workflows/test.yml
vendored
|
|
@ -45,6 +45,9 @@ jobs:
|
|||
test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
strategy:
|
||||
matrix:
|
||||
suite: ["pkcs11", "pytest"]
|
||||
steps:
|
||||
- name: Checkout repository and submodules
|
||||
uses: actions/checkout@v3
|
||||
|
|
@ -59,24 +62,5 @@ jobs:
|
|||
run: |
|
||||
cd artifacts
|
||||
docker load -q -i docker-image.tar
|
||||
- name: Test PCSC (pytest)
|
||||
run: ./tests/run-test-in-docker.sh
|
||||
test_pkcs11:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Checkout repository and submodules
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Retrieve saved image
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: docker-artifact
|
||||
path: artifacts
|
||||
- name: Load image
|
||||
run: |
|
||||
cd artifacts
|
||||
docker load -q -i docker-image.tar
|
||||
- name: Test PKCS11
|
||||
run: ./tests/run-test-pkcs11-in-docker.sh
|
||||
- name: Test ${{ matrix.suite }}
|
||||
run: ./tests/run-test-in-docker.sh ${{ matrix.suite }}
|
||||
|
|
|
|||
|
|
@ -28,11 +28,13 @@ RUN pip3 install pytest pycvc cryptography pyscard base58
|
|||
WORKDIR /
|
||||
RUN git clone https://github.com/OpenSC/OpenSC
|
||||
WORKDIR /OpenSC
|
||||
RUN git checkout tags/0.22.0
|
||||
RUN git checkout tags/0.23.0
|
||||
RUN ./bootstrap
|
||||
RUN ./configure --enable-openssl
|
||||
RUN make -j `nproc`
|
||||
RUN make install
|
||||
RUN make clean
|
||||
RUN ldconfig
|
||||
RUN git clone https://github.com/polhenarejos/pypicohsm.git
|
||||
RUN pip3 install -e pypicohsm
|
||||
WORKDIR /
|
||||
|
|
|
|||
|
|
@ -1,5 +1,14 @@
|
|||
#!/bin/bash -eu
|
||||
|
||||
source tests/docker_env.sh
|
||||
run_in_docker ./tests/start-up-and-test.sh
|
||||
|
||||
if [[ "$#" -gt 1 ]]; then
|
||||
if [[ $1 == "pkcs11" ]]; then
|
||||
run_in_docker ./tests/start-up-and-test-pkcs11.sh
|
||||
elif [[ $1 == "pytest" ]]; then
|
||||
run_in_docker ./tests/start-up-and-test.sh
|
||||
fi
|
||||
else
|
||||
run_in_docker ./tests/start-up-and-test.sh
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -1,13 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -rf pypicohsm
|
||||
git clone https://github.com/polhenarejos/pypicohsm.git
|
||||
pip3 install -e pypicohsm
|
||||
/usr/sbin/pcscd &
|
||||
sleep 2
|
||||
rm -f memory.flash
|
||||
tar -xf tests/memory.tar.gz
|
||||
./build_in_docker/pico_hsm > /dev/null 2>&1 &
|
||||
source ./tests/startup.sh
|
||||
|
||||
chmod a+x tests/scripts/*.sh
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm -rf pypicohsm
|
||||
git clone https://github.com/polhenarejos/pypicohsm.git
|
||||
pip3 install -e pypicohsm
|
||||
/usr/sbin/pcscd &
|
||||
sleep 2
|
||||
rm -f memory.flash
|
||||
tar -xf tests/memory.tar.gz
|
||||
./build_in_docker/pico_hsm > /dev/null 2>&1 &
|
||||
source ./tests/startup.sh
|
||||
|
||||
pytest tests -W ignore::DeprecationWarning
|
||||
|
|
|
|||
20
tests/startup.sh
Normal file
20
tests/startup.sh
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/bash
|
||||
|
||||
OK="\033[32mok\033[0m"
|
||||
FAIL="\033[31mfail\033[0m"
|
||||
|
||||
echo -n "Start PCSC... "
|
||||
/usr/sbin/pcscd &
|
||||
test $? -eq 0 && echo -e "${OK}" || {
|
||||
echo -e "${FAIL}"
|
||||
exit 1
|
||||
}
|
||||
sleep 2
|
||||
rm -f memory.flash
|
||||
tar -xf tests/memory.tar.gz
|
||||
echo -n "Start Pico HSM... "
|
||||
./build_in_docker/pico_hsm > /dev/null 2>&1 &
|
||||
test $? -eq 0 && echo -e "${OK}" || {
|
||||
echo -e "${FAIL}"
|
||||
exit 1
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue