From 176900f93bee233cb8662fb0c0449d48b8ae5889 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 23 Sep 2025 14:35:14 +0200 Subject: [PATCH 1/4] test-on-thismachine: decreased verbosity of script Signed-off-by: Lars Erik Wik --- build-scripts/test-on-thismachine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-scripts/test-on-thismachine b/build-scripts/test-on-thismachine index 9bb0d6bf8..d88379254 100755 --- a/build-scripts/test-on-thismachine +++ b/build-scripts/test-on-thismachine @@ -1,4 +1,4 @@ -#!/bin/sh -x +#!/bin/sh . "$(dirname "$0")"/functions . detect-environment From 38b8884f2b6df0e2d72b24c14e97894c83fdd793 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 23 Sep 2025 14:36:31 +0200 Subject: [PATCH 2/4] test-on-thismachine: removed unecessary else block Signed-off-by: Lars Erik Wik --- build-scripts/test-on-thismachine | 36 +++++++++++++++---------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/build-scripts/test-on-thismachine b/build-scripts/test-on-thismachine index d88379254..bd7fc2f09 100755 --- a/build-scripts/test-on-thismachine +++ b/build-scripts/test-on-thismachine @@ -25,23 +25,23 @@ if [ "$TEST_SHELL" = "1" ]; then fi echo "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 + 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 From 3158362dbb485113a281e880b8fd887c5b02a2e8 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 23 Sep 2025 14:38:08 +0200 Subject: [PATCH 3/4] test-on-thismachine: fixed typo in comment Signed-off-by: Lars Erik Wik --- build-scripts/test-on-thismachine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-scripts/test-on-thismachine b/build-scripts/test-on-thismachine index bd7fc2f09..93f6bf242 100755 --- a/build-scripts/test-on-thismachine +++ b/build-scripts/test-on-thismachine @@ -39,7 +39,7 @@ if [ "$TESTS" = all ]; then # 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 + # Workaround: VERBOSE=-I NETWORK_TESTS=0 $MAKE -C "$BASEDIR"/"$project" VERBOSE=-I check done elif [ "$TESTS" = unit ]; then From 3ff4b9ecaa393c8ae0bd1079bc2bf38209174a42 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Tue, 23 Sep 2025 14:57:25 +0200 Subject: [PATCH 4/4] test-on-thismachine: documented script Ticket: ENT-12600 Signed-off-by: Lars Erik Wik --- build-scripts/test-on-thismachine | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build-scripts/test-on-thismachine b/build-scripts/test-on-thismachine index 93f6bf242..8505dd8f8 100755 --- a/build-scripts/test-on-thismachine +++ b/build-scripts/test-on-thismachine @@ -5,6 +5,7 @@ . compile-options . version +# Special handling for Windows case "$OS" in mingw) if [ "no" != "$ESCAPETEST" ]; then @@ -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 @@ -23,18 +26,25 @@ 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 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 @@ -43,5 +53,6 @@ if [ "$TESTS" = all ]; then 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