diff --git a/pySim/transport/calypso.py b/pySim/transport/calypso.py index ea97b696..98330a97 100644 --- a/pySim/transport/calypso.py +++ b/pySim/transport/calypso.py @@ -79,8 +79,10 @@ class CalypsoSimLink(LinkBase): def __init__(self, sock_path: str = "/tmp/osmocom_l2", **kwargs): super().__init__(**kwargs) - print("Using Calypso-based (OsmocomBB) reader interface") - + if os.environ.get('PYSIM_INTEGRATION_TEST') == "1": + print("Using Calypso-based (OsmocomBB) reader interface") + else: + print("Using Calypso-based (OsmocomBB) reader at socket %s" % sock_path) # Make sure that a given socket path exists if not os.path.exists(sock_path): raise ReaderError( diff --git a/pySim/transport/modem_atcmd.py b/pySim/transport/modem_atcmd.py index fee09c8d..71f76e20 100644 --- a/pySim/transport/modem_atcmd.py +++ b/pySim/transport/modem_atcmd.py @@ -21,6 +21,7 @@ import serial import time import re import argparse +import os from typing import Optional from pySim.utils import Hexstr, ResTuple @@ -36,7 +37,10 @@ class ModemATCommandLink(LinkBase): def __init__(self, device: str = '/dev/ttyUSB0', baudrate: int = 115200, **kwargs): super().__init__(**kwargs) - print("Using modem for Generic SIM Access (3GPP TS 27.007)") + if os.environ.get('PYSIM_INTEGRATION_TEST') == "1": + print("Using modem for Generic SIM Access (3GPP TS 27.007)") + else: + print("Using modem for Generic SIM Access (3GPP TS 27.007) at port %s" % device) self._sl = serial.Serial(device, baudrate, timeout=5) self._echo = False # this will be auto-detected by _check_echo() self._device = device diff --git a/pySim/transport/pcsc.py b/pySim/transport/pcsc.py index fbe7c0fc..762908c6 100644 --- a/pySim/transport/pcsc.py +++ b/pySim/transport/pcsc.py @@ -18,6 +18,7 @@ # import argparse +import os from typing import Optional from smartcard.CardConnection import CardConnection @@ -35,7 +36,10 @@ class PcscSimLink(LinkBase): def __init__(self, reader_number: int = 0, **kwargs): super().__init__(**kwargs) - print("Using PC/SC reader interface") + if os.environ.get('PYSIM_INTEGRATION_TEST') == "1": + print("Using PC/SC reader interface") + else: + print("Using PC/SC reader number %u" % reader_number) r = readers() if reader_number >= len(r): raise ReaderError('No reader found for number %d' % reader_number) diff --git a/pySim/transport/serial.py b/pySim/transport/serial.py index 867317cf..ad800ede 100644 --- a/pySim/transport/serial.py +++ b/pySim/transport/serial.py @@ -18,7 +18,7 @@ import serial import time -import os.path +import os import argparse from typing import Optional @@ -33,7 +33,10 @@ class SerialSimLink(LinkBase): def __init__(self, device: str = '/dev/ttyUSB0', baudrate: int = 9600, rst: str = '-rts', debug: bool = False, **kwargs): super().__init__(**kwargs) - print("Using serial reader interface") + if os.environ.get('PYSIM_INTEGRATION_TEST') == "1": + print("Using serial reader interface") + else: + print("Using serial reader interface at port %s" % device) if not os.path.exists(device): raise ValueError("device file %s does not exist -- abort" % device) self._sl = serial.Serial( diff --git a/tests/pySim-prog_test.sh b/tests/pySim-prog_test.sh index f5186188..28d97777 100755 --- a/tests/pySim-prog_test.sh +++ b/tests/pySim-prog_test.sh @@ -25,6 +25,7 @@ PYSIM_READ=../pySim-read.py TEMPFILE=temp.tmp PYTHON=python3 +export PYSIM_INTEGRATION_TEST=1 set -e echo "pySim-prog_test - a test program to test pySim-prog.py" diff --git a/tests/pySim-trace_test.sh b/tests/pySim-trace_test.sh index 4ccb2aa8..f7b97e8b 100755 --- a/tests/pySim-trace_test.sh +++ b/tests/pySim-trace_test.sh @@ -24,6 +24,8 @@ PYSIM_TRACE=../pySim-trace.py GSMTAP_TRACE=pySim-trace_test_gsmtap.pcapng TEMPFILE=temp.tmp +export PYSIM_INTEGRATION_TEST=1 + echo "pySim-trace_test - a test program to test pySim-trace.py" echo "========================================================"