Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 31 additions & 20 deletions build-scripts/test-on-thismachine
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/sh -x
#!/bin/sh

. "$(dirname "$0")"/functions
. detect-environment
. compile-options
. version

# Special handling for Windows
case "$OS" in
mingw)
if [ "no" != "$ESCAPETEST" ]; then
Expand All @@ -15,6 +16,8 @@ mingw)
;;
esac

# Launches an interactive shell for debugging purposes.
# This is useful for developers who want to inspect the environment mid-build.
if [ "$TEST_SHELL" = "1" ]; then
if [ -n "$SHELL" ]; then
"$SHELL" -i
Expand All @@ -23,25 +26,33 @@ if [ "$TEST_SHELL" = "1" ]; then
else
/bin/sh -i
fi
echo "Forcing failure to interrupt build..."
log_debug "Forcing failure to interrupt build..."
exit 1
else
if [ "$TESTS" = all ]; then
chmod -R g-w "$BASEDIR"/core/tests/acceptance/*
chmod -R g-w "$BASEDIR"/masterfiles/tests/acceptance/*
chmod -R g-w "$BASEDIR"/masterfiles/lib/*
chmod -R g-w "$BASEDIR"/masterfiles/inventory/*
if [ "$PROJECT" != "community" ]; then
chmod -R g-w "$BASEDIR"/enterprise/tests/acceptance/*
fi
for project in $(projects_to_test); do
# Unfortunately VERBOSE env variable is being used by both
# "testall" script and automake. As a result, setting VERBOSE=1
# causes testall to pass "1" as an argument to cf-agent!
# Workarount: VERBOSE=-I
NETWORK_TESTS=0 $MAKE -C "$BASEDIR"/"$project" VERBOSE=-I check
done
elif [ "$TESTS" = unit ]; then
$MAKE -C "$BASEDIR"/core/tests/unit VERBOSE=-I check
fi

if [ "$TESTS" = all ]; then
# Run all tests

# Make sure tests are not writable by others.
# Otherwise, the agent will refuse to run them due to security concerns.
chmod -R g-w "$BASEDIR"/core/tests/acceptance/*
chmod -R g-w "$BASEDIR"/masterfiles/tests/acceptance/*
chmod -R g-w "$BASEDIR"/masterfiles/lib/*
chmod -R g-w "$BASEDIR"/masterfiles/inventory/*

# Enterprise repo will not be there in a community build
if [ "$PROJECT" != "community" ]; then
chmod -R g-w "$BASEDIR"/enterprise/tests/acceptance/*
fi

for project in $(projects_to_test); do
# Unfortunately VERBOSE env variable is being used by both
# "testall" script and automake. As a result, setting VERBOSE=1
# causes testall to pass "1" as an argument to cf-agent!
# Workaround: VERBOSE=-I
NETWORK_TESTS=0 $MAKE -C "$BASEDIR"/"$project" VERBOSE=-I check
done
elif [ "$TESTS" = unit ]; then
# Run only unit tests
$MAKE -C "$BASEDIR"/core/tests/unit VERBOSE=-I check
fi
Loading