Refactor test workflow
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user