aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorVasil Velichkov <vvvelichkov@gmail.com>2018-03-27 02:37:49 +0300
committerPiotr Krysik <ptrkrysik@gmail.com>2018-03-30 22:34:52 +0200
commitbc2a23e0e7454fcba9770644055ac4d048db61e5 (patch)
treec2207171341d937738695fd2e1812a37370ab494 /tests
parent7476868d8ea79c6ba8944bb84d425afb35d5e1db (diff)
Check the gsm0503_xcch_decode return value
- Discard the message when gsm0503_xcch_decode returns -1 - Add automated decrypt test See https://groups.google.com/d/msg/gr-gsm/9nOkIdrGOck/qTZh47McCQAJ
Diffstat (limited to 'tests')
-rw-r--r--tests/fixtures/grgsm_decode_decrypt1_expected12
-rwxr-xr-xtests/scripts/decrypt.sh37
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/fixtures/grgsm_decode_decrypt1_expected b/tests/fixtures/grgsm_decode_decrypt1_expected
new file mode 100644
index 0000000..378b495
--- /dev/null
+++ b/tests/fixtures/grgsm_decode_decrypt1_expected
@@ -0,0 +1,12 @@
+862210 1331352: 03 03 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+862242 1332356: 00 01 03 03 49 06 1d 9f 6d 18 10 80 00 00 00 00 00 00 00 00 00 00 00
+862261 1331351: 01 73 35 06 27 00 03 50 18 a0 05 f4 01 5c 57 03 2b 2b 2b 2b 2b 2b 2b
+862312 1331350: 03 20 0d 06 35 11 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+862344 1332354: 00 00 03 03 2d 06 1e 2b d9 62 f2 20 01 3e 95 78 7b 2b 2b 2b 2b 2b 2b
+862363 1331349: 03 42 45 13 05 1e 02 ea 81 5c 08 11 83 94 03 98 93 92 49 81 2b 2b 2b
+862414 1331348: 01 61 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+862446 1332352: 00 00 03 03 49 06 1d 9f 6d 18 10 80 00 00 00 00 00 00 00 00 00 00 00
+862465 1331347: 01 81 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+862516 1331346: 03 84 21 06 2e 0d 02 d5 00 63 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+862548 1332376: 00 00 03 03 49 06 06 70 00 00 00 00 00 04 15 50 10 00 00 00 00 0a a8
+862567 1331345: 03 03 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
diff --git a/tests/scripts/decrypt.sh b/tests/scripts/decrypt.sh
new file mode 100755
index 0000000..afd12cc
--- /dev/null
+++ b/tests/scripts/decrypt.sh
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+TEST_DIR=`dirname "$0"`
+
+# PYTHONPATH and LD_LIBRARY_PATH are needed on Fedora 26
+export PYTHONPATH=/usr/local/lib64/python2.7/site-packages/:/usr/local/lib64/python2.7/site-packages/grgsm/:$PYTHONPATH
+export LD_LIBRARY_PATH=/usr/local/lib64/:$LD_LIBRARY_PATH
+
+export AP_DECODE="grgsm_decode"
+export CAPFILE="../../test_data/vf_call6_a725_d174_g5_Kc1EF00BAB3BAC7002.cfile"
+export SHORTENED_CAPFILE="tmp.cfile"
+export RESULT_EXPECTED="../fixtures/grgsm_decode_decrypt1_expected"
+export RESULT_OBTAINED="grgsm_decode_test1_result"
+export RUNLINE="$AP_DECODE -c $SHORTENED_CAPFILE -s $((100000000/174)) -m SDCCH8 -t 1 -k 0x1E,0xF0,0x0B,0xAB,0x3B,0xAC,0x70,0x02 -v --ppm -10"
+echo "Testing with:"
+echo " $RUNLINE"
+gnuradio-companion --version
+
+cd $TEST_DIR
+cat $CAPFILE | head -c -37000000 | head -c 35800000 > $SHORTENED_CAPFILE
+
+$RUNLINE | grep -A 999999 "862210 1331352: 03 03 01 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b" | tee $RESULT_OBTAINED
+diff -u $RESULT_EXPECTED $RESULT_OBTAINED
+TEST_RESULT=$?
+
+rm $RESULT_OBTAINED
+rm $SHORTENED_CAPFILE
+
+if [ $TEST_RESULT == 0 ]
+then
+ echo " Result: PASSED"
+ exit 0
+else
+ echo " Result: FAILED"
+ exit 1
+fi
+