Commit c529b2c7 by Edward Thomson

ci: allow users to opt-in only to certain tests

Previously, users could skip certain tests when running the CI script
(`SKIP_ONLINE_TESTS=1`). Provide a mechanism for users to opt-in to
only certain tests (`SKIP_TESTS=1 SKIP_ONLINE_TESTS=0`).
parent f52bc4e5
...@@ -3,7 +3,14 @@ ...@@ -3,7 +3,14 @@
set -e set -e
if [ -n "$SKIP_TESTS" ]; then if [ -n "$SKIP_TESTS" ]; then
exit 0 if [ -z "$SKIP_OFFLINE_TESTS" ]; then SKIP_OFFLINE_TESTS=1; fi
if [ -z "$SKIP_ONLINE_TESTS" ]; then SKIP_ONLINE_TESTS=1; fi
if [ -z "$SKIP_GITDAEMON_TESTS" ]; then SKIP_GITDAEMON_TESTS=1; fi
if [ -z "$SKIP_PROXY_TESTS" ]; then SKIP_PROXY_TESTS=1; fi
if [ -z "$SKIP_NTLM_TESTS" ]; then SKIP_NTLM_TESTS=1; fi
if [ -z "$SKIP_NEGOTIATE_TESTS" ]; then SKIP_NEGOTIATE_TESTS=1; fi
if [ -z "$SKIP_SSH_TESTS" ]; then SKIP_SSH_TESTS=1; fi
if [ -z "$SKIP_FUZZERS" ]; then SKIP_FUZZERS=1; fi
fi fi
# Windows doesn't run the NTLM tests properly (yet) # Windows doesn't run the NTLM tests properly (yet)
...@@ -24,6 +31,16 @@ export CLAR_HOMEDIR=${HOME} ...@@ -24,6 +31,16 @@ export CLAR_HOMEDIR=${HOME}
SUCCESS=1 SUCCESS=1
CONTINUE_ON_FAILURE=0 CONTINUE_ON_FAILURE=0
should_run() {
eval "skip=\${SKIP_${1}}"
[ -z "$skip" \
-o "$skip" == "no" -o "$skip" == "NO" \
-o "$skip" == "n" -o "$skip" == "N" \
-o "$skip" == "false" -o "$skip" == "FALSE" \
-o "$skip" == "f" -o "$skip" == "F" \
-o "$skip" == "0" ]
}
cleanup() { cleanup() {
echo "Cleaning up..." echo "Cleaning up..."
...@@ -140,7 +157,7 @@ echo "########################################################################## ...@@ -140,7 +157,7 @@ echo "##########################################################################
echo "" echo ""
if [ -z "$SKIP_GITDAEMON_TESTS" ]; then if should_run "GITDAEMON_TESTS"; then
echo "Starting git daemon (standard)..." echo "Starting git daemon (standard)..."
GIT_STANDARD_DIR=`mktemp -d ${TMPDIR}/git_standard.XXXXXXXX` GIT_STANDARD_DIR=`mktemp -d ${TMPDIR}/git_standard.XXXXXXXX`
git init --bare "${GIT_STANDARD_DIR}/test.git" >/dev/null git init --bare "${GIT_STANDARD_DIR}/test.git" >/dev/null
...@@ -160,7 +177,7 @@ if [ -z "$SKIP_GITDAEMON_TESTS" ]; then ...@@ -160,7 +177,7 @@ if [ -z "$SKIP_GITDAEMON_TESTS" ]; then
GIT_SHA256_PID=$! GIT_SHA256_PID=$!
fi fi
if [ -z "$SKIP_PROXY_TESTS" ]; then if should_run "PROXY_TESTS"; then
curl --location --silent --show-error https://github.com/ethomson/poxyproxy/releases/download/v0.7.0/poxyproxy-0.7.0.jar >poxyproxy.jar curl --location --silent --show-error https://github.com/ethomson/poxyproxy/releases/download/v0.7.0/poxyproxy-0.7.0.jar >poxyproxy.jar
echo "Starting HTTP proxy (Basic)..." echo "Starting HTTP proxy (Basic)..."
...@@ -172,7 +189,7 @@ if [ -z "$SKIP_PROXY_TESTS" ]; then ...@@ -172,7 +189,7 @@ if [ -z "$SKIP_PROXY_TESTS" ]; then
PROXY_NTLM_PID=$! PROXY_NTLM_PID=$!
fi fi
if [ -z "$SKIP_NTLM_TESTS" -o -z "$SKIP_ONLINE_TESTS" ]; then if should_run "NTLM_TESTS" || should_run "ONLINE_TESTS"; then
curl --location --silent --show-error https://github.com/ethomson/poxygit/releases/download/v0.6.0/poxygit-0.6.0.jar >poxygit.jar curl --location --silent --show-error https://github.com/ethomson/poxygit/releases/download/v0.6.0/poxygit-0.6.0.jar >poxygit.jar
echo "Starting HTTP server..." echo "Starting HTTP server..."
...@@ -182,7 +199,7 @@ if [ -z "$SKIP_NTLM_TESTS" -o -z "$SKIP_ONLINE_TESTS" ]; then ...@@ -182,7 +199,7 @@ if [ -z "$SKIP_NTLM_TESTS" -o -z "$SKIP_ONLINE_TESTS" ]; then
HTTP_PID=$! HTTP_PID=$!
fi fi
if [ -z "$SKIP_SSH_TESTS" ]; then if should_run "SSH_TESTS"; then
echo "Starting SSH server..." echo "Starting SSH server..."
SSHD_DIR=`mktemp -d ${TMPDIR}/sshd.XXXXXXXX` SSHD_DIR=`mktemp -d ${TMPDIR}/sshd.XXXXXXXX`
git init --bare "${SSHD_DIR}/test.git" >/dev/null git init --bare "${SSHD_DIR}/test.git" >/dev/null
...@@ -232,7 +249,7 @@ fi ...@@ -232,7 +249,7 @@ fi
# Run the tests that do not require network connectivity. # Run the tests that do not require network connectivity.
if [ -z "$SKIP_OFFLINE_TESTS" ]; then if should_run "OFFLINE_TESTS"; then
echo "" echo ""
echo "##############################################################################" echo "##############################################################################"
echo "## Running core tests" echo "## Running core tests"
...@@ -267,7 +284,7 @@ fi ...@@ -267,7 +284,7 @@ fi
# allow them to retry up to 5 times # allow them to retry up to 5 times
export GITTEST_FLAKY_RETRY=5 export GITTEST_FLAKY_RETRY=5
if [ -z "$SKIP_ONLINE_TESTS" ]; then if should_run "ONLINE_TESTS"; then
# Run the online tests. The "online" test suite only includes the # Run the online tests. The "online" test suite only includes the
# default online tests that do not require additional configuration. # default online tests that do not require additional configuration.
# The "proxy" and "ssh" test suites require further setup. # The "proxy" and "ssh" test suites require further setup.
...@@ -296,7 +313,7 @@ if [ -z "$SKIP_ONLINE_TESTS" ]; then ...@@ -296,7 +313,7 @@ if [ -z "$SKIP_ONLINE_TESTS" ]; then
run_test online_customcert run_test online_customcert
fi fi
if [ -z "$SKIP_GITDAEMON_TESTS" ]; then if should_run "GITDAEMON_TESTS"; then
echo "" echo ""
echo "Running gitdaemon (standard) tests" echo "Running gitdaemon (standard) tests"
echo "" echo ""
...@@ -324,7 +341,7 @@ if [ -z "$SKIP_GITDAEMON_TESTS" ]; then ...@@ -324,7 +341,7 @@ if [ -z "$SKIP_GITDAEMON_TESTS" ]; then
unset GITTEST_REMOTE_URL unset GITTEST_REMOTE_URL
fi fi
if [ -z "$SKIP_PROXY_TESTS" ]; then if should_run "PROXY_TESTS"; then
echo "" echo ""
echo "Running proxy tests (Basic authentication)" echo "Running proxy tests (Basic authentication)"
echo "" echo ""
...@@ -350,7 +367,7 @@ if [ -z "$SKIP_PROXY_TESTS" ]; then ...@@ -350,7 +367,7 @@ if [ -z "$SKIP_PROXY_TESTS" ]; then
unset GITTEST_REMOTE_PROXY_PASS unset GITTEST_REMOTE_PROXY_PASS
fi fi
if [ -z "$SKIP_NTLM_TESTS" ]; then if should_run "NTLM_TESTS"; then
echo "" echo ""
echo "Running NTLM tests (IIS emulation)" echo "Running NTLM tests (IIS emulation)"
echo "" echo ""
...@@ -376,7 +393,7 @@ if [ -z "$SKIP_NTLM_TESTS" ]; then ...@@ -376,7 +393,7 @@ if [ -z "$SKIP_NTLM_TESTS" ]; then
unset GITTEST_REMOTE_PASS unset GITTEST_REMOTE_PASS
fi fi
if [ -z "$SKIP_NEGOTIATE_TESTS" -a -n "$GITTEST_NEGOTIATE_PASSWORD" ]; then if should_run "NEGOTIATE_TESTS" && -n "$GITTEST_NEGOTIATE_PASSWORD" ; then
echo "" echo ""
echo "Running SPNEGO tests" echo "Running SPNEGO tests"
echo "" echo ""
...@@ -409,7 +426,7 @@ if [ -z "$SKIP_NEGOTIATE_TESTS" -a -n "$GITTEST_NEGOTIATE_PASSWORD" ]; then ...@@ -409,7 +426,7 @@ if [ -z "$SKIP_NEGOTIATE_TESTS" -a -n "$GITTEST_NEGOTIATE_PASSWORD" ]; then
kdestroy -A kdestroy -A
fi fi
if [ -z "$SKIP_SSH_TESTS" ]; then if should_run "SSH_TESTS"; then
export GITTEST_REMOTE_USER=$USER export GITTEST_REMOTE_USER=$USER
export GITTEST_REMOTE_SSH_KEY="${HOME}/.ssh/id_rsa" export GITTEST_REMOTE_SSH_KEY="${HOME}/.ssh/id_rsa"
export GITTEST_REMOTE_SSH_PUBKEY="${HOME}/.ssh/id_rsa.pub" export GITTEST_REMOTE_SSH_PUBKEY="${HOME}/.ssh/id_rsa.pub"
...@@ -445,7 +462,7 @@ fi ...@@ -445,7 +462,7 @@ fi
unset GITTEST_FLAKY_RETRY unset GITTEST_FLAKY_RETRY
if [ -z "$SKIP_FUZZERS" ]; then if should_run "FUZZERS"; then
echo "" echo ""
echo "##############################################################################" echo "##############################################################################"
echo "## Running fuzzers" echo "## Running fuzzers"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment