Workaround to ensure compatibility with older CMake

Travis uses Ubuntu Precise, which has CMake 3.8. That version does not
have support for excluding /usr and /usr/bin from the %files% list
(which results in a package that conflicts with the filesystem package
and fails to install).

This commit:

+ Builds on Precise instead of Trusty
+ Adds install tests
pull/2/head
Thomas Orozco 10 years ago
parent b7afb24a82
commit 12749881e0
  1. 4
      Dockerfile
  2. 5
      ci/run_build.sh
  3. 21
      ci/util/rpmbuild
  4. 3
      ddist.sh
  5. 32
      test/test.py

@ -1,5 +1,5 @@
FROM ubuntu
FROM ubuntu:precise
RUN apt-get update \
&& apt-get install --no-install-recommends --yes build-essential git gdb valgrind cmake rpm \
&& apt-get install --no-install-recommends --yes build-essential git gdb valgrind cmake rpm python3 \
&& rm -rf /var/lib/apt/lists/*

@ -7,6 +7,11 @@ set -o nounset
: ${DIST_DIR:="${SOURCE_DIR}/dist"}
: ${BUILD_DIR:="/tmp/build"}
# Set path to prioritize our utils
export REAL_PATH="${PATH}"
export PATH="${SOURCE_DIR}/ci/util:${PATH}"
echo "PATH IS: $PATH"
# Build
cmake -B"${BUILD_DIR}" -H"${SOURCE_DIR}"

@ -0,0 +1,21 @@
#!/bin/bash
# Wrapper for rpm build that first removes files that should be in there
# We need this for compatibility with CMake <= 2.8.10 (which is the only version we have in Travis)
# See: http://www.cmake.org/pipermail/cmake-commits/2013-April/014818.html
set -o nounset
set -o errexit
set -o pipefail
# Remove PATH hack so we can find the real rpmbuild
export PATH="${REAL_PATH}"
echo "Using local rpmbuild"
specFile="${!#}" # Last argument
for removeLine in '"/usr"' '"/usr/bin"'; do
sed -i "s|${removeLine}||g" "${specFile}"
done
# Passthrough to rpmbuild
exec rpmbuild "${@}"

@ -8,6 +8,9 @@ HERE=$(cd "${REL_HERE}"; pwd)
IMG="tini"
SRC="/tini"
# Cleanup the build dir
rm -f "${HERE}/dist"/*
# Create the build image
docker build -t "${IMG}" .

@ -61,36 +61,50 @@ if __name__ == "__main__":
root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
for entrypoint in ["/tini/dist/tini"]:
base_cmd = [
"docker",
"run",
"--rm",
"--volume={0}:/tini".format(root),
"--name={0}".format(name),
]
fail_cmd = ["docker", "kill", name]
# Funtional tests
for entrypoint in ["/tini/dist/tini"]:
functional_base_cmd = base_cmd + [
"--entrypoint={0}".format(entrypoint),
img,
"-vvvv",
]
fail_cmd = ["docker", "kill", name]
# Reaping test
Command(base_cmd + ["/tini/test/reaping/stage_1.py"], fail_cmd).run(timeout=10)
Command(functional_base_cmd + ["/tini/test/reaping/stage_1.py"], fail_cmd).run(timeout=10)
# Signals test
for sig, retcode in [("INT", 1), ("TERM", 143)]:
Command(
base_cmd + ["--", "/tini/test/signals/test.py"],
functional_base_cmd + ["--", "/tini/test/signals/test.py"],
fail_cmd,
["docker", "kill", "-s", sig, name],
2
).run(timeout=10, retcode=retcode)
# Exit code test
Command(base_cmd + ["-z"], fail_cmd).run(retcode=1)
Command(base_cmd + ["--", "zzzz"], fail_cmd).run(retcode=1)
Command(base_cmd + ["-h"], fail_cmd).run(retcode=0)
Command(functional_base_cmd + ["-z"], fail_cmd).run(retcode=1)
Command(functional_base_cmd + ["--", "zzzz"], fail_cmd).run(retcode=1)
Command(functional_base_cmd + ["-h"], fail_cmd).run()
# Valgrind test
Command(base_cmd + ["--", "valgrind", "--leak-check=full", "--error-exitcode=1", entrypoint, "-v", "--", "ls"], fail_cmd).run()
Command(functional_base_cmd + ["--", "valgrind", "--leak-check=full", "--error-exitcode=1", entrypoint, "-v", "--", "ls"], fail_cmd).run()
# Install tests (sh -c is used for globbing and &&)
for image, pkg_manager, extension in [
["ubuntu:precise", "dpkg", "deb"],
["ubuntu:trusty", "dpkg", "deb"],
["centos:6", "rpm", "rpm"],
["centos:7", "rpm", "rpm"],
]:
Command(base_cmd + [image, "sh", "-c", "{0} -i /tini/dist/*.{1} && /usr/bin/tini true".format(pkg_manager, extension)], fail_cmd).run()

Loading…
Cancel
Save