From 75342b86d1999ea9fcb2c060c646663ee3cde07f Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 8 Aug 2018 12:03:15 +0200 Subject: [PATCH] tests/run-tests: Prepare test card before executing the tests All tests need a physical card to be inserted in a reader. This card may have a different IMSI and/or ICCID id set than the one that is expected by the tests. Since sysmo-usim-tool.sjs1.py unconditionally displays IMSI and ICCID we find those parameters in every .out file. In order to run the unit-tests without changing the .out files very often or having to manually prepare a test card we should write the expected IMSI and ICCID before each testsuite is executed. - Add a script to the testsuite that prepares the testcard, run this script from run-tests before the actual tests are executed. Change-Id: I470f4f7d5facab277b6e78252bac7cc4d1fbc6bb Related: OS#3376 --- tests/prepare | 9 +++++++++ tests/run-tests | 3 +++ 2 files changed, 12 insertions(+) create mode 100755 tests/prepare diff --git a/tests/prepare b/tests/prepare new file mode 100755 index 0000000..763d648 --- /dev/null +++ b/tests/prepare @@ -0,0 +1,9 @@ +#!/bin/sh + +. ./test-data + +echo "================ PREPARING TEST CARD ================" +$TOOL -a $ADMPIN -I $ICCID +$TOOL -a $ADMPIN -J $IMSI +echo "================ TEST CARD PREPARED =================" +echo "" diff --git a/tests/run-tests b/tests/run-tests index 5c1544f..1078b87 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -11,6 +11,9 @@ fi TMP=`tempfile` NUM_FAIL=0 +# prepare test card +./prepare + for T in $TESTS; do echo "==> Executing Testcase $T" EXPOUT=${T%%.sh}.out