瀏覽代碼

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.
Julian Andres Klode 10 年之前
父節點
當前提交
dfd863ea50

+ 8 - 2
.travis.yml

@@ -3,15 +3,21 @@ sudo: required
 dist: trusty
 dist: trusty
 before_install:
 before_install:
  - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ wily main universe' -y
  - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ wily main universe' -y
+ - sudo add-apt-repository 'deb http://archive.ubuntu.com/ubuntu/ xenial main' -y
  - |
  - |
    sudo sh -c '/bin/echo -e "Package: *\nPin: release n=wily\nPin-Priority: 1" > /etc/apt/preferences.d/wily'
    sudo sh -c '/bin/echo -e "Package: *\nPin: release n=wily\nPin-Priority: 1" > /etc/apt/preferences.d/wily'
+   sudo sh -c '/bin/echo -e "Package: *\nPin: release n=xenial\nPin-Priority: 1" > /etc/apt/preferences.d/xenial'
  - sudo apt-get update -qq
  - sudo apt-get update -qq
 install:
 install:
  - sudo ./prepare-release travis-ci
  - sudo ./prepare-release travis-ci
  - sudo apt-get -qq -y -t wily install gettext liblz4-dev python3-apt
  - sudo apt-get -qq -y -t wily install gettext liblz4-dev python3-apt
- - make
+ - sudo apt-get -qq -y -t xenial install cmake
+before_script:
+ - ( mkdir build && cd build && cmake .. )
+ - make -C build -j4
 script:
 script:
- - make test
  - ./test/integration/run-tests -q
  - ./test/integration/run-tests -q
  - sudo adduser --force-badname --system --home /nonexistent --no-create-home --quiet _apt || true
  - sudo adduser --force-badname --system --home /nonexistent --no-create-home --quiet _apt || true
  - sudo ./test/integration/run-tests -q
  - sudo ./test/integration/run-tests -q
+ - make -C build install DESTDIR=$PWD/rootdir
+ - find rootdir -print0 | xargs -0 ls -ld

+ 1 - 0
CMakeLists.txt

@@ -133,3 +133,4 @@ add_subdirectory(dselect)
 add_subdirectory(ftparchive)
 add_subdirectory(ftparchive)
 add_subdirectory(methods)
 add_subdirectory(methods)
 add_subdirectory(po)
 add_subdirectory(po)
+add_subdirectory(test)

+ 1 - 0
test/CMakeLists.txt

@@ -0,0 +1 @@
+add_subdirectory(interactive-helper)

+ 9 - 8
test/integration/framework

@@ -180,7 +180,7 @@ aptconfig() { runapt apt-config "$@"; }
 aptcache() { runapt apt-cache "$@"; }
 aptcache() { runapt apt-cache "$@"; }
 aptcdrom() { runapt apt-cdrom "$@"; }
 aptcdrom() { runapt apt-cdrom "$@"; }
 aptget() { runapt apt-get "$@"; }
 aptget() { runapt apt-get "$@"; }
-aptftparchive() { runapt apt-ftparchive "$@"; }
+aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; }
 aptkey() { runapt apt-key "$@"; }
 aptkey() { runapt apt-key "$@"; }
 aptmark() { runapt apt-mark "$@"; }
 aptmark() { runapt apt-mark "$@"; }
 aptsortpkgs() { runapt apt-sortpkgs "$@"; }
 aptsortpkgs() { runapt apt-sortpkgs "$@"; }
@@ -283,14 +283,15 @@ setupenvironment() {
 	TESTDIRECTORY="$(readlink -f "$(dirname $0)")"
 	TESTDIRECTORY="$(readlink -f "$(dirname $0)")"
         # allow overriding the default BUILDDIR location
         # allow overriding the default BUILDDIR location
 	SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}"
 	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}"}"
         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"
 	test -x "${BUILDDIRECTORY}/apt-get" || msgdie "You need to build tree first"
         # -----
         # -----
 
 

+ 1 - 1
test/integration/test-apt-helper-cat-file

@@ -5,7 +5,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")"
 . "$TESTDIR/framework"
 . "$TESTDIR/framework"
 setupenvironment
 setupenvironment
 
 
-TESTTOOL="${BUILDDIRECTORY}/test_fileutl"
+TESTTOOL="${BUILDDIRECTORY}/../test/interactive-helper/test_fileutl"
 msgtest 'Check if we have build the test tool' "$TESTTOOL"
 msgtest 'Check if we have build the test tool' "$TESTTOOL"
 if [ -x "$TESTTOOL" ]; then
 if [ -x "$TESTTOOL" ]; then
 	msgpass
 	msgpass

+ 10 - 0
test/interactive-helper/CMakeLists.txt

@@ -0,0 +1,10 @@
+add_executable(mthdcat mthdcat.cc)
+target_link_libraries(mthdcat apt-pkg)
+add_executable(testdeb testdeb.cc)
+target_link_libraries(testdeb apt-pkg apt-inst)
+add_executable(extract-control extract-control.cc)
+target_link_libraries(extract-control apt-pkg apt-inst)
+add_executable(aptwebserver aptwebserver.cc)
+target_link_libraries(aptwebserver apt-pkg  ${CMAKE_THREAD_LIBS_INIT})
+add_executable(test_fileutl test_fileutl.cc)
+target_link_libraries(test_fileutl apt-pkg)