mirror of
https://github.com/polhenarejos/pico-hsm.git
synced 2026-01-17 09:28:05 +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:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
suite: ["pkcs11", "pytest"]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository and submodules
|
- name: Checkout repository and submodules
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
@ -59,24 +62,5 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
cd artifacts
|
cd artifacts
|
||||||
docker load -q -i docker-image.tar
|
docker load -q -i docker-image.tar
|
||||||
- name: Test PCSC (pytest)
|
- name: Test ${{ matrix.suite }}
|
||||||
run: ./tests/run-test-in-docker.sh
|
run: ./tests/run-test-in-docker.sh ${{ matrix.suite }}
|
||||||
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
|
|
||||||
|
|
|
||||||
|
|
@ -28,11 +28,13 @@ RUN pip3 install pytest pycvc cryptography pyscard base58
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
RUN git clone https://github.com/OpenSC/OpenSC
|
RUN git clone https://github.com/OpenSC/OpenSC
|
||||||
WORKDIR /OpenSC
|
WORKDIR /OpenSC
|
||||||
RUN git checkout tags/0.22.0
|
RUN git checkout tags/0.23.0
|
||||||
RUN ./bootstrap
|
RUN ./bootstrap
|
||||||
RUN ./configure --enable-openssl
|
RUN ./configure --enable-openssl
|
||||||
RUN make -j `nproc`
|
RUN make -j `nproc`
|
||||||
RUN make install
|
RUN make install
|
||||||
RUN make clean
|
RUN make clean
|
||||||
RUN ldconfig
|
RUN ldconfig
|
||||||
|
RUN git clone https://github.com/polhenarejos/pypicohsm.git
|
||||||
|
RUN pip3 install -e pypicohsm
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,14 @@
|
||||||
#!/bin/bash -eu
|
#!/bin/bash -eu
|
||||||
|
|
||||||
source tests/docker_env.sh
|
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
|
#!/bin/bash
|
||||||
|
|
||||||
rm -rf pypicohsm
|
source ./tests/startup.sh
|
||||||
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 &
|
|
||||||
|
|
||||||
chmod a+x tests/scripts/*.sh
|
chmod a+x tests/scripts/*.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
rm -rf pypicohsm
|
source ./tests/startup.sh
|
||||||
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 &
|
|
||||||
pytest tests -W ignore::DeprecationWarning
|
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