Skip to content

Commit

Permalink
make check runs with simulator for --enable-swtpm
Browse files Browse the repository at this point in the history
  • Loading branch information
Elms committed Sep 30, 2020
1 parent d3bb89b commit e93c47c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ACLOCAL_AMFLAGS= -I m4
include src/include.am
include wolftpm/include.am
include examples/include.am
include scripts/include.am
include IDE/include.am
include certs/include.am
include tests/include.am
Expand Down
8 changes: 8 additions & 0 deletions scripts/include.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# vim:ft=automake
# included from Top Level Makefile.am
# All paths should be given relative to the root

if BUILD_SWTPM
check_SCRIPTS += scripts/swtpm_sim.test
dist_noinst_SCRIPTS += scripts/swtpm_sim.test
endif
8 changes: 4 additions & 4 deletions scripts/swtpm_sim.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
#
# Run tests against SWTPM simulator
# Setting TESTS to a list of tests to run
Expand All @@ -9,12 +9,12 @@

TOP_DIR=$(realpath $(dirname $0)/..)

function die {
die() {
echo $* >&2
exit 1
}

function build {
build() {
if [ ! -d "$SWTPM_DIR" ]; then
echo "Cloning SWTPM from $SWTPM_GIT_URL to $SWTPM_DIR";
git clone $SWTPM_GIT_URL $SWTPM_DIR || die "unable to clone $SWTPM_GIT_URL for simualtor";
Expand All @@ -36,7 +36,7 @@ if [ 0 -ne $? ]; then
fi;

# start swtpm server
$SWTPM_EXEC > /dev/null &
$SWTPM_EXEC >/dev/null &
swtpm_pid=$!
echo "Started $SWTPM_EXEC (pid:$swtpm_pid)"

Expand Down
2 changes: 2 additions & 0 deletions tests/include.am
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# All paths should be given relative to the root

if BUILD_EXAMPLES
if ! BUILD_SWTPM
check_PROGRAMS += tests/unit.test
endif
noinst_PROGRAMS += tests/unit.test
tests_unit_test_SOURCES = \
tests/unit_tests.c \
Expand Down

0 comments on commit e93c47c

Please sign in to comment.