openpgp-card/tools/cargo-test-in-docker
Lars Wirzenius dd02a29497 add integration/acceptance test with Subplot
These need to be run with the virtual smartcard emulation in the
Docker container specified in .gitlab-ci.yml for tests.

The tests are a little simplistic, as it turned out that making
changes to the smart card results in flaky tests. Thus only parts of
opgpcard that don't change the card are tested.

Sponsored-by: NLnet Foundation; NGI Assure
2022-10-24 20:30:14 +03:00

23 lines
802 B
Bash
Executable file

#!/bin/bash
#
# Run this to run opgpcard (tools directory) test suite inside a
# Docker container with a virtual smartcard running. The test suite
# contains tests that run the opgpcard binary and rely on a virtual
# smart card to be available.
#
# SPDX-FileCopyrightText: 2022 Lars Wirzenius <liw@liw.fi>
# SPDX-License-Identifier: MIT OR Apache-2.0
set -euo pipefail
docker run --rm -it \
-v root:/root \
-v cargo:/cargo \
-v $(pwd):/src \
registry.gitlab.com/openpgp-card/virtual-cards/smartpgp-builddeps sh -c '
sed -i "s/timeout=20/timeout=60/" /home/jcardsim/run-card.sh &&
/etc/init.d/pcscd start &&
su - -c "sh /home/jcardsim/run-card.sh >/dev/null" jcardsim &&
cd /src/tools &&
if ! [ -e virtual-card-available ]; then rm -f tests/opgpcard.rs; fi &&
CARGO_TARGET_DIR=/cargo/ cargo test'