Add a static version as well

This commit is contained in:
Thomas Orozco 2015-03-01 11:46:29 -05:00
parent 5b7d66bfe3
commit ffb171edf7
3 changed files with 32 additions and 27 deletions

View File

@ -3,11 +3,14 @@ include config.mk
OBJ = tini.o
BIN = tini
all: $(BIN)
all: $(BIN) $(BIN)-static
$(BIN): $(OBJ)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $<
$(BIN)-static: $(OBJ)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -static -o $@ $<
$(OBJ):
install: all

View File

@ -15,4 +15,5 @@ BIN="tini"
docker build -t "${IMG}" .
docker run -it --name="${NAME}" "${IMG}" true "-h"
docker cp "${NAME}:/tini/${BIN}" "${DIST_DIR}"
docker cp "${NAME}:/tini/${BIN}-static" "${DIST_DIR}"
docker rm "${NAME}"

View File

@ -61,34 +61,35 @@ if __name__ == "__main__":
root = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
# Tests rely on exiting fast enough (exiting at all, in fact).
base_cmd = [
"docker",
"run",
"--rm",
"--name={0}".format(name),
img,
"-vvvv",
]
for entrypoint in ["/tini/tini", "/tini/tini-static"]:
base_cmd = [
"docker",
"run",
"--rm",
"--name={0}".format(name),
"--entrypoint={0}".format(entrypoint),
img,
"-vvvv",
]
fail_cmd = ["docker", "kill", name]
fail_cmd = ["docker", "kill", name]
# Reaping test
Command(base_cmd + ["/tini/test/reaping/stage_1.py"], fail_cmd).run(timeout=10)
# Reaping test
Command(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"],
fail_cmd,
["docker", "kill", "-s", sig, name],
2
).run(timeout=10, retcode=retcode)
# Signals test
for sig, retcode in [("INT", 1), ("TERM", 143)]:
Command(
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)
# 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)
# Valgrind test
Command(base_cmd + ["--", "valgrind", "--leak-check=full", "--error-exitcode=1", "/tini/tini", "-v", "--", "ls"], fail_cmd).run()
# Valgrind test
Command(base_cmd + ["--", "valgrind", "--leak-check=full", "--error-exitcode=1", "/tini/tini", "-v", "--", "ls"], fail_cmd).run()