From dfd863ea50c0fcf9b9ac4dfb5ae0e64c529bd767 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 6 Aug 2016 21:32:36 +0200 Subject: CMake: Switch integration tests and travis over This early support seems a bit hacky, but it's a hard switch: The integration tests do not understand the old build system anymore afterwards. I don't really like that. --- test/integration/framework | 17 +++++++++-------- test/integration/test-apt-helper-cat-file | 2 +- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index 7a6b044aa..824bd46b6 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -180,7 +180,7 @@ aptconfig() { runapt apt-config "$@"; } aptcache() { runapt apt-cache "$@"; } aptcdrom() { runapt apt-cdrom "$@"; } aptget() { runapt apt-get "$@"; } -aptftparchive() { runapt apt-ftparchive "$@"; } +aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } aptkey() { runapt apt-key "$@"; } aptmark() { runapt apt-mark "$@"; } aptsortpkgs() { runapt apt-sortpkgs "$@"; } @@ -283,14 +283,15 @@ setupenvironment() { TESTDIRECTORY="$(readlink -f "$(dirname $0)")" # allow overriding the default BUILDDIR location SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" - BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/bin"}" - LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}"}" - METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" + BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/cmdline"}" + LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/../apt-pkg"}" + METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/../methods"}" APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}" - APTWEBSERVERBINDIR="${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}"}" - APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/apt-internal-solver"}" - APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/apt-dump-solver"}" - APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${BUILDDIRECTORY}/apt-internal-planner"}" + APTWEBSERVERBINDIR="${APT_INTEGRATION_TESTS_WEBSERVER_BIN_DIR:-"${BUILDDIRECTORY}/../test/interactive-helper"}" + APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/../ftparchive"}" + APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${BUILDDIRECTORY}/solvers/apt"}" + APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${BUILDDIRECTORY}/solvers/dump"}" + APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${BUILDDIRECTORY}/planners/apt"}" test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first" # ----- diff --git a/test/integration/test-apt-helper-cat-file b/test/integration/test-apt-helper-cat-file index 3f509189e..a53a6b4a3 100755 --- a/test/integration/test-apt-helper-cat-file +++ b/test/integration/test-apt-helper-cat-file @@ -5,7 +5,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" . "$TESTDIR/framework" setupenvironment -TESTTOOL="${BUILDDIRECTORY}/test_fileutl" +TESTTOOL="${BUILDDIRECTORY}/../test/interactive-helper/test_fileutl" msgtest 'Check if we have build the test tool' "$TESTTOOL" if [ -x "$TESTTOOL" ]; then msgpass -- cgit v1.2.3 From c85c4bed0a4b32ee2dcbd86ea819e39f3d8beb84 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 9 Aug 2016 17:40:01 +0200 Subject: Get rid of the old buildsystem Bye, bye, old friend. --- test/integration/makefile | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 test/integration/makefile (limited to 'test/integration') diff --git a/test/integration/makefile b/test/integration/makefile deleted file mode 100644 index fb12fe9a8..000000000 --- a/test/integration/makefile +++ /dev/null @@ -1,10 +0,0 @@ -# -*- make -*- -BASE=../.. -SUBDIR=test/integration - -# Bring in the default rules -include ../../buildlib/defaults.mak - -.PHONY: test -test: - ./run-tests -- cgit v1.2.3 From 61fef4ddbec8f70bb9e213ac0491d4e6cfefab30 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 10 Aug 2016 14:16:52 +0200 Subject: test: Automatically discover CMake build directory Look at the project root, and all directories directly below it and pick the directory with the newest CMakeCache.txt file. Gbp-Dch: ignore --- test/integration/framework | 22 +++++++++++++++++++++- test/integration/run-tests | 6 ++++++ 2 files changed, 27 insertions(+), 1 deletion(-) (limited to 'test/integration') diff --git a/test/integration/framework b/test/integration/framework index 824bd46b6..0f442dff4 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -257,6 +257,24 @@ escape_shell() { echo "$@" | sed -e "s#'#'\"'\"'#g" } +find_project_binary_dir() { + local TESTDIRECTORY="$(readlink -f "$(dirname $0)")" + if [ -z "$PROJECT_BINARY_DIR" ]; then + PROJECT_BINARY_DIR= + for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do + test -e "$dir/CMakeCache.txt" || continue + if [ -z "$PROJECT_BINARY_DIR" ] || + [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then + PROJECT_BINARY_DIR="$dir" + fi + done + if [ -z "$PROJECT_BINARY_DIR" ]; then + echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 + exit 1 + fi + export PROJECT_BINARY_DIR + fi +} setupenvironment() { # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$(stat --format '%a' "$TMPDIR")" != '1777' ]; then @@ -281,9 +299,11 @@ setupenvironment() { fi TESTDIRECTORY="$(readlink -f "$(dirname $0)")" + # Find the newest build directory (sets PROJECT_BINARY_DIR) + find_project_binary_dir # allow overriding the default BUILDDIR location SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" - BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${TESTDIRECTORY}/../../build/cmdline"}" + BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"${PROJECT_BINARY_DIR}/cmdline"}" LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/../apt-pkg"}" METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/../methods"}" APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}"}" diff --git a/test/integration/run-tests b/test/integration/run-tests index 78f24fbaf..e90b4b755 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -1,4 +1,10 @@ #!/bin/sh + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +find_project_binary_dir + set -e TESTTORUN='' -- cgit v1.2.3