diff options
author | Ash Wilson <ash.d.wilson@gmail.com> | 2016-04-22 19:14:59 -0700 |
---|---|---|
committer | Ash Wilson <ash.d.wilson@gmail.com> | 2016-04-22 19:14:59 -0700 |
commit | c6095d6cb2816787b7409c5f5f6f2fe3ae60ea6a (patch) | |
tree | 4b56f7d5745adefb00d489de9d57d5d77003ee0f | |
parent | 8cc68595bc228f53070fcdee08d783921a60e652 (diff) | |
parent | 04705ef91522a87b9d1ec1acc886ac90558d0d55 (diff) |
Merge branch 'revert-182-development' into development
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | .travis.yml | 12 | ||||
-rw-r--r-- | CMakeLists.txt | 11 | ||||
-rw-r--r-- | PACKAGING.md | 4 | ||||
-rw-r--r-- | TESTING.md | 15 | ||||
-rwxr-xr-x | build.sh | 21 | ||||
-rw-r--r-- | dockerfiles/DebianJessie.docker | 52 | ||||
-rw-r--r-- | installer-packages/.placeholder (renamed from Dockerfile) | 0 | ||||
-rw-r--r-- | tests/dockerfiles/Debian_Jessie.docker | 33 | ||||
-rw-r--r-- | tests/dockerfiles/Debian_testing.docker | 26 | ||||
-rw-r--r-- | tests/dockerfiles/Ubuntu_15_04.docker (renamed from dockerfiles/Ubuntu15.docker) | 2 | ||||
-rw-r--r-- | tests/dockerfiles/Ubuntu_16_04.docker | 27 | ||||
-rw-r--r-- | tests/dockerfiles/Ubuntu_16_04_debbuild.docker | 28 | ||||
-rw-r--r-- | tests/fixtures/grgsm_decode_test1_expected (renamed from build_test/control/grgsm_decode_test1_expected) | 0 | ||||
-rwxr-xr-x | tests/scripts/decode.sh (renamed from build_test/scripts/decode.sh) | 2 | ||||
-rwxr-xr-x | tests/scripts/scanner.sh | 40 |
16 files changed, 215 insertions, 60 deletions
@@ -5,4 +5,4 @@ build *.pyc *.pyo .unittests - +build/ diff --git a/.travis.yml b/.travis.yml index cbc85f5..551b982 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,10 +3,10 @@ sudo: required language: ruby env: - - DOCKERFILE=dockerfiles/DebianJessie.docker IMGNAME=debjess-grgsm - # - DOCKERFILE=dockerfiles/Ubuntu14.docker IMGNAME=ubu14-grgsm - - DOCKERFILE=dockerfiles/Ubuntu15.docker IMGNAME=ubu15-grgsm - # - DOCKERFILE=dockerfiles/Kali.docker IMGNAME=kali-grgsm + #- DOCKERFILE=tests/dockerfiles/Debian_Jessie.docker IMGNAME=debjess-grgsm + #- DOCKERFILE=tests/dockerfiles/Ubuntu_15_04.docker IMGNAME=ubu15.04-grgsm + - DOCKERFILE=tests/dockerfiles/Debian_testing.docker IMGNAME=debtest-grgsm + - DOCKERFILE=tests/dockerfiles/Ubuntu_16_04.docker IMGNAME=ubu16.04-grgsm services: - docker @@ -15,4 +15,6 @@ before_install: - cat $DOCKERFILE > Dockerfile ; docker build -t $IMGNAME . script: - - docker run -it --rm $IMGNAME /src/build_test/scripts/decode.sh + - docker run -it --rm $IMGNAME sh -c 'cd /src/build;make test' + - docker run -it --rm $IMGNAME /src/tests/scripts/decode.sh + diff --git a/CMakeLists.txt b/CMakeLists.txt index 37e8c72..00c37dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -196,3 +196,14 @@ add_subdirectory(docs) install(FILES cmake/Modules/gr-gsmConfig.cmake DESTINATION lib${LIB_SUFFIX}/cmake/grgsm ) + +######################################################################## +# Cpack stuff +######################################################################## +set(CPACK_DEBIAN_PACKAGE_DEPENDS "gnuradio (>> 3.7.9), gr-osmosdr, libosmogsm5") +set(CPACK_PACKAGE_NAME gr-gsm) +set(CPACK_PACKAGE_VERSION 0.9.0) +set(CPACK_PACKAGE_MAINTAINER ptrkrysik@gmail.com) +set(CPACK_PACKAGE_DESCRIPTION "GSM functionality for Gnuradio") +set(CPACK_PACKAGE_CONTACT ptrkrysik@gmail.com) +include(CPack) diff --git a/PACKAGING.md b/PACKAGING.md new file mode 100644 index 0000000..75914db --- /dev/null +++ b/PACKAGING.md @@ -0,0 +1,4 @@ +# Packaging gr-gsm +## This is a work in progress... + +* Run the build.sh script! diff --git a/TESTING.md b/TESTING.md new file mode 100644 index 0000000..b51e647 --- /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/tests/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/tests/fixtures/grgsm_decode_test1_expected. See the gr-gsm/tests/scripts/decode.sh file for details. + +## Integration testing + +Integration testing with use of the grgsm_scanner application: +* 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/tests/scripts +* scanner.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 script instantiates a container for testing the rtlsdr scanner on each band, against each Docker 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.sh b/build.sh new file mode 100755 index 0000000..8383aaf --- /dev/null +++ b/build.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# First, get into the right directory +THISPATH=$(dirname "$BASH_SOURCE") +cd $THISPATH + +# Now, we check to see that the version env var is set +${CPACK_PACKAGE_VERSION:?"Need to set CPACK_PACKAGE_VERSION env var!"} +export $CPACK_DEBIAN_PACKAGE_ARCHITECTURE=`dpkg --print-architecture` + +# OK, now we get down to the business of building... +rm -rf ./build +mkdir build +cd build +cmake .. +make package +cpack -G DEB +mv ./*.deb ../installer-packages +echo "If you've gotten to this point, the package has been built" +echo "and exists at "$THISPATH"/installer-packages" +echo "Don't forget to add and commit the new package, and tag the commit!" diff --git a/dockerfiles/DebianJessie.docker b/dockerfiles/DebianJessie.docker deleted file mode 100644 index 538f105..0000000 --- a/dockerfiles/DebianJessie.docker +++ /dev/null @@ -1,52 +0,0 @@ -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/Dockerfile b/installer-packages/.placeholder index e69de29..e69de29 100644 --- a/Dockerfile +++ b/installer-packages/.placeholder diff --git a/tests/dockerfiles/Debian_Jessie.docker b/tests/dockerfiles/Debian_Jessie.docker new file mode 100644 index 0000000..a359648 --- /dev/null +++ b/tests/dockerfiles/Debian_Jessie.docker @@ -0,0 +1,33 @@ +FROM debian:testing + +# 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 \ + vim \ + cmake \ + autoconf \ + libtool \ + build-essential \ + libboost-all-dev \ + libcppunit-dev swig \ + doxygen \ + liblog4cpp5-dev \ + python-scipy \ + gnuradio \ + gnuradio-dev \ + gr-osmosdr \ + libosmogsm5 + +COPY ./ /src/ +RUN ls /src + +RUN mkdir /src/build && \ + cd /src/build && \ + cmake .. && \ + make && \ + make test && \ + make install && \ + ldconfig diff --git a/tests/dockerfiles/Debian_testing.docker b/tests/dockerfiles/Debian_testing.docker new file mode 100644 index 0000000..24dde82 --- /dev/null +++ b/tests/dockerfiles/Debian_testing.docker @@ -0,0 +1,26 @@ +FROM debian:testing + +RUN apt-get update && apt-get install -y \ + uhd-host \ + cmake \ + autoconf \ + libtool \ + build-essential \ + libcppunit-dev \ + swig \ + doxygen \ + liblog4cpp5-dev \ + python-scipy \ + gnuradio-dev \ + gr-osmosdr \ + libosmocore-dev + +COPY ./ /src/ +RUN ls /src + +RUN mkdir /src/build && \ + cd /src/build && \ + cmake .. && \ + make && \ + make install && \ + ldconfig diff --git a/dockerfiles/Ubuntu15.docker b/tests/dockerfiles/Ubuntu_15_04.docker index 3184ea7..74304bd 100644 --- a/dockerfiles/Ubuntu15.docker +++ b/tests/dockerfiles/Ubuntu_15_04.docker @@ -9,7 +9,7 @@ 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 \ +RUN apt-get install -y \ git \ python \ python-scipy \ diff --git a/tests/dockerfiles/Ubuntu_16_04.docker b/tests/dockerfiles/Ubuntu_16_04.docker new file mode 100644 index 0000000..de0b215 --- /dev/null +++ b/tests/dockerfiles/Ubuntu_16_04.docker @@ -0,0 +1,27 @@ +FROM ubuntu:16.04 +MAINTAINER Ash Wilson + +RUN apt-get update && apt-get install -y \ + uhd-host \ + cmake \ + autoconf \ + libtool \ + build-essential \ + libcppunit-dev \ + swig \ + doxygen \ + liblog4cpp5-dev \ + python-scipy \ + gnuradio-dev \ + gr-osmosdr \ + libosmocore-dev + +COPY ./ /src/ +RUN ls /src + +RUN mkdir /src/build && \ + cd /src/build && \ + cmake .. && \ + make && \ + make install && \ + ldconfig diff --git a/tests/dockerfiles/Ubuntu_16_04_debbuild.docker b/tests/dockerfiles/Ubuntu_16_04_debbuild.docker new file mode 100644 index 0000000..ea34f67 --- /dev/null +++ b/tests/dockerfiles/Ubuntu_16_04_debbuild.docker @@ -0,0 +1,28 @@ +FROM ubuntu:16.04 +MAINTAINER Ash Wilson + +RUN apt-get update && apt-get install -y \ + uhd-host \ + cmake \ + autoconf \ + libtool \ + build-essential \ + libcppunit-dev \ + swig \ + doxygen \ + liblog4cpp5-dev \ + python-scipy \ + gnuradio-dev \ + gr-osmosdr \ + libosmocore-dev + +COPY ./ /src/ +RUN ls /src + +RUN mkdir /src/build && \ + cd /src/build && \ + cmake .. && \ + make package && \ + cpack -G DEB && \ + ls + diff --git a/build_test/control/grgsm_decode_test1_expected b/tests/fixtures/grgsm_decode_test1_expected index eb78bb9..eb78bb9 100644 --- a/build_test/control/grgsm_decode_test1_expected +++ b/tests/fixtures/grgsm_decode_test1_expected diff --git a/build_test/scripts/decode.sh b/tests/scripts/decode.sh index 914bc7e..014a5d3 100755 --- a/build_test/scripts/decode.sh +++ b/tests/scripts/decode.sh @@ -5,7 +5,7 @@ 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_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:" 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 |