laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/33963 )
Change subject: tests: add test script for pySim-trace ......................................................................
tests: add test script for pySim-trace
pySim-trace has no test coverage yet. Let's use a script to run a GSAMTAP pcacp through it and check that no exceptions are raised.
Related: OS#6094 Change-Id: Icfabfa7c59968021eef0399991bd05b92467d8d2 --- M contrib/jenkins.sh A pysim-testdata/pySim-trace_test_gsmtap.pcapng A tests/pySim-trace_test.sh 3 files changed, 35 insertions(+), 0 deletions(-)
Approvals: laforge: Looks good to me, approved Jenkins Builder: Verified
diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh index 0309877..3e02546 100755 --- a/contrib/jenkins.sh +++ b/contrib/jenkins.sh @@ -22,6 +22,7 @@ . venv/bin/activate
pip install -r requirements.txt + pip install pyshark
# Execute automatically discovered unit tests first python -m unittest discover -v -s tests/ @@ -29,6 +30,7 @@ # Run the test with physical cards cd pysim-testdata ../tests/pysim-test.sh + ../tests/pySim-trace_test.sh ;; "pylint") # Print pylint version diff --git a/pysim-testdata/pySim-trace_test_gsmtap.pcapng b/pysim-testdata/pySim-trace_test_gsmtap.pcapng new file mode 100644 index 0000000..35c3003 --- /dev/null +++ b/pysim-testdata/pySim-trace_test_gsmtap.pcapng Binary files differ diff --git a/tests/pySim-trace_test.sh b/tests/pySim-trace_test.sh new file mode 100755 index 0000000..0ec5e0f --- /dev/null +++ b/tests/pySim-trace_test.sh @@ -0,0 +1,20 @@ +#/bin/bash + +PYSIM_TRACE=../pySim-trace.py +GSMTAP_TRACE=pySim-trace_test_gsmtap.pcapng + +echo "pySim-trace_test - a test program to test pySim-trace.py" +echo "========================================================" + +$PYSIM_TRACE gsmtap-pyshark-pcap -f $GSMTAP_TRACE +if [ $? -ne 0 ]; then + echo "" + echo "========================================================" + echo "Testrun with $GSMTAP_TRACE failed." + exit 1 +fi + +echo "" +echo "========================================================" +echo "trace parsed without problems -- everything ok!" +