From 248ea9bbb80111e4c8c1a70419bc963355853167 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Tue, 27 Nov 2018 12:36:56 +0100 Subject: add tests and fix errors found by tests --- test/run.sh | 272 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 272 insertions(+) create mode 100755 test/run.sh (limited to 'test/run.sh') diff --git a/test/run.sh b/test/run.sh new file mode 100755 index 0000000..430041c --- /dev/null +++ b/test/run.sh @@ -0,0 +1,272 @@ +#!/bin/bash +# depends on: bwrap, expect + +cd $(dirname "$0") +set -x + +fail() { + set +x + echo >&2 + echo "Test : $testname failed" >&2 + echo "Reason: $@" >&2 + echo >&2 + exit 2 +} + +clean() { + if [ -d "bin" ]; then + rm -r bin + fi + if [ -d "work" ]; then + rm -r work + fi + mkdir bin work + cp ../git-repo bin +} + +run() { + bwrap \ + --ro-bind /bin /bin \ + --ro-bind /usr /usr \ + --ro-bind /etc /etc \ + --ro-bind /lib /lib \ + --ro-bind /lib64 /lib64 \ + --ro-bind /run /run \ + --dev /dev \ + --proc /proc \ + --ro-bind bin /usr/local/bin \ + --bind work /git \ + $1 +} + +filemode() { + stat --format=%a "$@" +} + +######################## +testname=help +clean + +{ + cat <