Skip to content

Commit c5cc2cc

Browse files
authored
Merge pull request #1915 from larsewi/test-on-thismachine
ENT-12600: test-on-thismachine: documented & refactored script
2 parents dbb48c9 + 3ff4b9e commit c5cc2cc

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

build-scripts/test-on-thismachine

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
#!/bin/sh -x
1+
#!/bin/sh
22

33
. "$(dirname "$0")"/functions
44
. detect-environment
55
. compile-options
66
. version
77

8+
# Special handling for Windows
89
case "$OS" in
910
mingw)
1011
if [ "no" != "$ESCAPETEST" ]; then
@@ -15,6 +16,8 @@ mingw)
1516
;;
1617
esac
1718

19+
# Launches an interactive shell for debugging purposes.
20+
# This is useful for developers who want to inspect the environment mid-build.
1821
if [ "$TEST_SHELL" = "1" ]; then
1922
if [ -n "$SHELL" ]; then
2023
"$SHELL" -i
@@ -23,25 +26,33 @@ if [ "$TEST_SHELL" = "1" ]; then
2326
else
2427
/bin/sh -i
2528
fi
26-
echo "Forcing failure to interrupt build..."
29+
log_debug "Forcing failure to interrupt build..."
2730
exit 1
28-
else
29-
if [ "$TESTS" = all ]; then
30-
chmod -R g-w "$BASEDIR"/core/tests/acceptance/*
31-
chmod -R g-w "$BASEDIR"/masterfiles/tests/acceptance/*
32-
chmod -R g-w "$BASEDIR"/masterfiles/lib/*
33-
chmod -R g-w "$BASEDIR"/masterfiles/inventory/*
34-
if [ "$PROJECT" != "community" ]; then
35-
chmod -R g-w "$BASEDIR"/enterprise/tests/acceptance/*
36-
fi
37-
for project in $(projects_to_test); do
38-
# Unfortunately VERBOSE env variable is being used by both
39-
# "testall" script and automake. As a result, setting VERBOSE=1
40-
# causes testall to pass "1" as an argument to cf-agent!
41-
# Workarount: VERBOSE=-I
42-
NETWORK_TESTS=0 $MAKE -C "$BASEDIR"/"$project" VERBOSE=-I check
43-
done
44-
elif [ "$TESTS" = unit ]; then
45-
$MAKE -C "$BASEDIR"/core/tests/unit VERBOSE=-I check
31+
fi
32+
33+
if [ "$TESTS" = all ]; then
34+
# Run all tests
35+
36+
# Make sure tests are not writable by others.
37+
# Otherwise, the agent will refuse to run them due to security concerns.
38+
chmod -R g-w "$BASEDIR"/core/tests/acceptance/*
39+
chmod -R g-w "$BASEDIR"/masterfiles/tests/acceptance/*
40+
chmod -R g-w "$BASEDIR"/masterfiles/lib/*
41+
chmod -R g-w "$BASEDIR"/masterfiles/inventory/*
42+
43+
# Enterprise repo will not be there in a community build
44+
if [ "$PROJECT" != "community" ]; then
45+
chmod -R g-w "$BASEDIR"/enterprise/tests/acceptance/*
4646
fi
47+
48+
for project in $(projects_to_test); do
49+
# Unfortunately VERBOSE env variable is being used by both
50+
# "testall" script and automake. As a result, setting VERBOSE=1
51+
# causes testall to pass "1" as an argument to cf-agent!
52+
# Workaround: VERBOSE=-I
53+
NETWORK_TESTS=0 $MAKE -C "$BASEDIR"/"$project" VERBOSE=-I check
54+
done
55+
elif [ "$TESTS" = unit ]; then
56+
# Run only unit tests
57+
$MAKE -C "$BASEDIR"/core/tests/unit VERBOSE=-I check
4758
fi

0 commit comments

Comments
 (0)