aboutsummaryrefslogtreecommitdiffstats
path: root/tests
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
parent92b404d7e919d087dd25c972ed02ac7676666004 (diff)
Changed arrangment of directories and names of files for testing
Diffstat (limited to 'tests')
-rw-r--r--tests/dockerfiles/DebianJessie.docker52
-rw-r--r--tests/dockerfiles/Ubuntu_15_04.docker79
-rw-r--r--tests/fixtures/grgsm_decode_test1_expected51
-rwxr-xr-xtests/scripts/decode.sh32
-rwxr-xr-xtests/scripts/scanner.sh40
5 files changed, 254 insertions, 0 deletions
diff --git a/tests/dockerfiles/DebianJessie.docker b/tests/dockerfiles/DebianJessie.docker
new file mode 100644
index 0000000..538f105
--- /dev/null
+++ b/tests/dockerfiles/DebianJessie.docker
@@ -0,0 +1,52 @@
+FROM ashmastaflash/gradio37_debjessie
+
+ENV OSMOCORE_GIT=git://git.osmocom.org/libosmocore.git
+ENV OSMOCORE_TAG=0.6.3
+ENV GR_OSMOSDR_GIT=git://git.osmocom.org/gr-osmosdr
+
+# We know it's going to foul up, so we run this install separately and then ...fix... dpkg status
+#RUN apt-get update && apt-get install -y uhd-host || \
+# sed -i "s/Status: install ok half-configured/Status: install ok installed/g" /var/lib/dpkg/status
+
+RUN apt-get update && apt-get install -y \
+ git \
+ vim \
+ cmake \
+ autoconf \
+ libtool \
+ python-talloc-dev \
+ libtalloc2 \
+ libtalloc-dev \
+ libpcsclite-dev \
+ build-essential \
+ libboost-all-dev \
+ libcppunit-dev swig \
+ doxygen \
+ liblog4cpp5-dev \
+ python-scipy \
+ librtlsdr-dev \
+ librtlsdr0 \
+ rtl-sdr \
+ wget \
+ libxi-dev
+
+
+RUN /usr/bin/git clone $OSMOCORE_GIT && \
+ cd libosmocore && \
+ git checkout tags/$OSMOCORE_TAG && \
+ autoreconf -i && \
+ ./configure && \
+ make && \
+ make install && \
+ ldconfig -i
+
+COPY ./ /src/
+RUN ls /src
+
+RUN mkdir /src/build && \
+ cd /src/build && \
+ cmake .. && \
+ make && \
+ # make test && \
+ make install && \
+ ldconfig
diff --git a/tests/dockerfiles/Ubuntu_15_04.docker b/tests/dockerfiles/Ubuntu_15_04.docker
new file mode 100644
index 0000000..74304bd
--- /dev/null
+++ b/tests/dockerfiles/Ubuntu_15_04.docker
@@ -0,0 +1,79 @@
+FROM ubuntu:15.04
+MAINTAINER Ash Wilson
+
+ENV OSMOSDR_GIT="git://git.osmocom.org/libosmocore.git"
+ENV OSMOCORE_TAG=0.6.3
+
+# We know it's going to foul up, so we run this install separately and then ...fix... dpkg status
+RUN apt-get update && apt-get install -y uhd-host || \
+ sed -i "s/Status: install ok half-configured/Status: install ok installed/g" /var/lib/dpkg/status
+
+
+RUN apt-get install -y \
+ git \
+ python \
+ python-scipy \
+ cmake \
+ make \
+ autoconf \
+ automake \
+ cpp-4.9 \
+ gcc \
+ g++ \
+ libstdc++-4.9-dev \
+ libcppunit-dev \
+ swig \
+ swig2.0 \
+ doxygen \
+ liblog4cpp5 \
+ liblog4cpp5-dev \
+ build-essential \
+ libtool \
+ shtool \
+ pkg-config \
+ libpcsclite-dev \
+ gnuradio \
+ gnuradio-dev \
+ gr-osmosdr \
+ libfftw3-dev \
+ libusb-1.0-0-dev \
+ libvolk-dev \
+ libvolk0.0.0 \
+ libboost-all-dev \
+ libgnuradio-osmosdr0.1.3 \
+ libmirisdr0 \
+ libosmosdr-dev \
+ libosmosdr0 \
+ librtlsdr-dev \
+ librtlsdr0 \
+ osmo-sdr \
+ rtl-sdr \
+ wget \
+ python-talloc-dev \
+ libtalloc2 \
+ libtalloc-dev \
+ unzip
+
+# Build libosmosdr
+ RUN git clone $OSMOSDR_GIT && \
+ cd libosmocore && \
+ git checkout tags/$OSMOCORE_TAG && \
+ autoreconf -i && \
+ ./configure && \
+ make && \
+ make install && \
+ ldconfig -i
+
+COPY ./ /src/
+
+RUN mkdir /root/.gnuradio/
+RUN echo "[grc]\nlocal_blocks_path=/usr/local/share/gnuradio/grc/blocks" > \
+ /root/.gnuradio/config.conf
+
+RUN mkdir /src/build && \
+ cd /src/build && \
+ cmake .. && \
+ make && \
+ # make test && \
+ make install && \
+ ldconfig
diff --git a/tests/fixtures/grgsm_decode_test1_expected b/tests/fixtures/grgsm_decode_test1_expected
new file mode 100644
index 0000000..eb78bb9
--- /dev/null
+++ b/tests/fixtures/grgsm_decode_test1_expected
@@ -0,0 +1,51 @@
+860912 1330176: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860916 1330308: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860922 1330506: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860926 1330638: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860933 1329237: 59 06 1a 8f 6d 18 10 80 00 00 00 00 00 00 00 00 00 00 00 78 b9 00 00
+860937 1329369: 05 06 20 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860943 1329541: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860947 1329673: 25 06 21 20 05 f4 01 4f af 9a 81 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860953 1329871: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860957 1330003: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860963 1330201: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860967 1330307: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860973 1330505: 25 06 21 20 05 f4 01 5c ff 9b 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860977 1330637: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860984 1329236: 49 06 1b 2b d9 62 f2 20 01 3e c8 07 0a 15 60 09 b9 00 00 e8 1f 46 1b
+860988 1329368: 05 06 20 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860994 1329540: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+860998 1329672: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861004 1329870: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861008 1330002: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861014 1330200: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861018 1330306: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861024 1330504: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861028 1330636: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861035 1329235: 31 06 1c 62 f2 20 01 3e 60 09 b9 00 00 e8 1f 73 2b 2b 2b 2b 2b 2b 2b
+861039 1329367: 05 06 20 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861045 1329539: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861049 1329671: 25 06 21 20 05 f4 01 5c e5 e7 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861055 1329869: 25 06 21 20 05 f4 01 5c 54 02 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861059 1330001: 25 06 21 20 05 f4 01 5b 98 57 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861065 1330199: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861069 1330305: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861075 1330503: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861079 1330635: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861086 1329234: 01 06 00 c0 00 58 47 eb 4a 92 43 40 62 84 eb 2b 2b 2b 2b 2b 2b 2b 2b
+861090 1329366: 05 06 20 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861096 1329538: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861100 1329670: 25 06 21 20 05 f4 01 5c ff d1 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861106 1329868: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861110 1330000: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861116 1330198: 25 06 21 20 05 f4 01 59 e8 c2 81 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861120 1330304: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861126 1330502: 25 06 21 20 05 f4 01 59 42 cb 81 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861130 1330634: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861137 1329233: 01 06 03 60 00 00 00 00 00 04 15 50 10 00 00 00 00 0a a8 2b 2b 2b 2b
+861141 1329365: 05 06 07 20 00 46 24 40 00 03 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861147 1329537: 25 06 21 20 05 f4 01 52 80 26 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861151 1329669: 25 06 21 20 05 f4 ec 03 a9 72 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861157 1329867: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861161 1329999: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
+861167 1330197: 15 06 21 00 01 f0 8b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b 2b
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