Rename NO_ARGS to MINIMAL

white-label
Thomas Orozco 8 years ago
parent a60521a432
commit b67a024460
  1. 10
      .travis.yml
  2. 6
      CMakeLists.txt
  3. 28
      ci/run_build.sh
  4. 2
      ddist.sh
  5. 10
      src/tini.c
  6. 4
      test/run_inner_tests.py

@ -5,10 +5,10 @@ language: generic
env:
matrix:
- CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 NO_ARGS=
- CC=arm-linux-gnueabihf-gcc ARCH_SUFFIX=armhf ARCH_NATIVE= NO_ARGS=
- CC=aarch64-linux-gnu-gcc ARCH_SUFFIX=arm64 ARCH_NATIVE= NO_ARGS=
- CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 NO_ARGS=1
- 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=
- CC=gcc ARCH_SUFFIX=amd64 ARCH_NATIVE=1 MINIMAL=1
global:
- SIGN_BINARIES=1
- secure: "RKF9Z9gLxp6k/xITqn7ma1E9HfpYcDXuJFf4862WeH9EMnK9lDq+TWnGsQfkIlqh8h9goe7U+BvRiTibj9MiD5u7eluLo3dlwsLxPpYtyswYeLeC1wKKdT5LPGAXbRKomvBalRYMI+dDnGIM4w96mHgGGvx2zZXGkiAQhm6fJ3k="
@ -31,4 +31,4 @@ deploy:
on:
repo: krallin/tini
tags: true
condition: '-z "$NO_ARGS"'
condition: '-z "$MINIMAL"'

@ -7,10 +7,10 @@ set (tini_VERSION_MINOR 12)
set (tini_VERSION_PATCH 0)
# Build options
option(NO_ARGS "Disable argument parsing" OFF)
option(MINIMAL "Disable argument parsing and verbose output" OFF)
if(NO_ARGS)
add_definitions(-DTINI_NO_ARGS=1)
if(MINIMAL)
add_definitions(-DTINI_MINIMAL=1)
endif()
# Extract git version and dirty-ness

@ -45,8 +45,8 @@ export PATH="${SOURCE_DIR}/ci/util:${PATH}"
# Build
CMAKE_ARGS=(-B"${BUILD_DIR}" -H"${SOURCE_DIR}")
if [[ -n "${NO_ARGS:-}" ]]; then
CMAKE_ARGS+=(-DNO_ARGS=ON)
if [[ -n "${MINIMAL:-}" ]]; then
CMAKE_ARGS+=(-DMINIMAL=ON)
fi
cmake "${CMAKE_ARGS[@]}"
@ -77,7 +77,15 @@ if [[ -n "${ARCH_NATIVE:=}" ]]; then
echo "Testing ${tini} --version"
"$tini" --version | grep -q "tini version"
if [[ -n "${NO_ARGS:-}" ]]; then
echo "Testing ${tini} without arguments exits with 1"
! "$tini" 2>/dev/null
echo "Testing ${tini} shows help message"
{
! "$tini" 2>&1
} | grep -q "supervision of a valid init process"
if [[ -n "${MINIMAL:-}" ]]; then
echo "Testing $tini with: true"
"${tini}" true
@ -86,14 +94,7 @@ if [[ -n "${ARCH_NATIVE:=}" ]]; then
exit 1
fi
echo "Testing ${tini} without arguments exits with 1"
! "$tini" 2>/dev/null
echo "Testing ${tini} shows help message"
{
! "$tini" 2>&1
} | grep -q "supervision of a valid init process"
echo "Testing ${tini} does not reference options that don't exist"
! {
! "$tini" 2>&1
} | grep -q "more verbose"
@ -126,6 +127,11 @@ if [[ -n "${ARCH_NATIVE:=}" ]]; then
if "${tini}" -vvv false; then
exit 1
fi
echo "Testing ${tini} references options that exist"
{
! "$tini" 2>&1
} | grep -q "more verbose"
fi
echo "Testing ${tini} supports TINI_VERBOSITY"

@ -24,5 +24,5 @@ docker run -it --rm \
-e CC="${CC:=gcc}" \
-e ARCH_NATIVE="${ARCH_NATIVE-1}" \
-e ARCH_SUFFIX="${ARCH_SUFFIX-}" \
-e NO_ARGS="${NO_ARGS-}" \
-e MINIMAL="${MINIMAL-}" \
"${IMG}" "${SRC}/ci/run_build.sh"

@ -17,7 +17,7 @@
#include "tiniConfig.h"
#include "tiniLicense.h"
#if TINI_NO_ARGS
#if TINI_MINIMAL
#define PRINT_FATAL(...) fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n");
#define PRINT_WARNING(...) if (verbosity > 0) { fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n"); }
#define PRINT_INFO(...) if (verbosity > 1) { fprintf(stdout, __VA_ARGS__); fprintf(stdout, "\n"); }
@ -72,7 +72,7 @@ static const char reaper_warning[] = "Tini is not running as PID 1 "
Zombie processes will not be re-parented to Tini, so zombie reaping won't work.\n\
To fix the problem, "
#if HAS_SUBREAPER
#ifndef TINI_NO_ARGS
#ifndef TINI_MINIMAL
"use the -s option "
#endif
"or set the environment variable " SUBREAPER_ENV_VAR " to register Tini as a child subreaper, or "
@ -174,7 +174,7 @@ int spawn(const signal_configuration_t* const sigconf_ptr, char* const argv[], i
void print_usage(char* const name, FILE* const file) {
fprintf(file, "%s (%s)\n", basename(name), TINI_VERSION_STRING);
#if TINI_NO_ARGS
#if TINI_MINIMAL
fprintf(file, "Usage: %s PROGRAM [ARGS] | --version\n\n", basename(name));
#else
fprintf(file, "Usage: %s [OPTIONS] PROGRAM -- [ARGS] | --version\n\n", basename(name));
@ -185,7 +185,7 @@ void print_usage(char* const name, FILE* const file) {
fprintf(file, " --version: Show version and exit.\n");
#if TINI_NO_ARGS
#if TINI_MINIMAL
#else
fprintf(file, " -h: Show this help message and exit.\n");
#if HAS_SUBREAPER
@ -222,7 +222,7 @@ int parse_args(const int argc, char* const argv[], char* (**child_args_ptr_ptr)[
return 1;
}
#ifndef TINI_NO_ARGS
#ifndef TINI_MINIMAL
int c;
while ((c = getopt(argc, argv, OPT_STRING)) != -1) {
switch (c) {

@ -29,7 +29,7 @@ def main():
src = os.environ["SOURCE_DIR"]
build = os.environ["BUILD_DIR"]
args_disabled = os.environ.get("NO_ARGS")
args_disabled = os.environ.get("MINIMAL")
proxy = os.path.join(src, "test", "subreaper-proxy.py")
tini = os.path.join(build, "tini")
@ -81,7 +81,7 @@ def main():
busy_wait(lambda: p.poll() is not None, 10)
# Run failing test. Force verbosity to 1 so we see the subreaper warning
# regardless of whether NO_ARGS is set.
# regardless of whether MINIMAL is set.
print "Running zombie reaping failure test (Tini should warn)"
p = subprocess.Popen(
[tini, os.path.join(src, "test", "reaping", "stage_1.py")],

Loading…
Cancel
Save