From feb0f15f3ec8fc2bab5995a5e07a2a378919cb38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 26 Jun 2017 11:09:17 +0200 Subject: [PATCH 1/8] Test build using Travis-CI --- .travis-ci-build | 33 +++++++++++++++++++++++++++++++++ .travis.yml | 18 ++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100755 .travis-ci-build create mode 100644 .travis.yml diff --git a/.travis-ci-build b/.travis-ci-build new file mode 100755 index 0000000..bea5bc2 --- /dev/null +++ b/.travis-ci-build @@ -0,0 +1,33 @@ +#!/bin/sh + +build_install() +{ + ( + cd $1 + if [ "$BLD" = autotools ]; then + set -x + autoreconf -vis + mkdir build-autotools + cd build-autotools + ../configure --prefix=$HOME/.local + make + make install + set +x + elif [ "$BLD" = cmake ]; then + set -x + mkdir build-cmake + cd build-cmake + cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local .. + make + make install + set +x + else + echo "Unsupported build system: '$BLD'" >&2 + exit 1 + fi + ) +} + +git clone https://github.com/nfc-tools/libnfc +build_install libnfc +build_install . diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1a0b58e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,18 @@ +language: c + +compiler: + - clang + - gcc + +env: + - BLD=cmake + - BLD=autoconf + +addons: + apt: + packages: + - libusb-dev + - cmake + - libcutter-dev + +script: ./.travis-ci-build From a884eb3dca53d298733b35ecd55e45556c0982b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 26 Jun 2017 11:15:12 +0200 Subject: [PATCH 2/8] Fix Travis-CI build While here, refactor a bit so that a failing libnfc build does not indicate a failure of the libfreefare build. --- .travis-ci-build | 51 +++++++++++++++++++----------------------------- .travis.yml | 7 +++++-- 2 files changed, 25 insertions(+), 33 deletions(-) diff --git a/.travis-ci-build b/.travis-ci-build index bea5bc2..5df4bf9 100755 --- a/.travis-ci-build +++ b/.travis-ci-build @@ -1,33 +1,22 @@ #!/bin/sh +cd $1 -build_install() -{ - ( - cd $1 - if [ "$BLD" = autotools ]; then - set -x - autoreconf -vis - mkdir build-autotools - cd build-autotools - ../configure --prefix=$HOME/.local - make - make install - set +x - elif [ "$BLD" = cmake ]; then - set -x - mkdir build-cmake - cd build-cmake - cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local .. - make - make install - set +x - else - echo "Unsupported build system: '$BLD'" >&2 - exit 1 - fi - ) -} - -git clone https://github.com/nfc-tools/libnfc -build_install libnfc -build_install . +if [ "$BLD" = autotools ]; then + set -x + autoreconf -vis + mkdir build-autotools + cd build-autotools + ../configure --prefix=$HOME/.local + make + make install +elif [ "$BLD" = cmake ]; then + set -x + mkdir build-cmake + cd build-cmake + cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local .. + make + make install +else + echo "Unsupported build system: '$BLD'" >&2 + exit 1 +fi diff --git a/.travis.yml b/.travis.yml index 1a0b58e..da8e4c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ compiler: env: - BLD=cmake - - BLD=autoconf + - BLD=autotools addons: apt: @@ -15,4 +15,7 @@ addons: - cmake - libcutter-dev -script: ./.travis-ci-build +install: + - git clone https://github.com/nfc-tools/libnfc + - ./.travis-ci-build libnfc +script: ./.travis-ci-build . From d0f78c488060974a48d99a582f8ba4edf4b34053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 26 Jun 2017 11:21:28 +0200 Subject: [PATCH 3/8] Fix autotools build CMake seems to find the libnfc includes and libraries, but not the autotools. Pass them to ./configure. --- .travis-ci-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis-ci-build b/.travis-ci-build index 5df4bf9..4fec82f 100755 --- a/.travis-ci-build +++ b/.travis-ci-build @@ -6,7 +6,7 @@ if [ "$BLD" = autotools ]; then autoreconf -vis mkdir build-autotools cd build-autotools - ../configure --prefix=$HOME/.local + ../configure --prefix=$HOME/.local CFLAGS="-I$HOME/.local/include" LDFLAGS="-L$HOME/.local/lib" make make install elif [ "$BLD" = cmake ]; then From 6ef62014d1036720776f1fcb8915a9d2690d7cac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 26 Jun 2017 11:25:37 +0200 Subject: [PATCH 4/8] Imediatly stop on failure --- .travis-ci-build | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis-ci-build b/.travis-ci-build index 4fec82f..dd4a2ec 100755 --- a/.travis-ci-build +++ b/.travis-ci-build @@ -2,7 +2,7 @@ cd $1 if [ "$BLD" = autotools ]; then - set -x + set -ex autoreconf -vis mkdir build-autotools cd build-autotools @@ -10,7 +10,7 @@ if [ "$BLD" = autotools ]; then make make install elif [ "$BLD" = cmake ]; then - set -x + set -ex mkdir build-cmake cd build-cmake cmake -DCMAKE_INSTALL_PREFIX=$HOME/.local .. From 616df0af82a0e2d42cd49f79858f1a1fdca45e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 26 Jun 2017 11:30:36 +0200 Subject: [PATCH 5/8] Do not use pkg-config(1) to search for libnfc Since libnfc is not installed system-wide, pkg-config(1) can't find it. Set LIBNFC_CFLAGS/LDFLAGS manually. --- .travis-ci-build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis-ci-build b/.travis-ci-build index dd4a2ec..0bf553e 100755 --- a/.travis-ci-build +++ b/.travis-ci-build @@ -6,7 +6,7 @@ if [ "$BLD" = autotools ]; then autoreconf -vis mkdir build-autotools cd build-autotools - ../configure --prefix=$HOME/.local CFLAGS="-I$HOME/.local/include" LDFLAGS="-L$HOME/.local/lib" + ../configure --prefix=$HOME/.local LIBNFC_CFLAGS="-I$HOME/.local/include" LIBNFC_LIBS="-L$HOME/.local/lib -lnfc" make make install elif [ "$BLD" = cmake ]; then From 33eaf7fcced58f57385d6d748d927e3c7b9f0e8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 26 Jun 2017 11:43:17 +0200 Subject: [PATCH 6/8] Run the test suite using cutter This is only available with the autotools build for now. --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index da8e4c7..0c26443 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,4 +18,6 @@ addons: install: - git clone https://github.com/nfc-tools/libnfc - ./.travis-ci-build libnfc -script: ./.travis-ci-build . +script: + - ./.travis-ci-build . + - if [ "$BLD" = autotools ]; then (cd build-autotools && cutter test); fi From 7536bbde064159ad0de9afc11994996a2dcc2b36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 26 Jun 2017 11:52:00 +0200 Subject: [PATCH 7/8] Attempt to have a working cutter --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0c26443..83f2ba6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,10 +10,12 @@ env: addons: apt: + sources: + - sourceline: 'ppa:cutter-testing-framework/ppa' packages: - libusb-dev - cmake - - libcutter-dev + - cutter-testing-framework install: - git clone https://github.com/nfc-tools/libnfc From be3e581effa2b214d8f68d0811ee3e9837984fbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Tarti=C3=A8re?= Date: Mon, 26 Jun 2017 12:49:54 +0200 Subject: [PATCH 8/8] Build test then run them We do not run the test suite at the `make check` stage here in order to have a better output. --- .travis.yml | 2 +- test/run-test.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 83f2ba6..62746ff 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,4 +22,4 @@ install: - ./.travis-ci-build libnfc script: - ./.travis-ci-build . - - if [ "$BLD" = autotools ]; then (cd build-autotools && cutter test); fi + - if [ "$BLD" = autotools ]; then (cd build-autotools && make check TESTS_ENVIRONMENT=SKIP_TESTS=1 && cutter test); fi diff --git a/test/run-test.sh b/test/run-test.sh index 2c8bc7b..2feb389 100755 --- a/test/run-test.sh +++ b/test/run-test.sh @@ -1,5 +1,9 @@ #!/bin/sh +if [ -n "${SKIP_TESTS}" ]; then + exit 0 +fi + export BASE_DIR="`dirname $0`" if test -z "$NO_MAKE"; then