Change in pysim[master]: Fix automated tests

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Dec 17 13:46:58 UTC 2019


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/16564 )

Change subject: Fix automated tests
......................................................................

Fix automated tests

- The .ok files currently dictate in which pysical reader device the
card must be placed. Lets remove this dependncy to make the setup more
reliable. Testing in which reade a card is placed is not in the scope of
our tests.

- Fix bug in pysim-test.sh (test runner), so that the veriable $ADM_HEX
gets reset after the execution of the tests.

Change-Id: I12e6b46787efb39c5745f4e7f3cdcca9209881b8
---
M pysim-testdata/Fairwaves-SIM.ok
M pysim-testdata/Wavemobile-SIM.ok
M pysim-testdata/fakemagicsim.ok
M pysim-testdata/sysmoUSIM-SJS1.ok
M pysim-testdata/sysmosim-gr1.ok
M tests/pysim-test.sh
6 files changed, 11 insertions(+), 6 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/pysim-testdata/Fairwaves-SIM.ok b/pysim-testdata/Fairwaves-SIM.ok
index 7f60765..6150469 100644
--- a/pysim-testdata/Fairwaves-SIM.ok
+++ b/pysim-testdata/Fairwaves-SIM.ok
@@ -1,4 +1,4 @@
-Using PC/SC reader (dev=4) interface
+Using PC/SC reader (dev=0) interface
 Reading ...
 ICCID: 8988219000000117833
 IMSI: 001010000000111
diff --git a/pysim-testdata/Wavemobile-SIM.ok b/pysim-testdata/Wavemobile-SIM.ok
index 5f5b360..b0ea8be 100644
--- a/pysim-testdata/Wavemobile-SIM.ok
+++ b/pysim-testdata/Wavemobile-SIM.ok
@@ -1,4 +1,4 @@
-Using PC/SC reader (dev=3) interface
+Using PC/SC reader (dev=4) interface
 Reading ...
 ICCID: 89445310150011013678
 IMSI: 001010000000102
diff --git a/pysim-testdata/fakemagicsim.ok b/pysim-testdata/fakemagicsim.ok
index a1d9e9c..d9bff94 100644
--- a/pysim-testdata/fakemagicsim.ok
+++ b/pysim-testdata/fakemagicsim.ok
@@ -1,4 +1,4 @@
-Using PC/SC reader (dev=1) interface
+Using PC/SC reader (dev=2) interface
 Reading ...
 ICCID: 1122334455667788990
 IMSI: 001010000000102
diff --git a/pysim-testdata/sysmoUSIM-SJS1.ok b/pysim-testdata/sysmoUSIM-SJS1.ok
index 3bbdc90..b6a5391 100644
--- a/pysim-testdata/sysmoUSIM-SJS1.ok
+++ b/pysim-testdata/sysmoUSIM-SJS1.ok
@@ -1,4 +1,4 @@
-Using PC/SC reader (dev=0) interface
+Using PC/SC reader (dev=1) interface
 Reading ...
 ICCID: 1122334455667788990
 IMSI: 001010000000102
diff --git a/pysim-testdata/sysmosim-gr1.ok b/pysim-testdata/sysmosim-gr1.ok
index a1a49fd..d4c3dd9 100644
--- a/pysim-testdata/sysmosim-gr1.ok
+++ b/pysim-testdata/sysmosim-gr1.ok
@@ -1,4 +1,4 @@
-Using PC/SC reader (dev=2) interface
+Using PC/SC reader (dev=3) interface
 Reading ...
 ICCID: 1122334455667788990
 IMSI: 001010000000102
diff --git a/tests/pysim-test.sh b/tests/pysim-test.sh
index f97722d..c3e1747 100755
--- a/tests/pysim-test.sh
+++ b/tests/pysim-test.sh
@@ -78,7 +78,11 @@
     stat ./$CARD_NAME.ok > /dev/null
     python $PYSIM_READ -p $TERMINAL > $TEMPFILE
     set +e
-    CARD_DIFF=$(diff $TEMPFILE ./$CARD_NAME.ok)
+    # Note: We ignore the first line of output in the diff because here
+    # pysim would print the device number of the reader and we do not
+    # want the test to fail just because the card is put into a different
+    # reader device.
+    CARD_DIFF=$(diff + 1 $TEMPFILE ./$CARD_NAME.ok)
     set -e
 
     if [ "$CARD_DIFF" != "" ]; then
@@ -156,6 +160,7 @@
 	OPC=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
 	IMSI=001010000000001
 	ADM=00000000
+	ADM_HEX=""
 	ADM_OPT="-a"
 
 	source "$CARD_NAME.data"

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/16564
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I12e6b46787efb39c5745f4e7f3cdcca9209881b8
Gerrit-Change-Number: 16564
Gerrit-PatchSet: 12
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191217/f50f4d59/attachment.htm>


More information about the gerrit-log mailing list