aboutsummaryrefslogtreecommitdiffstats
path: root/tests/scripts
diff options
context:
space:
mode:
authorPiotr Krysik <ptrkrysik@gmail.com>2016-04-11 22:20:35 +0200
committerPiotr Krysik <ptrkrysik@gmail.com>2016-04-11 22:20:35 +0200
commit533f58ad8327f967267e5b23d24dc316218681f1 (patch)
treede3faa817b5cc66a494465851b55b7524d07d6ff /tests/scripts
parent92b404d7e919d087dd25c972ed02ac7676666004 (diff)
Changed arrangment of directories and names of files for testing
Diffstat (limited to 'tests/scripts')
-rwxr-xr-xtests/scripts/decode.sh32
-rwxr-xr-xtests/scripts/scanner.sh40
2 files changed, 72 insertions, 0 deletions
diff --git a/tests/scripts/decode.sh b/tests/scripts/decode.sh
new file mode 100755
index 0000000..014a5d3
--- /dev/null
+++ b/tests/scripts/decode.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+TEST_DIR=`dirname "$0"`
+
+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_test1_expected"
+export RESULT_OBTAINED="grgsm_decode_test1_result"
+export RUNLINE="$AP_DECODE -c $SHORTENED_CAPFILE -s $((100000000/174)) -m BCCH -t 0 -v "
+echo "Testing with:"
+echo " $RUNLINE"
+gnuradio-companion --version
+
+cd $TEST_DIR
+cat $CAPFILE | head -c 6000000 > $SHORTENED_CAPFILE
+
+$RUNLINE | tail -n +4 | tee $RESULT_OBTAINED
+diff $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
diff --git a/tests/scripts/scanner.sh b/tests/scripts/scanner.sh
new file mode 100755
index 0000000..4b1bfdd
--- /dev/null
+++ b/tests/scripts/scanner.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# This script runs integration tests for grgsm_scanner.
+# Run it fron the enclosing directory.
+export TEST_IMAGE_NAMES=()
+export TEST_SCAN_BANDS=(P-GSM DCS1800 PCS1900 E-GSM R-GSM GSM450 GSM480 GSM850)
+export TEMP_DIR=`mktemp -d`
+cd ../../
+export GR_SRC_DIR=`echo $PWD`
+
+echo "Using source dir: $GR_SRC_DIR"
+echo "Using destination dir: $TEMP_DIR"
+cp -R $GR_SRC_DIR $TEMP_DIR
+
+cd $TEMP_DIR/gr-gsm
+
+export DOCKERFILE_LIST=($TEMP_DIR/gr-gsm/tests/dockerfiles/*.docker)
+
+for DOCKERFILE in ${DOCKERFILE_LIST[*]}
+do
+ cat $DOCKERFILE > Dockerfile
+ export IMAGE_BASE=`echo $DOCKERFILE | \
+ sed -e "s|$TEMP_DIR/gr-gsm/dockerfiles/||g" | \
+ sed -e 's/\.docker//g'`
+ export IMAGE_NAME=`echo $IMAGE_BASE | tr '[:upper:]' '[:lower:]'`
+ echo "Attempt to build $IMAGE_NAME"
+ docker build -t $IMAGE_NAME ./ && TEST_IMAGE_NAMES+=($IMAGE_NAME)
+done
+
+
+for BAND in ${TEST_SCAN_BANDS[*]}
+do
+ export SCAN_COMMAND="/usr/bin/python /usr/local/bin/grgsm_scanner -b `echo $BAND` -v"
+ for IMG in ${TEST_IMAGE_NAMES[*]}
+ do
+ echo "Now we test: $SCAN_COMMAND on $IMG"
+ docker run -it --rm --privileged $IMG `echo $SCAN_COMMAND`
+ done
+done
+
+cd $GR_SRC_DIR/build_test/scripts && rm -rf $TEMP_DIR