aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAsh Wilson <ash.d.wilson@gmail.com>2016-02-25 23:07:50 -0600
committerAsh Wilson <ash.d.wilson@gmail.com>2016-04-10 22:58:35 -0700
commit6791f4db393bc65d116d8893b5e8dc3c1b93d9e2 (patch)
tree50db44c4b109d81329a84183fc15b98d671d1c41
parent8cc68595bc228f53070fcdee08d783921a60e652 (diff)
re-structuring testing stuff, adding testing docs and integration tests.
-rw-r--r--TESTING.md15
-rw-r--r--test/fixtures/grgsm_decode_test1_expected (renamed from build_test/control/grgsm_decode_test1_expected)0
-rwxr-xr-xtest/tests/decode.sh (renamed from build_test/scripts/decode.sh)14
-rw-r--r--test/tests/integration.sh40
4 files changed, 59 insertions, 10 deletions
diff --git a/TESTING.md b/TESTING.md
new file mode 100644
index 0000000..0ff928f
--- /dev/null
+++ b/TESTING.md
@@ -0,0 +1,15 @@
+# Testing gr-gsm
+
+## CI Testing
+
+CI testing currently consists of attempting to build gr-gsm as described in the .docker files located under gr-gsm/dockerfiles using travis-ci.org. If the build is successful, travis-ci will attempt to decode the test file located under gr-gsm/test_data and compare the results to this file: gr-gsm/test/fixtures/grgsm_decode_test1_expected. See the gr-gsm/test/tests/decode.sh file for details.
+
+## Integration testing
+Integration testing:
+
+* Make sure that your RTL SDR dongle is plugged into the system and if you're running on Mac, you need to have the dongle accessible to the VirtualBox VM that's running Docker.
+* cd gr-gsm/test/tests
+* . .integration.sh
+
+This will copy the entire contents of the currently checked out branch of gr-gsm to a temp folder, and attempt to build the docker images according to the definitions in the .docker files located under gr-gsm/dockerfiles.
+Once the images are created, the scripts instantiates a container to test each band listed on each against each image built. This can take quite a while. If you're running on Mac, consider using the ```caffeinate``` command to keep your machine from sleeping.
diff --git a/build_test/control/grgsm_decode_test1_expected b/test/fixtures/grgsm_decode_test1_expected
index eb78bb9..eb78bb9 100644
--- a/build_test/control/grgsm_decode_test1_expected
+++ b/test/fixtures/grgsm_decode_test1_expected
diff --git a/build_test/scripts/decode.sh b/test/tests/decode.sh
index 914bc7e..d596b7a 100755
--- a/build_test/scripts/decode.sh
+++ b/test/tests/decode.sh
@@ -1,27 +1,21 @@
#!/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="../control/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 "
+export CAPFILE="vf_call6_a725_d174_g5_Kc1EF00BAB3BAC7002.cfile"
+export TEST_DATA_DIRECTORY="/src/test_data/"
+export TEST_FIXTURES_DIRECTORY="/src/test/fixtures"
+export RUNLINE="$AP_DECODE -c $CAPFILE -s $((100000000/174)) -a 725 -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"
diff --git a/test/tests/integration.sh b/test/tests/integration.sh
new file mode 100644
index 0000000..c444e31
--- /dev/null
+++ b/test/tests/integration.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+# This script runs integration tests for gnuradio.
+# 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/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/airprobe_rtlsdr_scanner.py -b `echo $BAND` -v"
+ for IMG in ${TEST_IMAGE_NAMES[*]}
+ do
+ echo "Now we test: $SCAN_COMMAND on $IMG"
+ docker run -it --rm $IMG `echo $SCAN_COMMAND`
+ done
+done
+
+cd $GR_SRC_DIR/build_test/scripts && rm -rf $TEMP_DIR