Build musl-based binaries

Also fixed a bug with the signals test, which didn't properly exercise
Tini: rather than check that Tini was properly exiting with 128 +
signal, it raced against Tini and was only successful if Tini didn't get
the change to spawn a subprocess!
muslc-binaries
Thomas Orozco 8 years ago
parent 21c118c0e9
commit 540eb7b637
  1. 2
      .travis.yml
  2. 4
      ci/install_deps.sh
  3. 25
      ci/run_build.sh
  4. 7
      test/run_inner_tests.py
  5. 6
      test/run_outer_tests.py
  6. 13
      test/signals/test.py

@ -5,10 +5,12 @@ language: generic
env:
matrix:
- CC=gcc ARCH_SUFFIX= ARCH_NATIVE=1 MINIMAL=
- CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 MINIMAL=
- CC=arm-linux-gnueabihf-gcc ARCH_SUFFIX=armhf ARCH_NATIVE= MINIMAL=
- CC=aarch64-linux-gnu-gcc ARCH_SUFFIX=arm64 ARCH_NATIVE= MINIMAL=
- CFLAGS="-m32" ARCH_SUFFIX=i386 ARCH_NATIVE= MINIMAL=
- CC=musl-gcc ARCH_SUFFIX=muslc-amd64 ARCH_NATIVE=1 MINIMAL=
- CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 MINIMAL=1
global:
- SIGN_BINARIES=1

@ -9,7 +9,7 @@ DEPS=(
hardening-includes gnupg
)
if [[ "$ARCH_SUFFIX" = "amd64" ]]; then
if [[ -z "${ARCH_SUFFIX-}" ]] || [[ "$ARCH_SUFFIX" = "amd64" ]]; then
true
elif [[ "$ARCH_SUFFIX" = "armhf" ]]; then
DEPS+=(gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabi libc6-dev-armhf-cross)
@ -17,6 +17,8 @@ elif [[ "$ARCH_SUFFIX" = "arm64" ]]; then
DEPS+=(gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu libc6-dev-arm64-cross)
elif [[ "$ARCH_SUFFIX" = "i386" ]]; then
DEPS+=(libc6-dev-i386 gcc-multilib)
elif [[ "$ARCH_SUFFIX" = "muslc-amd64" ]]; then
DEPS+=(musl-tools)
else
echo "Unknown ARCH_SUFFIX=${ARCH_SUFFIX}"
exit 1

@ -136,6 +136,14 @@ if [[ -n "${ARCH_NATIVE-}" ]]; then
{
! "$tini" 2>&1
} | grep -q "more verbose"
echo "Testing $tini with: -- true (should succeed)"
"${tini}" -vvv -- true
echo "Testing $tini with: -- -- true (should fail)"
if "${tini}" -vvv -- -- true; then
exit 1
fi
fi
echo "Testing ${tini} supports TINI_VERBOSITY"
@ -164,7 +172,12 @@ if [[ -n "${ARCH_NATIVE-}" ]]; then
fi
echo "Checking hardening on $tini"
hardening-check --nopie --nostackprotector --nobindnow "${tini}"
hardening_skip=(--nopie --nostackprotector --nobindnow)
if [[ "$CC" == "musl-gcc" ]]; then
# FORTIFY_SOURCE is a glibc thing
hardening_skip=("${hardening_skip[@]}" --nofortify)
fi
hardening-check "${hardening_skip[@]}" "${tini}"
done
# Quick package audit
@ -193,7 +206,7 @@ if [[ -n "${ARCH_NATIVE-}" ]]; then
export CFLAGS # We need them to build our test suite, regardless of FORCE_SUBREAPER
# Install test dependencies
pip install psutil python-prctl bitmap
CC=gcc pip install psutil python-prctl bitmap
# Run tests
python "${SOURCE_DIR}/test/run_inner_tests.py"
@ -218,9 +231,7 @@ for tini in tini tini-static; do
to="${DIST_DIR}/${tini}-${ARCH_SUFFIX}"
TINIS+=("$to")
cp "${BUILD_DIR}/${tini}" "$to"
fi
if [[ -n "${ARCH_NATIVE-}" ]]; then
else
to="${DIST_DIR}/${tini}"
TINIS+=("$to")
cp "${BUILD_DIR}/${tini}" "$to"
@ -235,9 +246,7 @@ if [[ -n "${ARCH_NATIVE-}" ]]; then
to="${DIST_DIR}/tini_${pkg_version}-${ARCH_SUFFIX}.${pkg_format}"
TINIS+=("$to")
cp "$src" "$to"
fi
if [[ -n "${ARCH_NATIVE-}" ]]; then
else
to="${DIST_DIR}/tini_${pkg_version}.${pkg_format}"
TINIS+=("$to")
cp "$src" "$to"

@ -61,12 +61,13 @@ def main():
# Run the signals test
for signum in [signal.SIGINT, signal.SIGTERM]:
print "running signal test for: {0} ({1} with env {2})".format(SIGNUM_TO_SIGNAME[signum], " ".join(target), env)
for signum in [signal.SIGTERM, signal.SIGUSR1, signal.SIGUSR2]:
print "running signal test for: {0} ({1} with env {2})".format(signum, " ".join(target), env)
p = subprocess.Popen(target + [os.path.join(src, "test", "signals", "test.py")], env=dict(os.environ, **env))
busy_wait(lambda: len(psutil.Process(p.pid).children(recursive=True)) > 1, 10)
p.send_signal(signum)
ret = p.wait()
assert ret == -signum, "Signals test failed (ret was {0}, expected {1})".format(ret, -signum)
assert ret == 128 + signum, "Signals test failed (ret was {0}, expected {1})".format(ret, 128 + signum)
# Run the process group test

@ -55,9 +55,9 @@ class Command(object):
if err is not None:
print "FAIL"
print "--- STDOUT ---"
print self.stdout
print getattr(self, "stdout", "no stdout")
print "--- STDERR ---"
print self.stderr
print getattr(self, "stderr", "no stderr")
print "--- ... ---"
raise err
else:
@ -146,7 +146,7 @@ def main():
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)]:
for sig, retcode in [("TERM", 143), ("USR1", 138), ("USR2", 140)]:
Command(
functional_base_cmd + ["/tini/test/signals/test.py"],
fail_cmd,

@ -1,6 +1,13 @@
#!/usr/bin/env python
import time
import signal
import os
def main():
signal.signal(signal.SIGTERM, signal.SIG_DFL)
signal.signal(signal.SIGUSR1, signal.SIG_DFL)
signal.signal(signal.SIGUSR2, signal.SIG_DFL)
os.system("sleep 100")
if __name__ == "__main__":
while 1:
time.sleep(10)
main()

Loading…
Cancel
Save