From 8435fbc180fe017836019e5fcf181eae8cc12196 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 6 May 2026 17:17:31 +0200 Subject: [PATCH 01/22] tests: Added errorexit acceptance tests to GH Actions Signed-off-by: Ole Herman Schumacher Elgesem (cherry picked from commit 1e15566a35ff8af41f7a97a0bca08f37e64775be) --- .github/workflows/acceptance_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acceptance_tests.yml b/.github/workflows/acceptance_tests.yml index 166492e9d69..6e1d1a7ba89 100644 --- a/.github/workflows/acceptance_tests.yml +++ b/.github/workflows/acceptance_tests.yml @@ -20,4 +20,4 @@ jobs: run: | cd tests/acceptance chmod -R go-w . - ./testall --printlog --tests=common,errorlog + ./testall --printlog --tests=common,errorlog,errorexit From 5844e82947f5b44154c6c5b4c3745944b43f000a Mon Sep 17 00:00:00 2001 From: Sara Thon Date: Fri, 24 Jul 2026 15:40:03 +0200 Subject: [PATCH 02/22] CFE-4526: testall egrep & fgrep warnings Ticket: CFE-4526 (cherry picked from commit 15c5170076589d38025a39ebd61d8b033a3eced6) --- tests/acceptance/testall | 60 ++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/tests/acceptance/testall b/tests/acceptance/testall index 0959688b33c..4166191fe56 100755 --- a/tests/acceptance/testall +++ b/tests/acceptance/testall @@ -285,9 +285,9 @@ workdir() { } # Example: fgrepvar 'word' VARNAME -# Silent fgrep for variables: search for "word" in $VARNAME +# Silent grep -F for variables: search for "word" in $VARNAME fgrepvar() { - eval echo \$$2 | fgrep "$1" > /dev/null + eval echo \$$2 | grep -F "$1" > /dev/null } # Same but instead of word search for a regex @@ -524,22 +524,22 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR echo "Return code is $RETVAL." >> "$WORKDIR/$LOG" # Try to collect test metadata if any - if egrep "R: test description: " $OUTFILE > /dev/null + if grep -E "R: test description: " $OUTFILE > /dev/null then - TEST_DESCRIPTION="$(egrep "R: test description" $OUTFILE | sed -e "s,.*test description: \([A-Za-z0-9_]*\),\1,")" + TEST_DESCRIPTION="$(grep -E "R: test description" $OUTFILE | sed -e "s,.*test description: \([A-Za-z0-9_]*\),\1,")" fi - if egrep -e "R: test story_id: " $OUTFILE > /dev/null + if grep -E -e "R: test story_id: " $OUTFILE > /dev/null then - TEST_STORY="$(egrep "R: test story_id" $OUTFILE | sed -e "s,.*test story_id: \([0-9][0-9]*\),\1,")" + TEST_STORY="$(grep -E "R: test story_id" $OUTFILE | sed -e "s,.*test story_id: \([0-9][0-9]*\),\1,")" fi - if egrep -e "R: test covers: " $OUTFILE > /dev/null + if grep -E -e "R: test covers: " $OUTFILE > /dev/null then - TEST_COVERS="$(egrep "R: test covers" $OUTFILE | sed -e "s,.*test covers: \([A-Za-z0-9_]*\),\1,")" + TEST_COVERS="$(grep -E "R: test covers" $OUTFILE | sed -e "s,.*test covers: \([A-Za-z0-9_]*\),\1,")" fi if [ $TEST_TYPE = errorexit ] then - if [ $RETVAL -gt 0 ] && [ $RETVAL -lt 128 ] && egrep "error:|aborted on defined class" $OUTFILE > /dev/null + if [ $RETVAL -gt 0 ] && [ $RETVAL -lt 128 ] && grep -E "error:|aborted on defined class" $OUTFILE > /dev/null then RESULT=Pass RESULT_MSG="${COLOR_SUCCESS}Pass${COLOR_NORMAL}" @@ -557,7 +557,7 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR then RESULT=FAIL RESULT_MSG="${COLOR_FAILURE}FAIL (NON-ZERO EXIT CODE!)${COLOR_NORMAL}" - elif fgrep 'error: ' "$OUTFILE" > /dev/null + elif grep -F 'error: ' "$OUTFILE" > /dev/null then RESULT=Pass RESULT_MSG="${COLOR_SUCCESS}Pass${COLOR_NORMAL}" @@ -575,21 +575,21 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR # Some states are output by dcs.sub.cf, therefore check for both TEST # prefix and dcs.sub.cf prefix. ESCAPED_TEST="$(echo "($TEST|dcs.sub.cf)" | sed -e 's/\./\\./g')" - if egrep "R: .*$ESCAPED_TEST [XS]FAIL" $OUTFILE > /dev/null && ! egrep "R: .*$ESCAPED_TEST Wait/" $OUTFILE > /dev/null + if grep -E "R: .*$ESCAPED_TEST [XS]FAIL" $OUTFILE > /dev/null && ! grep -E "R: .*$ESCAPED_TEST Wait/" $OUTFILE > /dev/null then # Check for passed outcome, which should not happen. - if egrep "R: .*$ESCAPED_TEST " $OUTFILE | egrep "R: .*$ESCAPED_TEST Pass" > /dev/null + if grep -E "R: .*$ESCAPED_TEST " $OUTFILE | grep -E "R: .*$ESCAPED_TEST Pass" > /dev/null then RESULT=FAIL RESULT_MSG="${COLOR_FAILURE}FAIL (The test Passed, but failure was expected)${COLOR_NORMAL}" - elif egrep "R: .*$ESCAPED_TEST " $OUTFILE | egrep -v "R: .*$ESCAPED_TEST [XS]?FAIL" > /dev/null + elif grep -E "R: .*$ESCAPED_TEST " $OUTFILE | grep -E -v "R: .*$ESCAPED_TEST [XS]?FAIL" > /dev/null then # Other test case outcomes than fail. Should not happen. RESULT=FAIL RESULT_MSG="${COLOR_FAILURE}FAIL (Failure was expected, but the test had an unexpected test outcome, check test output, Pass/FAIL need to match exactly)${COLOR_NORMAL}" else - TICKET="$(egrep "R: .*$ESCAPED_TEST [XS]FAIL" $OUTFILE | sed -e "s,.*[XS]FAIL/\(.*\),\1,")" - RESULT="$(egrep "R: .*$ESCAPED_TEST [XS]FAIL" $OUTFILE | sed -e "s,.*\([XS]FAIL\).*,\1,")" + TICKET="$(grep -E "R: .*$ESCAPED_TEST [XS]FAIL" $OUTFILE | sed -e "s,.*[XS]FAIL/\(.*\),\1,")" + RESULT="$(grep -E "R: .*$ESCAPED_TEST [XS]FAIL" $OUTFILE | sed -e "s,.*\([XS]FAIL\).*,\1,")" if [ "$RESULT" = "XFAIL" ] then RESULT_MSG="${COLOR_WARNING}FAIL (Suppressed, $TICKET)${COLOR_NORMAL}" @@ -600,38 +600,38 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR elif [ $RETVAL -ne 0 ] then RESULT=FAIL - elif egrep "R: .*$ESCAPED_TEST FAIL/no_ticket_number" $OUTFILE > /dev/null + elif grep -E "R: .*$ESCAPED_TEST FAIL/no_ticket_number" $OUTFILE > /dev/null then RESULT=FAIL RESULT_MSG="${COLOR_FAILURE}FAIL (Tried to suppress failure, but no issue number is provided)${COLOR_NORMAL}" - elif egrep "R: .*$ESCAPED_TEST Wait/[0-9]+" $OUTFILE > /dev/null + elif grep -E "R: .*$ESCAPED_TEST Wait/[0-9]+" $OUTFILE > /dev/null then if [ -z "$NEXT_TIMEOUT_VAR" ] then RESULT=FAIL RESULT_MSG="${COLOR_FAILURE}FAIL (Test tried to wait but is not in \"timed\" directory)${COLOR_NORMAL}" else - WAIT_TIME=$(egrep "R: .*$ESCAPED_TEST Wait/[0-9]+" $OUTFILE | sed -e 's,.*Wait/\([0-9][0-9]*\).*,\1,') + WAIT_TIME=$(grep -E "R: .*$ESCAPED_TEST Wait/[0-9]+" $OUTFILE | sed -e 's,.*Wait/\([0-9][0-9]*\).*,\1,') eval $NEXT_TIMEOUT_VAR=$(($TEST_END_TIME+$WAIT_TIME)) RESULT=Wait RESULT_MSG="Awaiting ($WAIT_TIME seconds)..." fi - elif egrep "R: .*$ESCAPED_TEST Pass" $OUTFILE > /dev/null + elif grep -E "R: .*$ESCAPED_TEST Pass" $OUTFILE > /dev/null then RESULT=Pass RESULT_MSG="${COLOR_SUCCESS}Pass${COLOR_NORMAL}" - elif egrep "R: .*$ESCAPED_TEST Skip/unsupported" $OUTFILE > /dev/null + elif grep -E "R: .*$ESCAPED_TEST Skip/unsupported" $OUTFILE > /dev/null then RESULT=Skip RESULT_MSG="${COLOR_WARNING}Skipped (No platform support)${COLOR_NORMAL}" - elif egrep "R: .*$ESCAPED_TEST Skip/needs_work" $OUTFILE > /dev/null + elif grep -E "R: .*$ESCAPED_TEST Skip/needs_work" $OUTFILE > /dev/null then RESULT=Skip RESULT_MSG="${COLOR_WARNING}Skipped (Test needs work)${COLOR_NORMAL}" - elif egrep "R: .*$ESCAPED_TEST FLAKEY" $OUTFILE > /dev/null + elif grep -E "R: .*$ESCAPED_TEST FLAKEY" $OUTFILE > /dev/null then RESULT=FLAKEY - TICKET="$(egrep "R: .*$ESCAPED_TEST FLAKEY" $OUTFILE | sed -e "s,.*FLAKEY/\(.*\),\1,")" + TICKET="$(grep -E "R: .*$ESCAPED_TEST FLAKEY" $OUTFILE | sed -e "s,.*FLAKEY/\(.*\),\1,")" RESULT_MSG="${COLOR_WARNING}Flakey fail ($TICKET)${COLOR_NORMAL}" else @@ -1075,7 +1075,7 @@ fi for addtest in $ALL_TESTS do - if echo "$addtest" | fgrep "/timed/" > /dev/null + if echo "$addtest" | grep -F "/timed/" > /dev/null then if [ "$TIMED_TESTS" = 1 ] then @@ -1133,12 +1133,12 @@ print_header() { print_footer() { # Recalculate results since sub invocations may not have been recorded. - PASSED_TESTS=`egrep '^Pass ' $SUMMARY | wc -l | tr -d ' '` - FAILED_TESTS=`egrep '^(FAIL|XFAIL) ' $SUMMARY | wc -l | tr -d ' '` - SUPPRESSED_FAILURES=`egrep '^XFAIL ' $SUMMARY | wc -l | tr -d ' '` - SOFT_FAILURES=`egrep '^SFAIL ' $SUMMARY | wc -l | tr -d ' '` - FLAKEY_FAILURES=`egrep '^FLAKEY ' $SUMMARY | wc -l | tr -d ' '` - SKIPPED_TESTS=`egrep '^Skip ' $SUMMARY | wc -l | tr -d ' '` + PASSED_TESTS=`grep -E '^Pass ' $SUMMARY | wc -l | tr -d ' '` + FAILED_TESTS=`grep -E '^(FAIL|XFAIL) ' $SUMMARY | wc -l | tr -d ' '` + SUPPRESSED_FAILURES=`grep -E '^XFAIL ' $SUMMARY | wc -l | tr -d ' '` + SOFT_FAILURES=`grep -E '^SFAIL ' $SUMMARY | wc -l | tr -d ' '` + FLAKEY_FAILURES=`grep -E '^FLAKEY ' $SUMMARY | wc -l | tr -d ' '` + SKIPPED_TESTS=`grep -E '^Skip ' $SUMMARY | wc -l | tr -d ' '` ( echo echo ====================================================================== From 3a41e76f331c5163fdb0e2317b68c075ae193288 Mon Sep 17 00:00:00 2001 From: Sara Thon Date: Tue, 25 Aug 2026 14:02:20 +0200 Subject: [PATCH 03/22] CFE-3041: change regular acceptance test to .error.cf Ticket: CFE-3041 (cherry picked from commit 45ee4a06886aa29d96d1ed2ace82f304447f9564) --- tests/acceptance/00_basics/03_bodies/{112.cf => 112.error.cf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/acceptance/00_basics/03_bodies/{112.cf => 112.error.cf} (100%) diff --git a/tests/acceptance/00_basics/03_bodies/112.cf b/tests/acceptance/00_basics/03_bodies/112.error.cf similarity index 100% rename from tests/acceptance/00_basics/03_bodies/112.cf rename to tests/acceptance/00_basics/03_bodies/112.error.cf From fdc5863bbc5f4eda0928d8007fd83f384c7311b4 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 7 Oct 2026 14:47:31 +0200 Subject: [PATCH 04/22] Added new type of test to testall - errorpass Signed-off-by: Ole Herman Schumacher Elgesem (cherry picked from commit 0a625700e2dc90c864f17dd27f4b503e6d78396c) --- tests/acceptance/testall | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/testall b/tests/acceptance/testall index 4166191fe56..02de29d2b38 100755 --- a/tests/acceptance/testall +++ b/tests/acceptance/testall @@ -323,9 +323,11 @@ runtest() { case "$TEST" in *.x.cf) TEST_TYPE=errorexit && - EXTRATEXT='(should exit with non-zero, but not crash)' ;; + EXTRATEXT='(should exit with non-zero, but not crash. Printing pass or fail is irrelevant)' ;; *.error.cf) TEST_TYPE=errorlog && - EXTRATEXT='(should log error(s), but exit with 0)' ;; + EXTRATEXT='(should log error(s), but exit with 0. Printing pass or fail is irrelevant)' ;; + *.error.pass.cf) TEST_TYPE=errorpass && + EXTRATEXT='(should log error(s), print pass message and, exit with 0)' ;; */staging/*) TEST_TYPE=staging ;; */unsafe/*) TEST_TYPE=unsafe ;; */network/*) TEST_TYPE=network ;; @@ -565,6 +567,24 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR RESULT=FAIL RESULT_MSG="${COLOR_FAILURE}FAIL (No errors printed)${COLOR_NORMAL}" fi + elif [ $TEST_TYPE = errorpass ] + then + if [ $RETVAL != 0 ] + then + RESULT=FAIL + RESULT_MSG="${COLOR_FAILURE}FAIL (NON-ZERO EXIT CODE!)${COLOR_NORMAL}" + elif ! grep -F 'error: ' "$OUTFILE" > /dev/null + then + RESULT=FAIL + RESULT_MSG="${COLOR_FAILURE}FAIL (No error message!)${COLOR_NORMAL}" + elif ! grep -E "R: .*$ESCAPED_TEST Pass" $OUTFILE > /dev/null + then + RESULT=FAIL + RESULT_MSG="${COLOR_FAILURE}FAIL (Pass not printed!)${COLOR_NORMAL}" + else + RESULT=Pass + RESULT_MSG="${COLOR_SUCCESS}Pass${COLOR_NORMAL}" + fi else # TEST_TYPE is not errorlog or errorexit # We need to be careful when matching test outcomes. Because of convergence # passes, a test may output FAIL before it outputs Pass; in this case the From 9b05468eff36c21a9809873a5c3ada5c3397b019 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 7 Oct 2026 14:48:37 +0200 Subject: [PATCH 05/22] Moved acceptance test to error.pass.cf test Signed-off-by: Ole Herman Schumacher Elgesem (cherry picked from commit 0f7d959e0ae5ffbaeb589cad567f3c1b642dabe8) --- .../00_basics/03_bodies/{112.error.cf => 112.error.pass.cf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/acceptance/00_basics/03_bodies/{112.error.cf => 112.error.pass.cf} (100%) diff --git a/tests/acceptance/00_basics/03_bodies/112.error.cf b/tests/acceptance/00_basics/03_bodies/112.error.pass.cf similarity index 100% rename from tests/acceptance/00_basics/03_bodies/112.error.cf rename to tests/acceptance/00_basics/03_bodies/112.error.pass.cf From 1b842fd046008a69d34257bb921f9760e8b043b3 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 7 Oct 2026 16:55:47 +0200 Subject: [PATCH 06/22] Fix errorpass test(?) Signed-off-by: Ole Herman Schumacher Elgesem (cherry picked from commit 453630a331db9f1815431b0cfe1459f27bb6b958) --- tests/acceptance/testall | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/testall b/tests/acceptance/testall index 02de29d2b38..2773f6aab4b 100755 --- a/tests/acceptance/testall +++ b/tests/acceptance/testall @@ -256,7 +256,7 @@ usage() { echo " defaults to $DEFLIBTOOL." echo " --include Include the file or directory given in the workdir before the test" echo " starts. This option may be given several times." - echo " --tests=common,network,serial,timed,slow,errorexit,errorlog,libxml2,libcurl" + echo " --tests=common,network,serial,timed,slow,errorexit,errorlog,errorpass,libxml2,libcurl" echo " This is the default value, you can also add from the following:" echo " unsafe,staging" echo " NOTE: 'staging' tests are not expected to pass" @@ -345,6 +345,10 @@ runtest() { then SKIP=1 SKIPREASON="${COLOR_WARNING}'errorexit' tests are disabled${COLOR_NORMAL}" + elif [ $ERRORPASS_TESTS = 0 -a $TEST_TYPE = errorpass ] + then + SKIP=1 + SKIPREASON="${COLOR_WARNING}'errorpass' tests are disabled${COLOR_NORMAL}" elif [ $ERRORLOG_TESTS = 0 -a $TEST_TYPE = errorlog ] then SKIP=1 @@ -569,6 +573,7 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR fi elif [ $TEST_TYPE = errorpass ] then + ESCAPED_TEST="$(echo "($TEST|dcs.sub.cf)" | sed -e 's/\./\\./g')" if [ $RETVAL != 0 ] then RESULT=FAIL @@ -585,7 +590,7 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR RESULT=Pass RESULT_MSG="${COLOR_SUCCESS}Pass${COLOR_NORMAL}" fi - else # TEST_TYPE is not errorlog or errorexit + else # TEST_TYPE is not errorlog or errorexit or errorpass # We need to be careful when matching test outcomes. Because of convergence # passes, a test may output FAIL before it outputs Pass; in this case the # latter trumps the former. Also be careful when matching an [XS]FAIL; the @@ -834,6 +839,7 @@ do SLOW_TESTS=0 ERROREXIT_TESTS=0 ERRORLOG_TESTS=0 + ERRORPASS_TESTS=0 SERIAL_TESTS=0 NETWORK_TESTS=0 LIBXML2_TESTS=0 @@ -850,6 +856,7 @@ do slow) SLOW_TESTS=1;; errorexit) ERROREXIT_TESTS=1;; errorlog) ERRORLOG_TESTS=1;; + errorpass) ERRORPASS_TESTS=1;; serial) SERIAL_TESTS=1;; network) NETWORK_TESTS=1;; libxml2) LIBXML2_TESTS=1;; From 811c86beb3a16e9892a46624c48638bb3f939c88 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 7 Oct 2026 17:07:49 +0200 Subject: [PATCH 07/22] Enabled errorpass tests in GH Actions Signed-off-by: Ole Herman Schumacher Elgesem (cherry picked from commit 1bafc0c22ed63a1a479437bb829a9b7d53b0adec) --- .github/workflows/acceptance_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acceptance_tests.yml b/.github/workflows/acceptance_tests.yml index 6e1d1a7ba89..31ef03c8b31 100644 --- a/.github/workflows/acceptance_tests.yml +++ b/.github/workflows/acceptance_tests.yml @@ -20,4 +20,4 @@ jobs: run: | cd tests/acceptance chmod -R go-w . - ./testall --printlog --tests=common,errorlog,errorexit + ./testall --printlog --tests=common,errorlog,errorexit,errorpass From d9c9d417df26f87d67a666612a8eb0da68309a7e Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Wed, 14 Oct 2026 15:18:53 +0300 Subject: [PATCH 08/22] Made testall fail regular acceptance tests which log errors Tests that print Pass message but have logs errors will fail with `FAIL (Error printed)` message. Tests which are expected to log errors should use `.error.cf` or `.error.pass.cf` suffix. see: `tests/acceptance/README` Ticket: CFE-3041 Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit 23ba79719ee50f4f01fa6605f645f1c4ad68d38b) --- tests/acceptance/README | 7 +++++++ tests/acceptance/testall | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/acceptance/README b/tests/acceptance/README index 2435b57b224..b192cb5995c 100644 --- a/tests/acceptance/README +++ b/tests/acceptance/README @@ -113,6 +113,13 @@ case letters and underscores only. If the test is expected to generate an error additional '.x' suffix before '.cf' (e.g. 'string_vars.x.cf'). A crash will still cause a failure. +Regular tests (without any special suffix) fail if they log any errors, even +if they print the Pass message. If the test is expected to log errors (e.g. it +contains promises which are intentionally not kept), it should have an +additional '.error' suffix before '.cf' (e.g. 'bad_perms.error.cf'), in which +case it passes as long as it logs at least one error and exits with 0. If it +should also print the Pass message, use the '.error.pass.cf' suffix instead. + Tests which are not expected to pass yet (e.g. there is a bug in code which prevents tests from passing) should be placed in 'staging' subdirectory in the test directory where they belong. Such test cases will be only run if --staging diff --git a/tests/acceptance/testall b/tests/acceptance/testall index 2773f6aab4b..bac12595d0c 100755 --- a/tests/acceptance/testall +++ b/tests/acceptance/testall @@ -215,6 +215,8 @@ usage() { echo "If no test is given, all standard tests are run:" echo " Tests with names of form .cf are expected to run successfully" echo " Tests with names of form .x.cf are expected to exit with error" + echo " Tests with names of form .error.cf are expected to log error(s) and exit with 0" + echo " Tests with names of form .error.pass.cf are expected to log error(s), pass and exit with 0" echo "Set ${COLOR_SUCCESS}CFENGINE_COLOR=1${COLOR_NORMAL} to get ANSI color markers where appropriate." echo echo "If arguments are given, those are executed as tests" @@ -643,8 +645,16 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR fi elif grep -E "R: .*$ESCAPED_TEST Pass" $OUTFILE > /dev/null then - RESULT=Pass - RESULT_MSG="${COLOR_SUCCESS}Pass${COLOR_NORMAL}" + # Regular tests must not log errors, tests which are expected + # to log errors should be named *.error.cf or *.error.pass.cf + if grep -E '^ *error: ' $OUTFILE > /dev/null + then + RESULT=FAIL + RESULT_MSG="${COLOR_FAILURE}FAIL (Error printed)${COLOR_NORMAL}" + else + RESULT=Pass + RESULT_MSG="${COLOR_SUCCESS}Pass${COLOR_NORMAL}" + fi elif grep -E "R: .*$ESCAPED_TEST Skip/unsupported" $OUTFILE > /dev/null then RESULT=Skip From 51c5439d394f835911a5184d9c08e56f70337851 Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Thu, 15 Oct 2026 14:21:10 +0300 Subject: [PATCH 09/22] Added fileexists() guards to file reads in acceptance tests These tests read files created by their own init bundle, but pre-evaluation calls the read functions before the files exist, logging "Could not examine file" errors which now fail regular tests. Ticket: CFE-3041 Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit 97d424941676d040abdcc1c1b561e6a5a51d73fe) --- .../01_vars/01_basic/this_promiser_with_readjson.cf | 3 ++- tests/acceptance/01_vars/02_functions/011.cf | 3 ++- tests/acceptance/01_vars/02_functions/012.cf | 3 ++- tests/acceptance/01_vars/02_functions/013.cf | 3 ++- tests/acceptance/01_vars/02_functions/014.cf | 3 ++- tests/acceptance/01_vars/02_functions/015.cf | 3 ++- tests/acceptance/01_vars/02_functions/016.cf | 3 ++- tests/acceptance/01_vars/02_functions/017.cf | 3 ++- tests/acceptance/01_vars/02_functions/018.cf | 3 ++- tests/acceptance/01_vars/02_functions/019.cf | 3 ++- tests/acceptance/01_vars/02_functions/020.cf | 3 ++- tests/acceptance/01_vars/02_functions/021.cf | 3 ++- tests/acceptance/01_vars/02_functions/024.cf | 3 ++- tests/acceptance/01_vars/02_functions/025.cf | 3 ++- tests/acceptance/01_vars/02_functions/026.cf | 3 ++- tests/acceptance/01_vars/02_functions/027.cf | 3 ++- tests/acceptance/01_vars/02_functions/028.cf | 3 ++- tests/acceptance/01_vars/02_functions/029.cf | 3 ++- tests/acceptance/01_vars/02_functions/030.cf | 3 ++- tests/acceptance/01_vars/02_functions/031.cf | 3 ++- tests/acceptance/01_vars/02_functions/032.cf | 3 ++- tests/acceptance/01_vars/02_functions/033.cf | 3 ++- tests/acceptance/01_vars/02_functions/034.cf | 3 ++- tests/acceptance/01_vars/02_functions/037.cf | 3 ++- tests/acceptance/01_vars/02_functions/038.cf | 3 ++- tests/acceptance/01_vars/02_functions/039.cf | 3 ++- tests/acceptance/01_vars/02_functions/040.cf | 3 ++- tests/acceptance/01_vars/02_functions/041.cf | 3 ++- tests/acceptance/01_vars/02_functions/042.cf | 3 ++- tests/acceptance/01_vars/02_functions/043.cf | 3 ++- tests/acceptance/01_vars/02_functions/044.cf | 3 ++- tests/acceptance/01_vars/02_functions/045.cf | 3 ++- tests/acceptance/01_vars/02_functions/046.cf | 3 ++- tests/acceptance/01_vars/02_functions/047.cf | 3 ++- tests/acceptance/01_vars/02_functions/050.cf | 3 ++- tests/acceptance/01_vars/02_functions/400.cf | 3 ++- tests/acceptance/01_vars/02_functions/401.cf | 3 ++- tests/acceptance/01_vars/02_functions/410.cf | 3 ++- tests/acceptance/01_vars/02_functions/420.cf | 3 ++- tests/acceptance/01_vars/02_functions/421.cf | 3 ++- tests/acceptance/01_vars/02_functions/440.cf | 3 ++- tests/acceptance/01_vars/02_functions/441.cf | 3 ++- tests/acceptance/01_vars/02_functions/442.cf | 3 ++- tests/acceptance/01_vars/02_functions/443.cf | 3 ++- tests/acceptance/01_vars/02_functions/444.cf | 3 ++- tests/acceptance/01_vars/02_functions/445.cf | 3 ++- tests/acceptance/01_vars/02_functions/447.cf | 3 ++- tests/acceptance/01_vars/02_functions/450.cf | 3 ++- tests/acceptance/01_vars/02_functions/500.cf | 3 ++- tests/acceptance/01_vars/02_functions/501.cf | 3 ++- tests/acceptance/01_vars/02_functions/520.cf | 3 ++- tests/acceptance/01_vars/02_functions/521.cf | 3 ++- tests/acceptance/01_vars/02_functions/600.cf | 3 ++- tests/acceptance/01_vars/02_functions/601.cf | 3 ++- tests/acceptance/01_vars/02_functions/620.cf | 3 ++- tests/acceptance/01_vars/02_functions/621.cf | 3 ++- .../01_vars/02_functions/classfilterdata_collecting.cf | 3 ++- .../01_vars/02_functions/long_string_from_text_file.cf | 3 ++- ...sestringarray_dontread_comment_duplicate_lastline2.cf | 3 ++- ...ngarray_weird_indices_real_comments_noemptyfields2.cf | 3 ++- tests/acceptance/01_vars/02_functions/peers.cf | 9 ++++++--- tests/acceptance/01_vars/02_functions/read_empty_file.cf | 6 ++++-- ...stringarray_dontread_comment_duplicatekey_lastline.cf | 3 ++- .../01_vars/02_functions/readstringarrayidx_order.cf | 3 ++- tests/acceptance/01_vars/04_containers/readjson.cf | 3 ++- .../acceptance/01_vars/04_containers/readjson_arrays.cf | 3 ++- tests/acceptance/01_vars/04_containers/readjson_new.cf | 3 ++- tests/acceptance/01_vars/04_containers/readjson_null.cf | 3 ++- .../acceptance/01_vars/04_containers/readjson_objects.cf | 3 ++- .../acceptance/01_vars/04_containers/readjson_scalar.cf | 3 ++- .../01_vars/04_containers/readjson_subindex.cf | 3 ++- .../01_vars/04_containers/readjson_subindex_quoted.cf | 3 ++- tests/acceptance/08_commands/arglist.cf | 3 ++- .../09_insert_lines/preserve_block_blank_lines.cf | 3 ++- .../10_files/templating/empty_template_empty_file.cf | 3 ++- tests/acceptance/10_files/templating/mustache_abuse.cf | 3 ++- .../10_files/templating/mustache_datastate_demo.cf | 3 ++- tests/acceptance/10_files/templating/mustache_demo.cf | 3 ++- .../templating/mustache_expect_list_find_string.cf | 6 ++++-- .../10_files/templating/mustache_html_escape.cf | 3 ++- .../10_files/templating/mustache_inline_demo.cf | 3 ++- .../10_files/templating/mustache_render_quote.cf | 3 ++- .../10_files/templating/mustache_repair_existing.cf | 3 ++- tests/acceptance/31_tickets/CFE-3866/test.cf | 3 ++- 84 files changed, 176 insertions(+), 88 deletions(-) diff --git a/tests/acceptance/01_vars/01_basic/this_promiser_with_readjson.cf b/tests/acceptance/01_vars/01_basic/this_promiser_with_readjson.cf index 60cfff7563f..4d7d32a549b 100644 --- a/tests/acceptance/01_vars/01_basic/this_promiser_with_readjson.cf +++ b/tests/acceptance/01_vars/01_basic/this_promiser_with_readjson.cf @@ -26,7 +26,8 @@ bundle agent test { vars: "cf_promises_validated" - data => readjson("$(G.testfile).$(this.promiser)", 1K); + data => readjson("$(G.testfile).$(this.promiser)", 1K), + if => fileexists("$(G.testfile).$(this.promiser)"); "printable" string => format("%S", "cf_promises_validated"); diff --git a/tests/acceptance/01_vars/02_functions/011.cf b/tests/acceptance/01_vars/02_functions/011.cf index 0405b37d51a..93a5a1c3384 100644 --- a/tests/acceptance/01_vars/02_functions/011.cf +++ b/tests/acceptance/01_vars/02_functions/011.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/012.cf b/tests/acceptance/01_vars/02_functions/012.cf index 6ace98654cb..55de4ce5573 100644 --- a/tests/acceptance/01_vars/02_functions/012.cf +++ b/tests/acceptance/01_vars/02_functions/012.cf @@ -38,7 +38,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/013.cf b/tests/acceptance/01_vars/02_functions/013.cf index 1708bbaddc0..4e493478c13 100644 --- a/tests/acceptance/01_vars/02_functions/013.cf +++ b/tests/acceptance/01_vars/02_functions/013.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/014.cf b/tests/acceptance/01_vars/02_functions/014.cf index 716e8873390..c981a70bac4 100644 --- a/tests/acceptance/01_vars/02_functions/014.cf +++ b/tests/acceptance/01_vars/02_functions/014.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\.", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\.", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/015.cf b/tests/acceptance/01_vars/02_functions/015.cf index c515ba037d5..f96df7ab224 100644 --- a/tests/acceptance/01_vars/02_functions/015.cf +++ b/tests/acceptance/01_vars/02_functions/015.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/016.cf b/tests/acceptance/01_vars/02_functions/016.cf index 0688544a875..2b7482ddb8f 100644 --- a/tests/acceptance/01_vars/02_functions/016.cf +++ b/tests/acceptance/01_vars/02_functions/016.cf @@ -38,7 +38,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/017.cf b/tests/acceptance/01_vars/02_functions/017.cf index b9cfa15a1bc..0b15619d31e 100644 --- a/tests/acceptance/01_vars/02_functions/017.cf +++ b/tests/acceptance/01_vars/02_functions/017.cf @@ -38,7 +38,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/018.cf b/tests/acceptance/01_vars/02_functions/018.cf index d72de43df26..4173999135b 100644 --- a/tests/acceptance/01_vars/02_functions/018.cf +++ b/tests/acceptance/01_vars/02_functions/018.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/019.cf b/tests/acceptance/01_vars/02_functions/019.cf index 6b1af5b6871..d269fda0c69 100644 --- a/tests/acceptance/01_vars/02_functions/019.cf +++ b/tests/acceptance/01_vars/02_functions/019.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "X", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "X", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/020.cf b/tests/acceptance/01_vars/02_functions/020.cf index cc59c326708..3a1a1fe0723 100644 --- a/tests/acceptance/01_vars/02_functions/020.cf +++ b/tests/acceptance/01_vars/02_functions/020.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/021.cf b/tests/acceptance/01_vars/02_functions/021.cf index 8032a987cc5..f62d85462bb 100644 --- a/tests/acceptance/01_vars/02_functions/021.cf +++ b/tests/acceptance/01_vars/02_functions/021.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", ",", 5, 100); + "nums" slist => readstringlist("$(G.testfile)", "NoComment", ",", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/024.cf b/tests/acceptance/01_vars/02_functions/024.cf index 74df030785c..6f7382d12d2 100644 --- a/tests/acceptance/01_vars/02_functions/024.cf +++ b/tests/acceptance/01_vars/02_functions/024.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/025.cf b/tests/acceptance/01_vars/02_functions/025.cf index 3d6351e52c1..4c7c07f1079 100644 --- a/tests/acceptance/01_vars/02_functions/025.cf +++ b/tests/acceptance/01_vars/02_functions/025.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/026.cf b/tests/acceptance/01_vars/02_functions/026.cf index 50b0cf1ec32..5e0ea912cc8 100644 --- a/tests/acceptance/01_vars/02_functions/026.cf +++ b/tests/acceptance/01_vars/02_functions/026.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/027.cf b/tests/acceptance/01_vars/02_functions/027.cf index 55a80306d4f..75e7c539cd5 100644 --- a/tests/acceptance/01_vars/02_functions/027.cf +++ b/tests/acceptance/01_vars/02_functions/027.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\.", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\.", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/028.cf b/tests/acceptance/01_vars/02_functions/028.cf index 322b4fa70a3..850cbb5fc44 100644 --- a/tests/acceptance/01_vars/02_functions/028.cf +++ b/tests/acceptance/01_vars/02_functions/028.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/029.cf b/tests/acceptance/01_vars/02_functions/029.cf index 3a746744265..b15d19dcffa 100644 --- a/tests/acceptance/01_vars/02_functions/029.cf +++ b/tests/acceptance/01_vars/02_functions/029.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/030.cf b/tests/acceptance/01_vars/02_functions/030.cf index c5e438f364f..3938eda2acb 100644 --- a/tests/acceptance/01_vars/02_functions/030.cf +++ b/tests/acceptance/01_vars/02_functions/030.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/031.cf b/tests/acceptance/01_vars/02_functions/031.cf index d40f59a1035..dd199a7d122 100644 --- a/tests/acceptance/01_vars/02_functions/031.cf +++ b/tests/acceptance/01_vars/02_functions/031.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/032.cf b/tests/acceptance/01_vars/02_functions/032.cf index 742c4e4f0b2..2c0d4cf6c0f 100644 --- a/tests/acceptance/01_vars/02_functions/032.cf +++ b/tests/acceptance/01_vars/02_functions/032.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "X", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "X", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/033.cf b/tests/acceptance/01_vars/02_functions/033.cf index e90f323f897..7e3a5d367d3 100644 --- a/tests/acceptance/01_vars/02_functions/033.cf +++ b/tests/acceptance/01_vars/02_functions/033.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/034.cf b/tests/acceptance/01_vars/02_functions/034.cf index e9d1dbfafcf..38abced469c 100644 --- a/tests/acceptance/01_vars/02_functions/034.cf +++ b/tests/acceptance/01_vars/02_functions/034.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", ",", 5, 100); + "nums" ilist => readintlist("$(G.testfile)", "NoComment", ",", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/037.cf b/tests/acceptance/01_vars/02_functions/037.cf index 770c373c58c..6e65a785ceb 100644 --- a/tests/acceptance/01_vars/02_functions/037.cf +++ b/tests/acceptance/01_vars/02_functions/037.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/038.cf b/tests/acceptance/01_vars/02_functions/038.cf index 26eabcf4638..4fc8fb18a79 100644 --- a/tests/acceptance/01_vars/02_functions/038.cf +++ b/tests/acceptance/01_vars/02_functions/038.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/039.cf b/tests/acceptance/01_vars/02_functions/039.cf index 53dd4046be4..6f72f753c8c 100644 --- a/tests/acceptance/01_vars/02_functions/039.cf +++ b/tests/acceptance/01_vars/02_functions/039.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/040.cf b/tests/acceptance/01_vars/02_functions/040.cf index 3ba0f3c2dba..4c10aaa8d9d 100644 --- a/tests/acceptance/01_vars/02_functions/040.cf +++ b/tests/acceptance/01_vars/02_functions/040.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/041.cf b/tests/acceptance/01_vars/02_functions/041.cf index 61608635fd5..7fefc1cb209 100644 --- a/tests/acceptance/01_vars/02_functions/041.cf +++ b/tests/acceptance/01_vars/02_functions/041.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/042.cf b/tests/acceptance/01_vars/02_functions/042.cf index ee96964fae0..a1e160b2a42 100644 --- a/tests/acceptance/01_vars/02_functions/042.cf +++ b/tests/acceptance/01_vars/02_functions/042.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/043.cf b/tests/acceptance/01_vars/02_functions/043.cf index 7a9427aed85..54b5bff2c65 100644 --- a/tests/acceptance/01_vars/02_functions/043.cf +++ b/tests/acceptance/01_vars/02_functions/043.cf @@ -37,7 +37,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/044.cf b/tests/acceptance/01_vars/02_functions/044.cf index 6b0e85e0c7f..a28458dcc12 100644 --- a/tests/acceptance/01_vars/02_functions/044.cf +++ b/tests/acceptance/01_vars/02_functions/044.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/045.cf b/tests/acceptance/01_vars/02_functions/045.cf index 0cddcd75623..4aaa3c1fd7f 100644 --- a/tests/acceptance/01_vars/02_functions/045.cf +++ b/tests/acceptance/01_vars/02_functions/045.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "X", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "X", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/046.cf b/tests/acceptance/01_vars/02_functions/046.cf index 41a076f5609..251535cd8bb 100644 --- a/tests/acceptance/01_vars/02_functions/046.cf +++ b/tests/acceptance/01_vars/02_functions/046.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/047.cf b/tests/acceptance/01_vars/02_functions/047.cf index c8c73e774ed..b6b1384ee9b 100644 --- a/tests/acceptance/01_vars/02_functions/047.cf +++ b/tests/acceptance/01_vars/02_functions/047.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", ",", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", ",", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/050.cf b/tests/acceptance/01_vars/02_functions/050.cf index b0d9b0b64db..b53302a9df0 100644 --- a/tests/acceptance/01_vars/02_functions/050.cf +++ b/tests/acceptance/01_vars/02_functions/050.cf @@ -36,7 +36,8 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100); + "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100), + if => fileexists("$(G.testfile)"); "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/400.cf b/tests/acceptance/01_vars/02_functions/400.cf index bc6edf6d783..da20512b37c 100644 --- a/tests/acceptance/01_vars/02_functions/400.cf +++ b/tests/acceptance/01_vars/02_functions/400.cf @@ -45,7 +45,8 @@ bundle agent test "cnt" int => readstringarray( "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 - ); + ), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/401.cf b/tests/acceptance/01_vars/02_functions/401.cf index fd2f2da1be3..f06d4999a61 100644 --- a/tests/acceptance/01_vars/02_functions/401.cf +++ b/tests/acceptance/01_vars/02_functions/401.cf @@ -45,7 +45,8 @@ bundle agent test "cnt" int => readstringarray( "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 - ); + ), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/410.cf b/tests/acceptance/01_vars/02_functions/410.cf index 2937dd75310..e05695088a1 100644 --- a/tests/acceptance/01_vars/02_functions/410.cf +++ b/tests/acceptance/01_vars/02_functions/410.cf @@ -48,7 +48,8 @@ body delete init_delete bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)", "^#.*", ":+", 10, 14); + "cnt" int => readstringarray("ary", "$(G.testfile)", "^#.*", ":+", 10, 14), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/420.cf b/tests/acceptance/01_vars/02_functions/420.cf index 634072f50f1..122a91e0c22 100644 --- a/tests/acceptance/01_vars/02_functions/420.cf +++ b/tests/acceptance/01_vars/02_functions/420.cf @@ -42,7 +42,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000); + "teststr" string => readfile("$(G.testfile)", 1000), + if => fileexists("$(G.testfile)"); "cnt" int => parsestringarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); diff --git a/tests/acceptance/01_vars/02_functions/421.cf b/tests/acceptance/01_vars/02_functions/421.cf index 9891f76758a..9c5fb087d24 100644 --- a/tests/acceptance/01_vars/02_functions/421.cf +++ b/tests/acceptance/01_vars/02_functions/421.cf @@ -42,7 +42,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000); + "teststr" string => readfile("$(G.testfile)", 1000), + if => fileexists("$(G.testfile)"); "cnt" int => parsestringarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); diff --git a/tests/acceptance/01_vars/02_functions/440.cf b/tests/acceptance/01_vars/02_functions/440.cf index 3ffe141d7b8..93c2839d1c8 100644 --- a/tests/acceptance/01_vars/02_functions/440.cf +++ b/tests/acceptance/01_vars/02_functions/440.cf @@ -45,7 +45,8 @@ bundle agent test "cnt" int => readstringarrayidx( "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 - ); + ), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/441.cf b/tests/acceptance/01_vars/02_functions/441.cf index 3a71cff5cd7..639d1e48cc5 100644 --- a/tests/acceptance/01_vars/02_functions/441.cf +++ b/tests/acceptance/01_vars/02_functions/441.cf @@ -45,7 +45,8 @@ bundle agent test "cnt" int => readstringarrayidx( "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 - ); + ), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/442.cf b/tests/acceptance/01_vars/02_functions/442.cf index 284a6f7357c..bd9d0ae93fb 100644 --- a/tests/acceptance/01_vars/02_functions/442.cf +++ b/tests/acceptance/01_vars/02_functions/442.cf @@ -46,7 +46,8 @@ bundle agent test "cnt" int => readstringarrayidx( "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 - ); + ), + if => fileexists("$(G.testfile)"); "num" int => "4"; } diff --git a/tests/acceptance/01_vars/02_functions/443.cf b/tests/acceptance/01_vars/02_functions/443.cf index 5663b905fb1..ef4bd364ef4 100644 --- a/tests/acceptance/01_vars/02_functions/443.cf +++ b/tests/acceptance/01_vars/02_functions/443.cf @@ -53,7 +53,8 @@ bundle agent test "cnt" int => readstringarrayidx( "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 - ); + ), + if => fileexists("$(G.testfile)"); "num" int => "4"; } diff --git a/tests/acceptance/01_vars/02_functions/444.cf b/tests/acceptance/01_vars/02_functions/444.cf index 5e384aabbd9..2a138207d9f 100644 --- a/tests/acceptance/01_vars/02_functions/444.cf +++ b/tests/acceptance/01_vars/02_functions/444.cf @@ -51,7 +51,8 @@ bundle agent test "cnt" int => readstringarrayidx( "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 - ); + ), + if => fileexists("$(G.testfile)"); "num" int => "9"; } diff --git a/tests/acceptance/01_vars/02_functions/445.cf b/tests/acceptance/01_vars/02_functions/445.cf index 82be099cc04..89b95d24738 100644 --- a/tests/acceptance/01_vars/02_functions/445.cf +++ b/tests/acceptance/01_vars/02_functions/445.cf @@ -54,7 +54,8 @@ bundle agent test "cnt" int => readstringarrayidx( "ary", "$(G.testfile)", "NoComment", ":", 10, 1000 - ); + ), + if => fileexists("$(G.testfile)"); "num" int => "9"; } diff --git a/tests/acceptance/01_vars/02_functions/447.cf b/tests/acceptance/01_vars/02_functions/447.cf index 517919c7918..0632d00fc67 100644 --- a/tests/acceptance/01_vars/02_functions/447.cf +++ b/tests/acceptance/01_vars/02_functions/447.cf @@ -48,7 +48,8 @@ body delete init_delete bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)", "", ":", 10, 1000); + "cnt" int => readstringarrayidx("ary", "$(G.testfile)", "", ":", 10, 1000), + if => fileexists("$(G.testfile)"); "num" int => "9"; } diff --git a/tests/acceptance/01_vars/02_functions/450.cf b/tests/acceptance/01_vars/02_functions/450.cf index c850c569dae..d686c41c1db 100644 --- a/tests/acceptance/01_vars/02_functions/450.cf +++ b/tests/acceptance/01_vars/02_functions/450.cf @@ -49,7 +49,8 @@ bundle agent test { vars: "cnt" - int => readstringarrayidx("ary", "$(G.testfile)", "^#.*", ":+", 10, 14); + int => readstringarrayidx("ary", "$(G.testfile)", "^#.*", ":+", 10, 14), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/500.cf b/tests/acceptance/01_vars/02_functions/500.cf index 205241c3089..01148598230 100644 --- a/tests/acceptance/01_vars/02_functions/500.cf +++ b/tests/acceptance/01_vars/02_functions/500.cf @@ -42,7 +42,8 @@ bundle agent test { vars: "cnt" - int => readintarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + int => readintarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/501.cf b/tests/acceptance/01_vars/02_functions/501.cf index 7c3c982d76e..ddaba1ac6e5 100644 --- a/tests/acceptance/01_vars/02_functions/501.cf +++ b/tests/acceptance/01_vars/02_functions/501.cf @@ -42,7 +42,8 @@ bundle agent test { vars: "cnt" - int => readintarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + int => readintarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/520.cf b/tests/acceptance/01_vars/02_functions/520.cf index b54fc402132..d1ab666bce3 100644 --- a/tests/acceptance/01_vars/02_functions/520.cf +++ b/tests/acceptance/01_vars/02_functions/520.cf @@ -41,7 +41,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000); + "teststr" string => readfile("$(G.testfile)", 1000), + if => fileexists("$(G.testfile)"); "cnt" int => parseintarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/521.cf b/tests/acceptance/01_vars/02_functions/521.cf index 12424b904fc..84233e9db8b 100644 --- a/tests/acceptance/01_vars/02_functions/521.cf +++ b/tests/acceptance/01_vars/02_functions/521.cf @@ -41,7 +41,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000); + "teststr" string => readfile("$(G.testfile)", 1000), + if => fileexists("$(G.testfile)"); "cnt" int => parseintarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/600.cf b/tests/acceptance/01_vars/02_functions/600.cf index fb48a433696..b402e6dd99f 100644 --- a/tests/acceptance/01_vars/02_functions/600.cf +++ b/tests/acceptance/01_vars/02_functions/600.cf @@ -42,7 +42,8 @@ bundle agent test { vars: "cnt" - int => readrealarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + int => readrealarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/601.cf b/tests/acceptance/01_vars/02_functions/601.cf index e19a254a1b0..843d72d1219 100644 --- a/tests/acceptance/01_vars/02_functions/601.cf +++ b/tests/acceptance/01_vars/02_functions/601.cf @@ -42,7 +42,8 @@ bundle agent test { vars: "cnt" - int => readrealarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000); + int => readrealarray("ary", "$(G.testfile)", "NoComment", ":", 10, 1000), + if => fileexists("$(G.testfile)"); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/620.cf b/tests/acceptance/01_vars/02_functions/620.cf index 8ce3531136f..50f06d423e9 100644 --- a/tests/acceptance/01_vars/02_functions/620.cf +++ b/tests/acceptance/01_vars/02_functions/620.cf @@ -41,7 +41,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000); + "teststr" string => readfile("$(G.testfile)", 1000), + if => fileexists("$(G.testfile)"); "cnt" int => parserealarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); diff --git a/tests/acceptance/01_vars/02_functions/621.cf b/tests/acceptance/01_vars/02_functions/621.cf index 59d8b7eb462..dc908d968cd 100644 --- a/tests/acceptance/01_vars/02_functions/621.cf +++ b/tests/acceptance/01_vars/02_functions/621.cf @@ -41,7 +41,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000); + "teststr" string => readfile("$(G.testfile)", 1000), + if => fileexists("$(G.testfile)"); "cnt" int => parserealarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); diff --git a/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf b/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf index 88ea0d29e6d..8b2cbc66bc2 100644 --- a/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf +++ b/tests/acceptance/01_vars/02_functions/classfilterdata_collecting.cf @@ -44,7 +44,8 @@ bundle agent test vars: "filtered" - data => classfilterdata(readjson("$(G.testfile).json"), "auto", "if"); + data => classfilterdata(readjson("$(G.testfile).json"), "auto", "if"), + if => fileexists("$(G.testfile).json"); } bundle agent check diff --git a/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf b/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf index 80ecfd7f317..25a0bbce723 100644 --- a/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf +++ b/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf @@ -26,7 +26,8 @@ bundle agent test { vars: "keyfile" string => "$(G.testfile).data"; - "keys" slist => readstringlist("$(keyfile)", "#[^\n]*", "\n", 10, 3072); + "keys" slist => readstringlist("$(keyfile)", "#[^\n]*", "\n", 10, 3072), + if => fileexists("$(keyfile)"); } ####################################################### diff --git a/tests/acceptance/01_vars/02_functions/parsestringarray_dontread_comment_duplicate_lastline2.cf b/tests/acceptance/01_vars/02_functions/parsestringarray_dontread_comment_duplicate_lastline2.cf index 643b67106ba..478a3eb0c63 100644 --- a/tests/acceptance/01_vars/02_functions/parsestringarray_dontread_comment_duplicate_lastline2.cf +++ b/tests/acceptance/01_vars/02_functions/parsestringarray_dontread_comment_duplicate_lastline2.cf @@ -51,7 +51,8 @@ bundle agent test "cnt" int => readstringarrayidx( "ary", "$(G.testfile)", "NoComment", ":", 6, 1000 - ); + ), + if => fileexists("$(G.testfile)"); "num" int => "6"; } diff --git a/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf b/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf index 801e3f09c2a..79539da135d 100644 --- a/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf +++ b/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf @@ -48,7 +48,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000); + "teststr" string => readfile("$(G.testfile)", 1000), + if => fileexists("$(G.testfile)"); "cnt" int => parsestringarray("ary", "$(teststr)", "^#.*", ":+", 10, 14); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/peers.cf b/tests/acceptance/01_vars/02_functions/peers.cf index 5b87f0b1cb4..e99d0373e91 100644 --- a/tests/acceptance/01_vars/02_functions/peers.cf +++ b/tests/acceptance/01_vars/02_functions/peers.cf @@ -56,10 +56,12 @@ bundle agent test "subtests" ilist => { "0", "1", "2", "3", "4", "5" }; "peers_$(tests)_$(subtests)" - slist => peers("$(G.testfile).$(tests)", "#.*", $(subtests)); + slist => peers("$(G.testfile).$(tests)", "#.*", $(subtests)), + if => fileexists("$(G.testfile).$(tests)"); "peerleaders_$(tests)_$(subtests)" - slist => peerleaders("$(G.testfile).$(tests)", "#.*", $(subtests)); + slist => peerleaders("$(G.testfile).$(tests)", "#.*", $(subtests)), + if => fileexists("$(G.testfile).$(tests)"); "actual_peers_$(tests)_$(subtests)" string => format("%S", "peers_$(tests)_$(subtests)"); @@ -68,7 +70,8 @@ bundle agent test string => format("%S", "peerleaders_$(tests)_$(subtests)"); "actual_peerleader_$(tests)_$(subtests)" - string => peerleader("$(G.testfile).$(tests)", "#.*", $(subtests)); + string => peerleader("$(G.testfile).$(tests)", "#.*", $(subtests)), + if => fileexists("$(G.testfile).$(tests)"); } ####################################################### diff --git a/tests/acceptance/01_vars/02_functions/read_empty_file.cf b/tests/acceptance/01_vars/02_functions/read_empty_file.cf index 1ce7d0bb4ca..d1f37354b8a 100644 --- a/tests/acceptance/01_vars/02_functions/read_empty_file.cf +++ b/tests/acceptance/01_vars/02_functions/read_empty_file.cf @@ -15,8 +15,10 @@ bundle agent init bundle agent test { vars: - "value1" string => readfile("$(G.testfile)", 10000); - "value2" string => readfile("$(G.testfile)", 0); + "value1" string => readfile("$(G.testfile)", 10000), + if => fileexists("$(G.testfile)"); + "value2" string => readfile("$(G.testfile)", 0), + if => fileexists("$(G.testfile)"); } bundle agent check diff --git a/tests/acceptance/01_vars/02_functions/readstringarray_dontread_comment_duplicatekey_lastline.cf b/tests/acceptance/01_vars/02_functions/readstringarray_dontread_comment_duplicatekey_lastline.cf index f9339fc69e5..2d9b30cc87b 100644 --- a/tests/acceptance/01_vars/02_functions/readstringarray_dontread_comment_duplicatekey_lastline.cf +++ b/tests/acceptance/01_vars/02_functions/readstringarray_dontread_comment_duplicatekey_lastline.cf @@ -49,7 +49,8 @@ bundle agent test { vars: "cnt" - int => readstringarray("ary", "$(G.testfile)", "NoComment", ":", 6, 1000); + int => readstringarray("ary", "$(G.testfile)", "NoComment", ":", 6, 1000), + if => fileexists("$(G.testfile)"); "num" int => "6"; } diff --git a/tests/acceptance/01_vars/02_functions/readstringarrayidx_order.cf b/tests/acceptance/01_vars/02_functions/readstringarrayidx_order.cf index 3d8236815ee..c8fd1b9a0b5 100644 --- a/tests/acceptance/01_vars/02_functions/readstringarrayidx_order.cf +++ b/tests/acceptance/01_vars/02_functions/readstringarrayidx_order.cf @@ -69,7 +69,8 @@ bundle agent test "num" int => readstringarrayidx( "mylines", "$(G.testfile).orig.txt", "\s*#[^\n]*", "\s*;;\s*", 50, 9999 - ); + ), + if => fileexists("$(G.testfile).orig.txt"); "file" slist => { diff --git a/tests/acceptance/01_vars/04_containers/readjson.cf b/tests/acceptance/01_vars/04_containers/readjson.cf index a4a1998f314..3317af28d2f 100644 --- a/tests/acceptance/01_vars/04_containers/readjson.cf +++ b/tests/acceptance/01_vars/04_containers/readjson.cf @@ -40,7 +40,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024), + if => fileexists("$(G.testfile).json"); files: "$(G.testfile).actual" diff --git a/tests/acceptance/01_vars/04_containers/readjson_arrays.cf b/tests/acceptance/01_vars/04_containers/readjson_arrays.cf index 004676f31d4..bc120e55e8a 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_arrays.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_arrays.cf @@ -43,7 +43,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024), + if => fileexists("$(G.testfile).json"); files: "$(G.testfile).actual" diff --git a/tests/acceptance/01_vars/04_containers/readjson_new.cf b/tests/acceptance/01_vars/04_containers/readjson_new.cf index 6d453e4a67e..a411f6614b9 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_new.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_new.cf @@ -40,7 +40,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json"); + "load" data => readjson("$(G.testfile).json"), + if => fileexists("$(G.testfile).json"); files: "$(G.testfile).actual" diff --git a/tests/acceptance/01_vars/04_containers/readjson_null.cf b/tests/acceptance/01_vars/04_containers/readjson_null.cf index fed055cb2e3..92309aa6386 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_null.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_null.cf @@ -39,7 +39,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024), + if => fileexists("$(G.testfile).json"); files: "$(G.testfile).actual" diff --git a/tests/acceptance/01_vars/04_containers/readjson_objects.cf b/tests/acceptance/01_vars/04_containers/readjson_objects.cf index 137670afd03..54422b46662 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_objects.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_objects.cf @@ -40,7 +40,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024), + if => fileexists("$(G.testfile).json"); files: "$(G.testfile).actual" diff --git a/tests/acceptance/01_vars/04_containers/readjson_scalar.cf b/tests/acceptance/01_vars/04_containers/readjson_scalar.cf index f1fe8bc9172..ba32e03860b 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_scalar.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_scalar.cf @@ -39,7 +39,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024), + if => fileexists("$(G.testfile).json"); files: "$(G.testfile).actual" diff --git a/tests/acceptance/01_vars/04_containers/readjson_subindex.cf b/tests/acceptance/01_vars/04_containers/readjson_subindex.cf index 7cbdf379d2d..bd669b3ddae 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_subindex.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_subindex.cf @@ -41,7 +41,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024), + if => fileexists("$(G.testfile).json"); files: "$(G.testfile).actual" diff --git a/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf b/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf index 39e203f37df..17d8c7fadf2 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf @@ -41,7 +41,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024); + "load" data => readjson("$(G.testfile).json", 1024), + if => fileexists("$(G.testfile).json"); files: "$(G.testfile).actual" diff --git a/tests/acceptance/08_commands/arglist.cf b/tests/acceptance/08_commands/arglist.cf index c86411e7173..1948f33e815 100644 --- a/tests/acceptance/08_commands/arglist.cf +++ b/tests/acceptance/08_commands/arglist.cf @@ -46,7 +46,8 @@ bundle agent test bundle agent check { vars: - "actual" string => readfile("$(G.testfile).actual"); + "actual" string => readfile("$(G.testfile).actual"), + if => fileexists("$(G.testfile).actual"); "expected" string => "one two three diff --git a/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf b/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf index 79810047971..d39a6f50b73 100644 --- a/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf +++ b/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf @@ -38,7 +38,8 @@ bundle agent check Bad 3 "; - "actual" string => readfile("$(init.test_file)", "inf"); + "actual" string => readfile("$(init.test_file)", "inf"), + if => fileexists("$(init.test_file)"); classes: "ok" expression => strcmp("$(expected)", "$(actual)"); diff --git a/tests/acceptance/10_files/templating/empty_template_empty_file.cf b/tests/acceptance/10_files/templating/empty_template_empty_file.cf index de9a28342b7..38cc6730655 100644 --- a/tests/acceptance/10_files/templating/empty_template_empty_file.cf +++ b/tests/acceptance/10_files/templating/empty_template_empty_file.cf @@ -53,7 +53,8 @@ bundle agent check { vars: "expect" string => ""; - "actual" string => readfile("$(G.testfile)", 1000); + "actual" string => readfile("$(G.testfile)", 1000), + if => fileexists("$(G.testfile)"); classes: "ok" expression => regcmp("$(expect)", "$(actual)"); diff --git a/tests/acceptance/10_files/templating/mustache_abuse.cf b/tests/acceptance/10_files/templating/mustache_abuse.cf index a2b6eaa47d1..01ae5a2c531 100644 --- a/tests/acceptance/10_files/templating/mustache_abuse.cf +++ b/tests/acceptance/10_files/templating/mustache_abuse.cf @@ -99,7 +99,8 @@ bundle agent check ); "actual_$(init.tests)" - string => readfile("$(G.testfile).$(init.tests)", 10000); + string => readfile("$(G.testfile).$(init.tests)", 10000), + if => fileexists("$(G.testfile).$(init.tests)"); classes: "ok_$(init.tests)" diff --git a/tests/acceptance/10_files/templating/mustache_datastate_demo.cf b/tests/acceptance/10_files/templating/mustache_datastate_demo.cf index 0725484f444..43f2cc0a920 100644 --- a/tests/acceptance/10_files/templating/mustache_datastate_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_datastate_demo.cf @@ -101,7 +101,8 @@ bundle agent check }" '; - "actual" string => readfile("$(G.testfile)", inf); + "actual" string => readfile("$(G.testfile)", inf), + if => fileexists("$(G.testfile)"); classes: "ok" expression => strcmp($(expect), $(actual)); diff --git a/tests/acceptance/10_files/templating/mustache_demo.cf b/tests/acceptance/10_files/templating/mustache_demo.cf index 76bffa647e4..3b016edaedb 100644 --- a/tests/acceptance/10_files/templating/mustache_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_demo.cf @@ -49,7 +49,8 @@ bundle agent check { vars: "expect" string => readfile("$(init.origtestdir)/demo.expected", 10000); - "actual" string => readfile("$(G.testfile)", 10000); + "actual" string => readfile("$(G.testfile)", 10000), + if => fileexists("$(G.testfile)"); classes: "ok" expression => regcmp("$(expect)", "$(actual)"); diff --git a/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf b/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf index 7c69a7d9619..52b0077414c 100644 --- a/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf +++ b/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf @@ -85,8 +85,10 @@ bundle agent test vars: "template" string => "$(this.promise_filename).mustache"; - "actual_good" string => readfile("$(G.testfile).good", 4096); - "actual_bad" string => readfile("$(G.testfile).bad", 4096); + "actual_good" string => readfile("$(G.testfile).good", 4096), + if => fileexists("$(G.testfile).good"); + "actual_bad" string => readfile("$(G.testfile).bad", 4096), + if => fileexists("$(G.testfile).bad"); } ####################################################### diff --git a/tests/acceptance/10_files/templating/mustache_html_escape.cf b/tests/acceptance/10_files/templating/mustache_html_escape.cf index decc658f9ff..2f4a3b958eb 100644 --- a/tests/acceptance/10_files/templating/mustache_html_escape.cf +++ b/tests/acceptance/10_files/templating/mustache_html_escape.cf @@ -54,7 +54,8 @@ bundle agent check { vars: "expect" string => readfile("$(this.promise_filename).expected", 10000); - "actual" string => readfile("$(G.testfile)", 10000); + "actual" string => readfile("$(G.testfile)", 10000), + if => fileexists("$(G.testfile)"); classes: "ok" expression => strcmp("$(expect)", "$(actual)"); diff --git a/tests/acceptance/10_files/templating/mustache_inline_demo.cf b/tests/acceptance/10_files/templating/mustache_inline_demo.cf index d03e2d90681..6ae16b65a4d 100644 --- a/tests/acceptance/10_files/templating/mustache_inline_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_inline_demo.cf @@ -52,7 +52,8 @@ bundle agent check "expect" string => readfile("$(init.origtestdir)/inline_demo.expected", 10000); - "actual" string => readfile("$(G.testfile)", 10000); + "actual" string => readfile("$(G.testfile)", 10000), + if => fileexists("$(G.testfile)"); classes: "ok" expression => regcmp("$(expect)", "$(actual)"); diff --git a/tests/acceptance/10_files/templating/mustache_render_quote.cf b/tests/acceptance/10_files/templating/mustache_render_quote.cf index 5ba4ba3ae9a..4def7b9364b 100644 --- a/tests/acceptance/10_files/templating/mustache_render_quote.cf +++ b/tests/acceptance/10_files/templating/mustache_render_quote.cf @@ -54,7 +54,8 @@ bundle agent check { vars: "expect" string => readfile("$(this.promise_filename).expected", 4000); - "actual" string => readfile("$(G.testfile)", 4000); + "actual" string => readfile("$(G.testfile)", 4000), + if => fileexists("$(G.testfile)"); classes: "ok" expression => regcmp("$(expect)", "$(actual)"); diff --git a/tests/acceptance/10_files/templating/mustache_repair_existing.cf b/tests/acceptance/10_files/templating/mustache_repair_existing.cf index e2a1991d973..2429e350ed6 100644 --- a/tests/acceptance/10_files/templating/mustache_repair_existing.cf +++ b/tests/acceptance/10_files/templating/mustache_repair_existing.cf @@ -50,7 +50,8 @@ bundle agent check { vars: "expect" string => readfile("$(init.origtestdir)/demo.expected", 4096); - "actual" string => readfile("$(G.testfile)", 4096); + "actual" string => readfile("$(G.testfile)", 4096), + if => fileexists("$(G.testfile)"); classes: "content_ok" expression => regcmp("$(expect)", "$(actual)"); diff --git a/tests/acceptance/31_tickets/CFE-3866/test.cf b/tests/acceptance/31_tickets/CFE-3866/test.cf index 5a8dd626451..c90c082ed48 100644 --- a/tests/acceptance/31_tickets/CFE-3866/test.cf +++ b/tests/acceptance/31_tickets/CFE-3866/test.cf @@ -68,7 +68,8 @@ bundle agent check "expected" string => "[section] key=value "; - "actual" string => readfile("$(G.testfile)", "1000"); + "actual" string => readfile("$(G.testfile)", "1000"), + if => fileexists("$(G.testfile)"); classes: "ok" expression => strcmp("$(expected)", "$(actual)"); From 90b53dc76e61170779192fcf43c96b29b5bc0b26 Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Thu, 15 Oct 2026 14:44:08 +0300 Subject: [PATCH 10/22] Indented command output in dcs_passif_output() DEBUG report Errors printed by the command were reported on lines starting with "error:", so testall mistook them for errors of the test itself. Ticket: CFE-3041 Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit 5398b14d94424c30608c11a2fe89797ef45e7fd3) --- tests/acceptance/dcs.sub.cf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/dcs.sub.cf b/tests/acceptance/dcs.sub.cf index a2c0c3a61dd..b9bf9071f15 100644 --- a/tests/acceptance/dcs.sub.cf +++ b/tests/acceptance/dcs.sub.cf @@ -1097,6 +1097,10 @@ bundle agent dcs_passif_output(wanted, unwanted, command, test) string => execresult($(command), "useshell"), meta => { "simulate_safe" }; + # Indent the command output in the DEBUG report, so that errors printed + # by the command are not mistaken for errors of the test by testall + "subout_indented" string => regex_replace($(subout), "^", " | ", "gm"); + classes: "__passif_output_unwanted" expression => regcmp($(unwanted), $(subout)); "__passif_output_wanted" expression => regcmp($(wanted), $(subout)); @@ -1126,7 +1130,7 @@ bundle agent dcs_passif_output(wanted, unwanted, command, test) if => "!__passif_output_unwanted"; DEBUG:: - "$(this.bundle): the output of command '$(command)' was: '$(subout)'"; + "$(this.bundle): the output of command '$(command)' was: '$(subout_indented)'"; } bundle agent dcs_passif_output1(wanted, command, test) From f4233ecf5a4ed99928edbb4714bc9acdabdbca1a Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Thu, 15 Oct 2026 14:50:11 +0300 Subject: [PATCH 11/22] Added guards to reads of files created later in acceptance tests These tests read files and directories created by their own policy, but pre-evaluation calls the functions before they exist, logging errors which now fail regular tests. Ticket: CFE-3041 Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit bbf547b37c937d509bede432d0dceaa471e19429) --- .../01_vars/02_functions/findfiles_up.cf | 18 ++++++++++++------ .../01_vars/02_functions/getfields.cf | 3 ++- .../01_vars/02_functions/regextract.cf | 3 ++- .../02_functions/classesmatching_inherit_2.cf | 3 ++- .../09_insert_lines/multi-files-dirs.cf | 9 ++++++--- .../templating/large_template_blocks.cf | 3 ++- .../mustache_container_serialization.cf | 3 ++- .../classic_evaluation_long_policy.cf | 6 ++++-- .../top_down_evaluation_long_policy.cf | 6 ++++-- .../simulate_safe_functions.cf | 3 +++ 10 files changed, 39 insertions(+), 18 deletions(-) diff --git a/tests/acceptance/01_vars/02_functions/findfiles_up.cf b/tests/acceptance/01_vars/02_functions/findfiles_up.cf index f8ac71214c2..faf55b5abb3 100755 --- a/tests/acceptance/01_vars/02_functions/findfiles_up.cf +++ b/tests/acceptance/01_vars/02_functions/findfiles_up.cf @@ -46,27 +46,33 @@ bundle agent test "t1" data => findfiles_up( "$(G.testdir)/core/libntech/libutils/", ".gitignore", "inf" - ); + ), + if => isdir("$(G.testdir)/core/libntech/libutils/"); "t2" - data => findfiles_up("$(G.testdir)/core/libntech/libutils/", "string.?"); + data => findfiles_up("$(G.testdir)/core/libntech/libutils/", "string.?"), + if => isdir("$(G.testdir)/core/libntech/libutils/"); - "t3" data => findfiles_up("$(G.testdir)/core/libntech/libutils/", ".git/"); + "t3" data => findfiles_up("$(G.testdir)/core/libntech/libutils/", ".git/"), + if => isdir("$(G.testdir)/core/libntech/libutils/"); "t4" data => findfiles_up( "$(G.testdir)/core/libntech/libutils/", ".git/", "1" - ); + ), + if => isdir("$(G.testdir)/core/libntech/libutils/"); "t5" data => findfiles_up( "$(G.testdir)/core/libntech/libutils/", ".git/config" - ); + ), + if => isdir("$(G.testdir)/core/libntech/libutils/"); "t6" data => findfiles_up( "$(G.testdir)/core/libntech/libutils/", "*/cf?{lex,parse}.[ly]" - ); + ), + if => isdir("$(G.testdir)/core/libntech/libutils/"); } bundle agent check diff --git a/tests/acceptance/01_vars/02_functions/getfields.cf b/tests/acceptance/01_vars/02_functions/getfields.cf index 7af6fdbd12d..b1f1adc32f8 100644 --- a/tests/acceptance/01_vars/02_functions/getfields.cf +++ b/tests/acceptance/01_vars/02_functions/getfields.cf @@ -41,7 +41,8 @@ body delete init_delete bundle agent test { vars: - "num_matching" int => getfields("t.*", "$(G.testfile)", ":", "fields"); + "num_matching" int => getfields("t.*", "$(G.testfile)", ":", "fields"), + if => fileexists("$(G.testfile)"); } ####################################################### diff --git a/tests/acceptance/01_vars/02_functions/regextract.cf b/tests/acceptance/01_vars/02_functions/regextract.cf index ee882bc0969..e356e5f0879 100644 --- a/tests/acceptance/01_vars/02_functions/regextract.cf +++ b/tests/acceptance/01_vars/02_functions/regextract.cf @@ -32,7 +32,8 @@ bundle agent test "lefts" string => "$(init.pair[1])"; "lefti" int => "$(init.pair[1])"; "rights" string => "$(init.pair[2])"; - "rightr" real => "$(init.pair[2])"; + "rightr" real => "$(init.pair[2])", + if => isvariable("init.pair[2]"); } ####################################################### diff --git a/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf b/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf index f0b25fa0685..ad2062ed2d1 100644 --- a/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf +++ b/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf @@ -59,7 +59,8 @@ bundle agent check "defined_classes: defined_in_second$(const.n)" ); - "actual" string => readfile("$(common.logfile)", inf); + "actual" string => readfile("$(common.logfile)", inf), + if => fileexists("$(common.logfile)"); reports: "$(this.promise_filename) Pass" if => strcmp($(expected), $(actual)); diff --git a/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf b/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf index 310c8a68553..43b9fac0d5d 100644 --- a/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf +++ b/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf @@ -54,9 +54,12 @@ bundle agent check vars: "expect" string => "one two three test"; "results" slist => { "resultA", "resultB", "resultC" }; - "resultA" string => readfile("$(G.testdir)/dirA/testfa", "33"); - "resultB" string => readfile("$(G.testdir)/dirB/testfb", "33"); - "resultC" string => readfile("$(G.testdir)/dirC/testfc", "33"); + "resultA" string => readfile("$(G.testdir)/dirA/testfa", "33"), + if => fileexists("$(G.testdir)/dirA/testfa"); + "resultB" string => readfile("$(G.testdir)/dirB/testfb", "33"), + if => fileexists("$(G.testdir)/dirB/testfb"); + "resultC" string => readfile("$(G.testdir)/dirC/testfc", "33"), + if => fileexists("$(G.testdir)/dirC/testfc"); classes: "ok_A" expression => strcmp("$(expect)", "$(resultA)"); diff --git a/tests/acceptance/10_files/templating/large_template_blocks.cf b/tests/acceptance/10_files/templating/large_template_blocks.cf index 398a1f3028a..2f3fedeba3a 100644 --- a/tests/acceptance/10_files/templating/large_template_blocks.cf +++ b/tests/acceptance/10_files/templating/large_template_blocks.cf @@ -50,7 +50,8 @@ bundle agent check { vars: "expected" int => "110"; - "actual" int => countlinesmatching(".*0123456789.*", "$(G.testfile)"); + "actual" int => countlinesmatching(".*0123456789.*", "$(G.testfile)"), + if => fileexists("$(G.testfile)"); classes: "ok" expression => strcmp("$(expected)", "$(actual)"); diff --git a/tests/acceptance/10_files/templating/mustache_container_serialization.cf b/tests/acceptance/10_files/templating/mustache_container_serialization.cf index e6fdfb8cbe0..d41dcf9e398 100644 --- a/tests/acceptance/10_files/templating/mustache_container_serialization.cf +++ b/tests/acceptance/10_files/templating/mustache_container_serialization.cf @@ -64,7 +64,8 @@ bundle edit_line readthem { vars: "test" slist => { @(test.test) }; - "read_$(test)" string => readfile("$(G.testdir)/$(test)", 1k); + "read_$(test)" string => readfile("$(G.testdir)/$(test)", 1k), + if => fileexists("$(G.testdir)/$(test)"); insert_lines: "$(read_$(test))"; diff --git a/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf b/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf index 077fffdbd95..3fedb3a4bcd 100644 --- a/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf +++ b/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf @@ -34,7 +34,8 @@ bundle agent test "/tmp/example" content => "fourth"; vars: - "content" string => readfile("/tmp/example"); + "content" string => readfile("/tmp/example"), + if => fileexists("/tmp/example"); "result" string => concat("$(result)", ", $(content)"); classes: @@ -48,7 +49,8 @@ bundle agent test "/tmp/otherfile" content => "something"; vars: - "othercontent" string => readfile("/tmp/otherfile"); + "othercontent" string => readfile("/tmp/otherfile"), + if => fileexists("/tmp/otherfile"); files: "/tmp/otherfile" delete => tidy; diff --git a/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf b/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf index 5d85ecbb5a9..a60342fd22b 100644 --- a/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf +++ b/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf @@ -34,7 +34,8 @@ bundle agent test "/tmp/example" content => "fourth"; vars: - "content" string => readfile("/tmp/example"); + "content" string => readfile("/tmp/example"), + if => fileexists("/tmp/example"); "result" string => concat("$(result)", ", $(content)"); classes: @@ -48,7 +49,8 @@ bundle agent test "/tmp/otherfile" content => "something"; vars: - "othercontent" string => readfile("/tmp/otherfile"); + "othercontent" string => readfile("/tmp/otherfile"), + if => fileexists("/tmp/otherfile"); files: "/tmp/otherfile" delete => tidy; diff --git a/tests/acceptance/29_simulate_mode/simulate_safe_functions.cf b/tests/acceptance/29_simulate_mode/simulate_safe_functions.cf index 289f5811d5a..484869b968b 100644 --- a/tests/acceptance/29_simulate_mode/simulate_safe_functions.cf +++ b/tests/acceptance/29_simulate_mode/simulate_safe_functions.cf @@ -56,6 +56,9 @@ bundle agent check "result" string => readfile( "$(sys.workdir)$(const.dirsep)state$(const.dirsep)agent.log" + ), + if => fileexists( + "$(sys.workdir)$(const.dirsep)state$(const.dirsep)agent.log" ); methods: From 618e0f06826381b30cb00671bac2fdb3ac6ffffc Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Thu, 15 Oct 2026 14:56:07 +0300 Subject: [PATCH 12/22] Renamed 00_basics/def.json test directory to def_json The agent loads def.json from the directory of the input policy file, so tests in 00_basics/ tried to read this directory as their augments file and logged "Could not open JSON file" errors. Ticket: CFE-3041 Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit 8af7a04c8f509bc55ea766e9335db56bed02c512) --- tests/acceptance/00_basics/{def.json => def_json}/augments.cf | 0 .../00_basics/{def.json => def_json}/augments.cf.augmenter.json | 0 .../acceptance/00_basics/{def.json => def_json}/augments.cf.json | 0 .../{def.json => def_json}/augments_classes/augments_classes.cf | 0 .../00_basics/{def.json => def_json}/augments_classes/def.json | 0 .../acceptance/00_basics/{def.json => def_json}/augments_order.cf | 0 .../{def.json => def_json}/augments_order.cf.augmenter.json | 0 .../00_basics/{def.json => def_json}/augments_order.cf.json | 0 tests/acceptance/00_basics/{def.json => def_json}/bad-json.cf | 0 .../00_basics/{def.json => def_json}/bad-json.cf.x.json | 0 .../{def.json => def_json}/class_from_classexpression.cf | 0 .../{def.json => def_json}/class_from_classexpression.cf.json | 0 tests/acceptance/00_basics/{def.json => def_json}/classes.cf | 0 tests/acceptance/00_basics/{def.json => def_json}/classes.cf.json | 0 .../00_basics/{def.json => def_json}/classes_with_ns.cf | 0 .../00_basics/{def.json => def_json}/classes_with_ns.cf.json | 0 .../00_basics/{def.json => def_json}/classes_with_ns_tags.cf | 0 .../00_basics/{def.json => def_json}/classes_with_ns_tags.cf.json | 0 .../concurrent-vars-and-variables-keys/both-can-define-vars.cf | 0 .../concurrent-vars-and-variables-keys/def.json | 0 .../variables-wins-variables-listed-first/def.json | 0 .../variables-wins-variables-listed-first/variables-wins.cf | 0 .../concurrent-vars-and-variables-keys/variables-wins.cf | 0 tests/acceptance/00_basics/{def.json => def_json}/def.json | 0 .../00_basics/{def.json => def_json}/def_preferred.json/def.json | 0 .../{def.json => def_json}/def_preferred.json/def_preferred.cf | 0 .../{def.json => def_json}/def_preferred.json/def_preferred.json | 0 tests/acceptance/00_basics/{def.json => def_json}/inputs.cf | 0 tests/acceptance/00_basics/{def.json => def_json}/inputs.cf.json | 0 .../00_basics/{def.json => def_json}/json-inputs-not-array.cf | 0 .../{def.json => def_json}/json-inputs-not-array.cf.json | 0 .../{def.json => def_json}/json-inputs-not-auto-applied.cf | 0 .../{def.json => def_json}/json-inputs-not-auto-applied.cf.json | 0 .../00_basics/{def.json => def_json}/policy_server_classes.cf | 0 .../{def.json => def_json}/policy_server_classes.cf.json | 0 .../acceptance/00_basics/{def.json => def_json}/show_vars_JSON.cf | 0 .../00_basics/{def.json => def_json}/show_vars_JSON.cf.json | 0 tests/acceptance/00_basics/{def.json => def_json}/state.cf | 0 .../00_basics/{def.json => def_json}/state.cf.expected.json | 0 tests/acceptance/00_basics/{def.json => def_json}/variables.cf | 0 .../acceptance/00_basics/{def.json => def_json}/variables.cf.json | 0 .../00_basics/{def.json => def_json}/variables_bare_array.cf | 0 .../00_basics/{def.json => def_json}/variables_bare_array.cf.json | 0 .../00_basics/{def.json => def_json}/variables_bare_string.cf | 0 .../{def.json => def_json}/variables_bare_string.cf.json | 0 .../00_basics/{def.json => def_json}/variables_with_bundle.cf | 0 .../{def.json => def_json}/variables_with_bundle.cf.json | 0 .../00_basics/{def.json => def_json}/variables_with_ns.cf | 0 .../00_basics/{def.json => def_json}/variables_with_ns.cf.json | 0 tests/acceptance/00_basics/{def.json => def_json}/vars.cf | 0 tests/acceptance/00_basics/{def.json => def_json}/vars.cf.json | 0 .../00_basics/{def.json => def_json}/vars_with_bundle.cf | 0 .../00_basics/{def.json => def_json}/vars_with_bundle.cf.json | 0 tests/acceptance/00_basics/{def.json => def_json}/vars_with_ns.cf | 0 .../00_basics/{def.json => def_json}/vars_with_ns.cf.json | 0 55 files changed, 0 insertions(+), 0 deletions(-) rename tests/acceptance/00_basics/{def.json => def_json}/augments.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/augments.cf.augmenter.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/augments.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/augments_classes/augments_classes.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/augments_classes/def.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/augments_order.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/augments_order.cf.augmenter.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/augments_order.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/bad-json.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/bad-json.cf.x.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/class_from_classexpression.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/class_from_classexpression.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/classes.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/classes.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/classes_with_ns.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/classes_with_ns.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/classes_with_ns_tags.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/classes_with_ns_tags.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/concurrent-vars-and-variables-keys/both-can-define-vars.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/concurrent-vars-and-variables-keys/def.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/def.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/variables-wins.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/concurrent-vars-and-variables-keys/variables-wins.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/def.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/def_preferred.json/def.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/def_preferred.json/def_preferred.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/def_preferred.json/def_preferred.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/inputs.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/inputs.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/json-inputs-not-array.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/json-inputs-not-array.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/json-inputs-not-auto-applied.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/json-inputs-not-auto-applied.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/policy_server_classes.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/policy_server_classes.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/show_vars_JSON.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/show_vars_JSON.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/state.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/state.cf.expected.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables_bare_array.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables_bare_array.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables_bare_string.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables_bare_string.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables_with_bundle.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables_with_bundle.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables_with_ns.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/variables_with_ns.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/vars.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/vars.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/vars_with_bundle.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/vars_with_bundle.cf.json (100%) rename tests/acceptance/00_basics/{def.json => def_json}/vars_with_ns.cf (100%) rename tests/acceptance/00_basics/{def.json => def_json}/vars_with_ns.cf.json (100%) diff --git a/tests/acceptance/00_basics/def.json/augments.cf b/tests/acceptance/00_basics/def_json/augments.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/augments.cf rename to tests/acceptance/00_basics/def_json/augments.cf diff --git a/tests/acceptance/00_basics/def.json/augments.cf.augmenter.json b/tests/acceptance/00_basics/def_json/augments.cf.augmenter.json similarity index 100% rename from tests/acceptance/00_basics/def.json/augments.cf.augmenter.json rename to tests/acceptance/00_basics/def_json/augments.cf.augmenter.json diff --git a/tests/acceptance/00_basics/def.json/augments.cf.json b/tests/acceptance/00_basics/def_json/augments.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/augments.cf.json rename to tests/acceptance/00_basics/def_json/augments.cf.json diff --git a/tests/acceptance/00_basics/def.json/augments_classes/augments_classes.cf b/tests/acceptance/00_basics/def_json/augments_classes/augments_classes.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/augments_classes/augments_classes.cf rename to tests/acceptance/00_basics/def_json/augments_classes/augments_classes.cf diff --git a/tests/acceptance/00_basics/def.json/augments_classes/def.json b/tests/acceptance/00_basics/def_json/augments_classes/def.json similarity index 100% rename from tests/acceptance/00_basics/def.json/augments_classes/def.json rename to tests/acceptance/00_basics/def_json/augments_classes/def.json diff --git a/tests/acceptance/00_basics/def.json/augments_order.cf b/tests/acceptance/00_basics/def_json/augments_order.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/augments_order.cf rename to tests/acceptance/00_basics/def_json/augments_order.cf diff --git a/tests/acceptance/00_basics/def.json/augments_order.cf.augmenter.json b/tests/acceptance/00_basics/def_json/augments_order.cf.augmenter.json similarity index 100% rename from tests/acceptance/00_basics/def.json/augments_order.cf.augmenter.json rename to tests/acceptance/00_basics/def_json/augments_order.cf.augmenter.json diff --git a/tests/acceptance/00_basics/def.json/augments_order.cf.json b/tests/acceptance/00_basics/def_json/augments_order.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/augments_order.cf.json rename to tests/acceptance/00_basics/def_json/augments_order.cf.json diff --git a/tests/acceptance/00_basics/def.json/bad-json.cf b/tests/acceptance/00_basics/def_json/bad-json.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/bad-json.cf rename to tests/acceptance/00_basics/def_json/bad-json.cf diff --git a/tests/acceptance/00_basics/def.json/bad-json.cf.x.json b/tests/acceptance/00_basics/def_json/bad-json.cf.x.json similarity index 100% rename from tests/acceptance/00_basics/def.json/bad-json.cf.x.json rename to tests/acceptance/00_basics/def_json/bad-json.cf.x.json diff --git a/tests/acceptance/00_basics/def.json/class_from_classexpression.cf b/tests/acceptance/00_basics/def_json/class_from_classexpression.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/class_from_classexpression.cf rename to tests/acceptance/00_basics/def_json/class_from_classexpression.cf diff --git a/tests/acceptance/00_basics/def.json/class_from_classexpression.cf.json b/tests/acceptance/00_basics/def_json/class_from_classexpression.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/class_from_classexpression.cf.json rename to tests/acceptance/00_basics/def_json/class_from_classexpression.cf.json diff --git a/tests/acceptance/00_basics/def.json/classes.cf b/tests/acceptance/00_basics/def_json/classes.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/classes.cf rename to tests/acceptance/00_basics/def_json/classes.cf diff --git a/tests/acceptance/00_basics/def.json/classes.cf.json b/tests/acceptance/00_basics/def_json/classes.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/classes.cf.json rename to tests/acceptance/00_basics/def_json/classes.cf.json diff --git a/tests/acceptance/00_basics/def.json/classes_with_ns.cf b/tests/acceptance/00_basics/def_json/classes_with_ns.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/classes_with_ns.cf rename to tests/acceptance/00_basics/def_json/classes_with_ns.cf diff --git a/tests/acceptance/00_basics/def.json/classes_with_ns.cf.json b/tests/acceptance/00_basics/def_json/classes_with_ns.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/classes_with_ns.cf.json rename to tests/acceptance/00_basics/def_json/classes_with_ns.cf.json diff --git a/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf b/tests/acceptance/00_basics/def_json/classes_with_ns_tags.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf rename to tests/acceptance/00_basics/def_json/classes_with_ns_tags.cf diff --git a/tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf.json b/tests/acceptance/00_basics/def_json/classes_with_ns_tags.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/classes_with_ns_tags.cf.json rename to tests/acceptance/00_basics/def_json/classes_with_ns_tags.cf.json diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/both-can-define-vars.cf b/tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/both-can-define-vars.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/both-can-define-vars.cf rename to tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/both-can-define-vars.cf diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/def.json b/tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/def.json similarity index 100% rename from tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/def.json rename to tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/def.json diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/def.json b/tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/def.json similarity index 100% rename from tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/def.json rename to tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/def.json diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/variables-wins.cf b/tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/variables-wins.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/variables-wins.cf rename to tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/variables-wins-variables-listed-first/variables-wins.cf diff --git a/tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins.cf b/tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/variables-wins.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/concurrent-vars-and-variables-keys/variables-wins.cf rename to tests/acceptance/00_basics/def_json/concurrent-vars-and-variables-keys/variables-wins.cf diff --git a/tests/acceptance/00_basics/def.json/def.json b/tests/acceptance/00_basics/def_json/def.json similarity index 100% rename from tests/acceptance/00_basics/def.json/def.json rename to tests/acceptance/00_basics/def_json/def.json diff --git a/tests/acceptance/00_basics/def.json/def_preferred.json/def.json b/tests/acceptance/00_basics/def_json/def_preferred.json/def.json similarity index 100% rename from tests/acceptance/00_basics/def.json/def_preferred.json/def.json rename to tests/acceptance/00_basics/def_json/def_preferred.json/def.json diff --git a/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.cf b/tests/acceptance/00_basics/def_json/def_preferred.json/def_preferred.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.cf rename to tests/acceptance/00_basics/def_json/def_preferred.json/def_preferred.cf diff --git a/tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.json b/tests/acceptance/00_basics/def_json/def_preferred.json/def_preferred.json similarity index 100% rename from tests/acceptance/00_basics/def.json/def_preferred.json/def_preferred.json rename to tests/acceptance/00_basics/def_json/def_preferred.json/def_preferred.json diff --git a/tests/acceptance/00_basics/def.json/inputs.cf b/tests/acceptance/00_basics/def_json/inputs.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/inputs.cf rename to tests/acceptance/00_basics/def_json/inputs.cf diff --git a/tests/acceptance/00_basics/def.json/inputs.cf.json b/tests/acceptance/00_basics/def_json/inputs.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/inputs.cf.json rename to tests/acceptance/00_basics/def_json/inputs.cf.json diff --git a/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf b/tests/acceptance/00_basics/def_json/json-inputs-not-array.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/json-inputs-not-array.cf rename to tests/acceptance/00_basics/def_json/json-inputs-not-array.cf diff --git a/tests/acceptance/00_basics/def.json/json-inputs-not-array.cf.json b/tests/acceptance/00_basics/def_json/json-inputs-not-array.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/json-inputs-not-array.cf.json rename to tests/acceptance/00_basics/def_json/json-inputs-not-array.cf.json diff --git a/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf b/tests/acceptance/00_basics/def_json/json-inputs-not-auto-applied.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf rename to tests/acceptance/00_basics/def_json/json-inputs-not-auto-applied.cf diff --git a/tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf.json b/tests/acceptance/00_basics/def_json/json-inputs-not-auto-applied.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/json-inputs-not-auto-applied.cf.json rename to tests/acceptance/00_basics/def_json/json-inputs-not-auto-applied.cf.json diff --git a/tests/acceptance/00_basics/def.json/policy_server_classes.cf b/tests/acceptance/00_basics/def_json/policy_server_classes.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/policy_server_classes.cf rename to tests/acceptance/00_basics/def_json/policy_server_classes.cf diff --git a/tests/acceptance/00_basics/def.json/policy_server_classes.cf.json b/tests/acceptance/00_basics/def_json/policy_server_classes.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/policy_server_classes.cf.json rename to tests/acceptance/00_basics/def_json/policy_server_classes.cf.json diff --git a/tests/acceptance/00_basics/def.json/show_vars_JSON.cf b/tests/acceptance/00_basics/def_json/show_vars_JSON.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/show_vars_JSON.cf rename to tests/acceptance/00_basics/def_json/show_vars_JSON.cf diff --git a/tests/acceptance/00_basics/def.json/show_vars_JSON.cf.json b/tests/acceptance/00_basics/def_json/show_vars_JSON.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/show_vars_JSON.cf.json rename to tests/acceptance/00_basics/def_json/show_vars_JSON.cf.json diff --git a/tests/acceptance/00_basics/def.json/state.cf b/tests/acceptance/00_basics/def_json/state.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/state.cf rename to tests/acceptance/00_basics/def_json/state.cf diff --git a/tests/acceptance/00_basics/def.json/state.cf.expected.json b/tests/acceptance/00_basics/def_json/state.cf.expected.json similarity index 100% rename from tests/acceptance/00_basics/def.json/state.cf.expected.json rename to tests/acceptance/00_basics/def_json/state.cf.expected.json diff --git a/tests/acceptance/00_basics/def.json/variables.cf b/tests/acceptance/00_basics/def_json/variables.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/variables.cf rename to tests/acceptance/00_basics/def_json/variables.cf diff --git a/tests/acceptance/00_basics/def.json/variables.cf.json b/tests/acceptance/00_basics/def_json/variables.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/variables.cf.json rename to tests/acceptance/00_basics/def_json/variables.cf.json diff --git a/tests/acceptance/00_basics/def.json/variables_bare_array.cf b/tests/acceptance/00_basics/def_json/variables_bare_array.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/variables_bare_array.cf rename to tests/acceptance/00_basics/def_json/variables_bare_array.cf diff --git a/tests/acceptance/00_basics/def.json/variables_bare_array.cf.json b/tests/acceptance/00_basics/def_json/variables_bare_array.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/variables_bare_array.cf.json rename to tests/acceptance/00_basics/def_json/variables_bare_array.cf.json diff --git a/tests/acceptance/00_basics/def.json/variables_bare_string.cf b/tests/acceptance/00_basics/def_json/variables_bare_string.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/variables_bare_string.cf rename to tests/acceptance/00_basics/def_json/variables_bare_string.cf diff --git a/tests/acceptance/00_basics/def.json/variables_bare_string.cf.json b/tests/acceptance/00_basics/def_json/variables_bare_string.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/variables_bare_string.cf.json rename to tests/acceptance/00_basics/def_json/variables_bare_string.cf.json diff --git a/tests/acceptance/00_basics/def.json/variables_with_bundle.cf b/tests/acceptance/00_basics/def_json/variables_with_bundle.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/variables_with_bundle.cf rename to tests/acceptance/00_basics/def_json/variables_with_bundle.cf diff --git a/tests/acceptance/00_basics/def.json/variables_with_bundle.cf.json b/tests/acceptance/00_basics/def_json/variables_with_bundle.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/variables_with_bundle.cf.json rename to tests/acceptance/00_basics/def_json/variables_with_bundle.cf.json diff --git a/tests/acceptance/00_basics/def.json/variables_with_ns.cf b/tests/acceptance/00_basics/def_json/variables_with_ns.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/variables_with_ns.cf rename to tests/acceptance/00_basics/def_json/variables_with_ns.cf diff --git a/tests/acceptance/00_basics/def.json/variables_with_ns.cf.json b/tests/acceptance/00_basics/def_json/variables_with_ns.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/variables_with_ns.cf.json rename to tests/acceptance/00_basics/def_json/variables_with_ns.cf.json diff --git a/tests/acceptance/00_basics/def.json/vars.cf b/tests/acceptance/00_basics/def_json/vars.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/vars.cf rename to tests/acceptance/00_basics/def_json/vars.cf diff --git a/tests/acceptance/00_basics/def.json/vars.cf.json b/tests/acceptance/00_basics/def_json/vars.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/vars.cf.json rename to tests/acceptance/00_basics/def_json/vars.cf.json diff --git a/tests/acceptance/00_basics/def.json/vars_with_bundle.cf b/tests/acceptance/00_basics/def_json/vars_with_bundle.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/vars_with_bundle.cf rename to tests/acceptance/00_basics/def_json/vars_with_bundle.cf diff --git a/tests/acceptance/00_basics/def.json/vars_with_bundle.cf.json b/tests/acceptance/00_basics/def_json/vars_with_bundle.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/vars_with_bundle.cf.json rename to tests/acceptance/00_basics/def_json/vars_with_bundle.cf.json diff --git a/tests/acceptance/00_basics/def.json/vars_with_ns.cf b/tests/acceptance/00_basics/def_json/vars_with_ns.cf similarity index 100% rename from tests/acceptance/00_basics/def.json/vars_with_ns.cf rename to tests/acceptance/00_basics/def_json/vars_with_ns.cf diff --git a/tests/acceptance/00_basics/def.json/vars_with_ns.cf.json b/tests/acceptance/00_basics/def_json/vars_with_ns.cf.json similarity index 100% rename from tests/acceptance/00_basics/def.json/vars_with_ns.cf.json rename to tests/acceptance/00_basics/def_json/vars_with_ns.cf.json From 584adc1c00794b5c3462ac9f337b7e9a67b46de5 Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Thu, 15 Oct 2026 15:03:29 +0300 Subject: [PATCH 13/22] Fixed execresult_action_immediate.cf logging errors The test used the 'immediate' body from plucked.sub.cf before it was loaded during pre-evaluation, so the promise is now skipped until the test framework is loaded. Ticket: CFE-3041 Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit cb51dff0b28de94efbe94ed8d3a7cfed70ca82d6) --- .../execresult_action_immediate.cf | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/01_vars/02_functions/execresult_action_immediate.cf b/tests/acceptance/01_vars/02_functions/execresult_action_immediate.cf index 0181e9569e6..1e0634a6098 100644 --- a/tests/acceptance/01_vars/02_functions/execresult_action_immediate.cf +++ b/tests/acceptance/01_vars/02_functions/execresult_action_immediate.cf @@ -7,14 +7,23 @@ body common control version => "1.0"; } +# The 'immediate' body comes from plucked.sub.cf, which is not loaded yet when +# the policy is pre-evaluated, so promises using it are skipped until then +bundle common framework +{ + classes: + "framework_loaded" expression => isvariable("G.testdir"); +} + bundle agent check_date(x) { vars: "reports_file" string => "$(G.testdir)/execresult_action_immediate_report"; - "date" - string => execresult("date; sleep 1", "useshell"), - action => immediate; + framework_loaded:: + "date" + string => execresult("date; sleep 1", "useshell"), + action => immediate; reports: "Date for ${x}: ${date}" report_to_file => "$(reports_file)"; @@ -41,7 +50,8 @@ bundle agent check "content" slist => readstringlist( "$(check_date.reports_file)", "", '$(const.n)', inf, inf - ); + ), + if => fileexists("$(check_date.reports_file)"); "count" int => length(content); From 56d3749b72761a6397f3fe5765bad6a8328e52f5 Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Thu, 15 Oct 2026 15:03:30 +0300 Subject: [PATCH 14/22] Fixed classic_evaluation_custom_promise_types.cf logging errors The test referred to a promise module which never existed and did not run its init and cleanup bundles. Ticket: CFE-3041 Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit f5197a41378fde0e3a1767f55c2ab5950f4925ea) --- ...classic_evaluation_custom_promise_types.cf | 10 +++-- .../01_common/dummy_promise_type.py | 40 +++++++++++++++++++ 2 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 tests/acceptance/15_control/01_common/dummy_promise_type.py diff --git a/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf b/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf index 379663d0b9a..4976b216f4c 100644 --- a/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf +++ b/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf @@ -1,13 +1,13 @@ body common control { inputs => { "../../default.sub.cf" }; - bundlesequence => { "test" }; + bundlesequence => { "init", "test", "cleanup" }; evaluation_order => "classic"; } promise agent dummy { - path => "$(this.promise_dirname)/top_down/dummy_promise_type.py"; + path => "$(this.promise_dirname)/dummy_promise_type.py"; interpreter => "/usr/bin/python3"; } @@ -23,13 +23,15 @@ bundle agent test "/tmp/dummyfile" smth => "hello"; vars: - "content" string => readfile("/tmp/dummyfile"); + "content" string => readfile("/tmp/dummyfile"), + if => fileexists("/tmp/dummyfile"); files: "/tmp/dummyfile" content => "ok"; vars: - "content" string => readfile("/tmp/dummyfile"); + "content" string => readfile("/tmp/dummyfile"), + if => fileexists("/tmp/dummyfile"); classes: "ok" expression => strcmp("$(content)", "ok"); diff --git a/tests/acceptance/15_control/01_common/dummy_promise_type.py b/tests/acceptance/15_control/01_common/dummy_promise_type.py new file mode 100644 index 00000000000..506733d056a --- /dev/null +++ b/tests/acceptance/15_control/01_common/dummy_promise_type.py @@ -0,0 +1,40 @@ +#!/usr/bin/python3 +# +# Minimal custom promise module which accepts any promise and does nothing, +# used to have a custom promise type in evaluation order tests. + +import sys + + +def read_request(): + request = {} + for line in sys.stdin: + line = line.rstrip("\n") + if not line: + return request + key, _, value = line.partition("=") + request[key] = value + sys.exit(0) + + +def write_response(operation, result): + sys.stdout.write("operation=%s\nresult=%s\n\n" % (operation, result)) + sys.stdout.flush() + + +# Skip the header from the agent and send ours +read_request() +sys.stdout.write("dummy_promise_type 0.0.1 v1 line_based\n\n") +sys.stdout.flush() + +while True: + operation = read_request().get("operation") + if operation == "validate_promise": + write_response(operation, "valid") + elif operation == "evaluate_promise": + write_response(operation, "kept") + elif operation == "terminate": + write_response(operation, "success") + sys.exit(0) + else: + write_response(operation, "error") From d7b67f1c4e3312d3aee86aba5ed05df0c3826e50 Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Thu, 15 Oct 2026 16:00:33 +0300 Subject: [PATCH 15/22] Fixed wrong-bundle-type.cf and ifelse.cf logging errors wrong-bundle-type.cf printed the sub-agent output in its DEBUG report, so the sub-agent errors were mistaken for errors of the test, and ifelse.cf used invalid class expressions as false conditions. Ticket: CFE-3041 Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit dd9336855aef2a90ec596c493e1c9fe9dd78e77d) --- tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf | 6 +++++- tests/acceptance/01_vars/02_functions/ifelse.cf | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf b/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf index db2641cbe6d..e1e1e57b980 100644 --- a/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf +++ b/tests/acceptance/00_basics/04_bundles/wrong-bundle-type.cf @@ -20,6 +20,10 @@ bundle agent test "${sys.cf_agent} -Kf $(this.promise_dirname)/wrong-bundle-type.sub.x.cf", "noshell" ); + + # Indent the output in the DEBUG report, so that errors printed by the + # sub-agent are not mistaken for errors of this test by testall + "subout_indented" string => regex_replace($(subout), "^", " | ", "gm"); } bundle agent check @@ -29,7 +33,7 @@ bundle agent check reports: DEBUG:: - "$(test.subout)"; + "$(test.subout_indented)"; ok:: "$(this.promise_filename) Pass"; diff --git a/tests/acceptance/01_vars/02_functions/ifelse.cf b/tests/acceptance/01_vars/02_functions/ifelse.cf index bc3ffe9fadb..55a6d7b9910 100644 --- a/tests/acceptance/01_vars/02_functions/ifelse.cf +++ b/tests/acceptance/01_vars/02_functions/ifelse.cf @@ -35,9 +35,9 @@ bundle agent test "five" string => ifelse( - "this is not true", + "this_is_not_true", "5 parameters broken", - "this is also not true", + "this_is_also_not_true", "5 parameters broken 2", "5 parameters OK" ); From edd53e2a51cee6d78397c6e51726c3cd16aa3712 Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Thu, 15 Oct 2026 16:00:33 +0300 Subject: [PATCH 16/22] Renamed acceptance tests which log errors on purpose to .error.pass.cf These tests intentionally exercise error paths, the reason is documented in the header of each test. Ticket: CFE-3041 Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit 350760c93ac2197f33888bd9acd41381970d1e63) --- .../{string_contexts.cf => string_contexts.error.pass.cf} | 4 ++++ ...ected.json => string_contexts.error.pass.cf.expected.json} | 0 .../acceptance/01_vars/01_basic/{013.cf => 013.error.pass.cf} | 4 ++++ ... can_not_define_variables_in_remote_bundles.error.pass.cf} | 4 ++++ .../01_vars/02_functions/{006.cf => 006.error.pass.cf} | 3 +++ .../02_functions/{CFE-2704-0.cf => CFE-2704-0.error.pass.cf} | 4 ++++ .../02_functions/{CFE-2704-1.cf => CFE-2704-1.error.pass.cf} | 4 ++++ .../02_functions/countlinesmatching_errors_on_absent_file.cf | 2 +- ...inesmatching_returns_0_on_inaccessable_file.error.pass.cf} | 3 +++ .../01_vars/02_functions/{lsdir.cf => lsdir.error.pass.cf} | 3 +++ .../{nth_datacontainer.cf => nth_datacontainer.error.pass.cf} | 4 ++++ ...r.cf.expected => nth_datacontainer.error.pass.cf.expected} | 0 ...container.cf.json => nth_datacontainer.error.pass.cf.json} | 0 ...e-endless-loop.cf => read-file-endless-loop.error.pass.cf} | 4 ++++ .../02_functions/{readdata.cf => readdata.error.pass.cf} | 4 ++++ .../{readdata.cf.csv => readdata.error.pass.cf.csv} | 0 ...readdata.cf.csv.guess => readdata.error.pass.cf.csv.guess} | 0 .../{readdata.cf.env => readdata.error.pass.cf.env} | 2 +- ....cf.expected.json => readdata.error.pass.cf.expected.json} | 0 .../{readdata.cf.json => readdata.error.pass.cf.json} | 0 ...addata.cf.json.guess => readdata.error.pass.cf.json.guess} | 0 .../{readdata_yaml.cf => readdata_yaml.error.pass.cf} | 4 ++++ ...xpected.json => readdata_yaml.error.pass.cf.expected.json} | 0 ...readdata_yaml.cf.yaml => readdata_yaml.error.pass.cf.yaml} | 0 ...l.cf.yaml.guess => readdata_yaml.error.pass.cf.yaml.guess} | 0 .../{readdata_yaml.cf.yml => readdata_yaml.error.pass.cf.yml} | 0 ...iner_conflict.cf => mergecontainer_conflict.error.pass.cf} | 3 +++ .../{parseyaml_abuse.cf => parseyaml_abuse.error.pass.cf} | 3 +++ ...cf => common_bundle_select_class_empty_list.error.pass.cf} | 3 +++ ...le_select_class_variable_expands_empty_list.error.pass.cf} | 3 +++ ...subnet-valid-ip.cf => isipinsubnet-valid-ip.error.pass.cf} | 3 +++ ...select_fncalls.cf => process_select_fncalls.error.pass.cf} | 3 +++ 32 files changed, 65 insertions(+), 2 deletions(-) rename tests/acceptance/00_basics/01_compiler/{string_contexts.cf => string_contexts.error.pass.cf} (93%) rename tests/acceptance/00_basics/01_compiler/{string_contexts.cf.expected.json => string_contexts.error.pass.cf.expected.json} (100%) rename tests/acceptance/01_vars/01_basic/{013.cf => 013.error.pass.cf} (88%) rename tests/acceptance/01_vars/01_basic/{can_not_define_variables_in_remote_bundles.cf => can_not_define_variables_in_remote_bundles.error.pass.cf} (93%) rename tests/acceptance/01_vars/02_functions/{006.cf => 006.error.pass.cf} (91%) rename tests/acceptance/01_vars/02_functions/{CFE-2704-0.cf => CFE-2704-0.error.pass.cf} (74%) rename tests/acceptance/01_vars/02_functions/{CFE-2704-1.cf => CFE-2704-1.error.pass.cf} (74%) rename tests/acceptance/01_vars/02_functions/{countlinesmatching_returns_0_on_inaccessable_file.cf => countlinesmatching_returns_0_on_inaccessable_file.error.pass.cf} (89%) rename tests/acceptance/01_vars/02_functions/{lsdir.cf => lsdir.error.pass.cf} (94%) rename tests/acceptance/01_vars/02_functions/{nth_datacontainer.cf => nth_datacontainer.error.pass.cf} (93%) rename tests/acceptance/01_vars/02_functions/{nth_datacontainer.cf.expected => nth_datacontainer.error.pass.cf.expected} (100%) rename tests/acceptance/01_vars/02_functions/{nth_datacontainer.cf.json => nth_datacontainer.error.pass.cf.json} (100%) rename tests/acceptance/01_vars/02_functions/{read-file-endless-loop.cf => read-file-endless-loop.error.pass.cf} (77%) rename tests/acceptance/01_vars/02_functions/{readdata.cf => readdata.error.pass.cf} (91%) rename tests/acceptance/01_vars/02_functions/{readdata.cf.csv => readdata.error.pass.cf.csv} (100%) rename tests/acceptance/01_vars/02_functions/{readdata.cf.csv.guess => readdata.error.pass.cf.csv.guess} (100%) rename tests/acceptance/01_vars/02_functions/{readdata.cf.env => readdata.error.pass.cf.env} (93%) rename tests/acceptance/01_vars/02_functions/{readdata.cf.expected.json => readdata.error.pass.cf.expected.json} (100%) rename tests/acceptance/01_vars/02_functions/{readdata.cf.json => readdata.error.pass.cf.json} (100%) rename tests/acceptance/01_vars/02_functions/{readdata.cf.json.guess => readdata.error.pass.cf.json.guess} (100%) rename tests/acceptance/01_vars/02_functions/{readdata_yaml.cf => readdata_yaml.error.pass.cf} (87%) rename tests/acceptance/01_vars/02_functions/{readdata_yaml.cf.expected.json => readdata_yaml.error.pass.cf.expected.json} (100%) rename tests/acceptance/01_vars/02_functions/{readdata_yaml.cf.yaml => readdata_yaml.error.pass.cf.yaml} (100%) rename tests/acceptance/01_vars/02_functions/{readdata_yaml.cf.yaml.guess => readdata_yaml.error.pass.cf.yaml.guess} (100%) rename tests/acceptance/01_vars/02_functions/{readdata_yaml.cf.yml => readdata_yaml.error.pass.cf.yml} (100%) rename tests/acceptance/01_vars/04_containers/{mergecontainer_conflict.cf => mergecontainer_conflict.error.pass.cf} (90%) rename tests/acceptance/01_vars/04_containers/{parseyaml_abuse.cf => parseyaml_abuse.error.pass.cf} (87%) rename tests/acceptance/02_classes/01_basic/{common_bundle_select_class_empty_list.cf => common_bundle_select_class_empty_list.error.pass.cf} (86%) rename tests/acceptance/02_classes/01_basic/{common_bundle_select_class_variable_expands_empty_list.cf => common_bundle_select_class_variable_expands_empty_list.error.pass.cf} (81%) rename tests/acceptance/02_classes/02_functions/{isipinsubnet-valid-ip.cf => isipinsubnet-valid-ip.error.pass.cf} (92%) rename tests/acceptance/05_processes/01_matching/{process_select_fncalls.cf => process_select_fncalls.error.pass.cf} (95%) diff --git a/tests/acceptance/00_basics/01_compiler/string_contexts.cf b/tests/acceptance/00_basics/01_compiler/string_contexts.error.pass.cf similarity index 93% rename from tests/acceptance/00_basics/01_compiler/string_contexts.cf rename to tests/acceptance/00_basics/01_compiler/string_contexts.error.pass.cf index 0bf5503ac25..3d3f99d453b 100644 --- a/tests/acceptance/00_basics/01_compiler/string_contexts.cf +++ b/tests/acceptance/00_basics/01_compiler/string_contexts.error.pass.cf @@ -1,5 +1,9 @@ # fixes https://dev.cfengine.com/issues/2504 # using variables in string contexts +# +# This is an .error.pass.cf test, because the 'cf engine' class context +# (words separated by whitespace without an operator) is invalid on +# purpose and logs an error. body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/00_basics/01_compiler/string_contexts.cf.expected.json b/tests/acceptance/00_basics/01_compiler/string_contexts.error.pass.cf.expected.json similarity index 100% rename from tests/acceptance/00_basics/01_compiler/string_contexts.cf.expected.json rename to tests/acceptance/00_basics/01_compiler/string_contexts.error.pass.cf.expected.json diff --git a/tests/acceptance/01_vars/01_basic/013.cf b/tests/acceptance/01_vars/01_basic/013.error.pass.cf similarity index 88% rename from tests/acceptance/01_vars/01_basic/013.cf rename to tests/acceptance/01_vars/01_basic/013.error.pass.cf index 4bf5fdfc56c..87d40432ef9 100644 --- a/tests/acceptance/01_vars/01_basic/013.cf +++ b/tests/acceptance/01_vars/01_basic/013.error.pass.cf @@ -2,6 +2,10 @@ # # Test that 'classes' body works on 'vars' promises # +# This is an .error.pass.cf test, because execresult() of the +# non-existent '/nonexisting' fails on purpose and logs errors, to test +# that repair_failed classes are set. +# ####################################################### body common control { diff --git a/tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.cf b/tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.error.pass.cf similarity index 93% rename from tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.cf rename to tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.error.pass.cf index ea9f92b962f..aba335f5e66 100644 --- a/tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.cf +++ b/tests/acceptance/01_vars/01_basic/can_not_define_variables_in_remote_bundles.error.pass.cf @@ -2,6 +2,10 @@ # # Test that it is invalid to define variables in remote bundles # +# This is an .error.pass.cf test, because defining a variable in a +# remote bundle is rejected with errors, which is what this test checks +# (CFE-1915). +# ####################################################### body common control { diff --git a/tests/acceptance/01_vars/02_functions/006.cf b/tests/acceptance/01_vars/02_functions/006.error.pass.cf similarity index 91% rename from tests/acceptance/01_vars/02_functions/006.cf rename to tests/acceptance/01_vars/02_functions/006.error.pass.cf index 62914fdb892..63d85cbeb29 100644 --- a/tests/acceptance/01_vars/02_functions/006.cf +++ b/tests/acceptance/01_vars/02_functions/006.error.pass.cf @@ -2,6 +2,9 @@ # # Test diskfree() # +# This is an .error.pass.cf test, because diskfree() is called on the +# non-existent path '/lkjqeroiu' on purpose and logs an error. +# ####################################################### body common control { diff --git a/tests/acceptance/01_vars/02_functions/CFE-2704-0.cf b/tests/acceptance/01_vars/02_functions/CFE-2704-0.error.pass.cf similarity index 74% rename from tests/acceptance/01_vars/02_functions/CFE-2704-0.cf rename to tests/acceptance/01_vars/02_functions/CFE-2704-0.error.pass.cf index 27b521a02bc..06279efded8 100644 --- a/tests/acceptance/01_vars/02_functions/CFE-2704-0.cf +++ b/tests/acceptance/01_vars/02_functions/CFE-2704-0.error.pass.cf @@ -1,3 +1,7 @@ +# This is an .error.pass.cf test, because mergedata() is given data +# which is not a container on purpose and logs an error, the test checks +# that the agent does not crash. + body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/01_vars/02_functions/CFE-2704-1.cf b/tests/acceptance/01_vars/02_functions/CFE-2704-1.error.pass.cf similarity index 74% rename from tests/acceptance/01_vars/02_functions/CFE-2704-1.cf rename to tests/acceptance/01_vars/02_functions/CFE-2704-1.error.pass.cf index a475b51d68f..10acfccee9a 100644 --- a/tests/acceptance/01_vars/02_functions/CFE-2704-1.cf +++ b/tests/acceptance/01_vars/02_functions/CFE-2704-1.error.pass.cf @@ -1,3 +1,7 @@ +# This is an .error.pass.cf test, because mergedata() is given data +# which is not a container on purpose and logs an error, the test checks +# that the agent does not crash. + body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/01_vars/02_functions/countlinesmatching_errors_on_absent_file.cf b/tests/acceptance/01_vars/02_functions/countlinesmatching_errors_on_absent_file.cf index 7df7778733f..3b2766f3932 100644 --- a/tests/acceptance/01_vars/02_functions/countlinesmatching_errors_on_absent_file.cf +++ b/tests/acceptance/01_vars/02_functions/countlinesmatching_errors_on_absent_file.cf @@ -25,7 +25,7 @@ bundle agent test vars: "subout" string => execresult( - "$(sys.cf_agent) -Kv --define AUTO -f $(this.promise_dirname)/countlinesmatching_returns_0_on_inaccessable_file.cf 2>&1 | $(G.grep) countlinesmatching", + "$(sys.cf_agent) -Kv --define AUTO -f $(this.promise_dirname)/countlinesmatching_returns_0_on_inaccessable_file.error.pass.cf 2>&1 | $(G.grep) countlinesmatching", "useshell" ); } diff --git a/tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.cf b/tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.error.pass.cf similarity index 89% rename from tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.cf rename to tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.error.pass.cf index 514d65a20aa..87f5a3769c7 100644 --- a/tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.cf +++ b/tests/acceptance/01_vars/02_functions/countlinesmatching_returns_0_on_inaccessable_file.error.pass.cf @@ -2,6 +2,9 @@ # # Test countlinesmatching() with some kind of failure expected # +# This is an .error.pass.cf test, because countlinesmatching() is called +# on an inaccessible file on purpose and logs an error. +# ####################################################### body common control { diff --git a/tests/acceptance/01_vars/02_functions/lsdir.cf b/tests/acceptance/01_vars/02_functions/lsdir.error.pass.cf similarity index 94% rename from tests/acceptance/01_vars/02_functions/lsdir.cf rename to tests/acceptance/01_vars/02_functions/lsdir.error.pass.cf index 50c103319b2..773dfd6caa2 100644 --- a/tests/acceptance/01_vars/02_functions/lsdir.cf +++ b/tests/acceptance/01_vars/02_functions/lsdir.error.pass.cf @@ -2,6 +2,9 @@ # # Test lsdir() # +# This is an .error.pass.cf test, because lsdir() is called on the +# non-existent directory '$(G.testdir)/b' on purpose and logs an error. +# ####################################################### body common control { diff --git a/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf b/tests/acceptance/01_vars/02_functions/nth_datacontainer.error.pass.cf similarity index 93% rename from tests/acceptance/01_vars/02_functions/nth_datacontainer.cf rename to tests/acceptance/01_vars/02_functions/nth_datacontainer.error.pass.cf index ea599ed3e98..a5bbdefc7da 100644 --- a/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf +++ b/tests/acceptance/01_vars/02_functions/nth_datacontainer.error.pass.cf @@ -2,6 +2,10 @@ # # Test nth() with data container input # +# This is an .error.pass.cf test, because nth() is called with keys +# which are not valid list indices (e.g. 'foo' or '') on purpose and +# logs errors. +# ####################################################### body common control { diff --git a/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf.expected b/tests/acceptance/01_vars/02_functions/nth_datacontainer.error.pass.cf.expected similarity index 100% rename from tests/acceptance/01_vars/02_functions/nth_datacontainer.cf.expected rename to tests/acceptance/01_vars/02_functions/nth_datacontainer.error.pass.cf.expected diff --git a/tests/acceptance/01_vars/02_functions/nth_datacontainer.cf.json b/tests/acceptance/01_vars/02_functions/nth_datacontainer.error.pass.cf.json similarity index 100% rename from tests/acceptance/01_vars/02_functions/nth_datacontainer.cf.json rename to tests/acceptance/01_vars/02_functions/nth_datacontainer.error.pass.cf.json diff --git a/tests/acceptance/01_vars/02_functions/read-file-endless-loop.cf b/tests/acceptance/01_vars/02_functions/read-file-endless-loop.error.pass.cf similarity index 77% rename from tests/acceptance/01_vars/02_functions/read-file-endless-loop.cf rename to tests/acceptance/01_vars/02_functions/read-file-endless-loop.error.pass.cf index 1cfaa98e160..46fe379f29d 100644 --- a/tests/acceptance/01_vars/02_functions/read-file-endless-loop.cf +++ b/tests/acceptance/01_vars/02_functions/read-file-endless-loop.error.pass.cf @@ -1,5 +1,9 @@ # Test that regline, getfields and countlinesmatching do not loop endlessly if # supplied with a directory (Redmine #2453) +# +# This is an .error.pass.cf test, because regline(), getfields() and +# countlinesmatching() are given the directory '/' on purpose and log +# errors. body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/01_vars/02_functions/readdata.cf b/tests/acceptance/01_vars/02_functions/readdata.error.pass.cf similarity index 91% rename from tests/acceptance/01_vars/02_functions/readdata.cf rename to tests/acceptance/01_vars/02_functions/readdata.error.pass.cf index 59767849337..09bba95c9ec 100644 --- a/tests/acceptance/01_vars/02_functions/readdata.cf +++ b/tests/acceptance/01_vars/02_functions/readdata.error.pass.cf @@ -2,6 +2,10 @@ # # Test readdata() with YAML # +# This is an .error.pass.cf test, because readdata() is given data in a +# format it cannot parse on purpose (the failed_* and guess_csv +# variables) and logs errors. +# ########################################################### body common control { diff --git a/tests/acceptance/01_vars/02_functions/readdata.cf.csv b/tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.csv similarity index 100% rename from tests/acceptance/01_vars/02_functions/readdata.cf.csv rename to tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.csv diff --git a/tests/acceptance/01_vars/02_functions/readdata.cf.csv.guess b/tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.csv.guess similarity index 100% rename from tests/acceptance/01_vars/02_functions/readdata.cf.csv.guess rename to tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.csv.guess diff --git a/tests/acceptance/01_vars/02_functions/readdata.cf.env b/tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.env similarity index 93% rename from tests/acceptance/01_vars/02_functions/readdata.cf.env rename to tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.env index 71aaa7dd272..ac93f45f3d2 100644 --- a/tests/acceptance/01_vars/02_functions/readdata.cf.env +++ b/tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.env @@ -1,4 +1,4 @@ -# Example env file used for acceptance test readdata.cf +# Example env file used for acceptance test readdata.error.pass.cf # We can't test for all weird possibilites, # but this should serve most use cases diff --git a/tests/acceptance/01_vars/02_functions/readdata.cf.expected.json b/tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.expected.json similarity index 100% rename from tests/acceptance/01_vars/02_functions/readdata.cf.expected.json rename to tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.expected.json diff --git a/tests/acceptance/01_vars/02_functions/readdata.cf.json b/tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.json similarity index 100% rename from tests/acceptance/01_vars/02_functions/readdata.cf.json rename to tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.json diff --git a/tests/acceptance/01_vars/02_functions/readdata.cf.json.guess b/tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.json.guess similarity index 100% rename from tests/acceptance/01_vars/02_functions/readdata.cf.json.guess rename to tests/acceptance/01_vars/02_functions/readdata.error.pass.cf.json.guess diff --git a/tests/acceptance/01_vars/02_functions/readdata_yaml.cf b/tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf similarity index 87% rename from tests/acceptance/01_vars/02_functions/readdata_yaml.cf rename to tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf index 7e3fc3edd97..84922593d62 100644 --- a/tests/acceptance/01_vars/02_functions/readdata_yaml.cf +++ b/tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf @@ -2,6 +2,10 @@ # # Test readdata() with YAML # +# This is an .error.pass.cf test, because readdata() is given data in a +# format it cannot parse on purpose (the failed_explicit_yaml and +# guess_yaml variables) and logs errors. +# ########################################################### body common control { diff --git a/tests/acceptance/01_vars/02_functions/readdata_yaml.cf.expected.json b/tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf.expected.json similarity index 100% rename from tests/acceptance/01_vars/02_functions/readdata_yaml.cf.expected.json rename to tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf.expected.json diff --git a/tests/acceptance/01_vars/02_functions/readdata_yaml.cf.yaml b/tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf.yaml similarity index 100% rename from tests/acceptance/01_vars/02_functions/readdata_yaml.cf.yaml rename to tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf.yaml diff --git a/tests/acceptance/01_vars/02_functions/readdata_yaml.cf.yaml.guess b/tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf.yaml.guess similarity index 100% rename from tests/acceptance/01_vars/02_functions/readdata_yaml.cf.yaml.guess rename to tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf.yaml.guess diff --git a/tests/acceptance/01_vars/02_functions/readdata_yaml.cf.yml b/tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf.yml similarity index 100% rename from tests/acceptance/01_vars/02_functions/readdata_yaml.cf.yml rename to tests/acceptance/01_vars/02_functions/readdata_yaml.error.pass.cf.yml diff --git a/tests/acceptance/01_vars/04_containers/mergecontainer_conflict.cf b/tests/acceptance/01_vars/04_containers/mergecontainer_conflict.error.pass.cf similarity index 90% rename from tests/acceptance/01_vars/04_containers/mergecontainer_conflict.cf rename to tests/acceptance/01_vars/04_containers/mergecontainer_conflict.error.pass.cf index 64c72b206a4..cf578d5dbdb 100644 --- a/tests/acceptance/01_vars/04_containers/mergecontainer_conflict.cf +++ b/tests/acceptance/01_vars/04_containers/mergecontainer_conflict.error.pass.cf @@ -2,6 +2,9 @@ # # Test mergejson() with mismatched datas # +# This is an .error.pass.cf test, because parsejson() is given invalid +# JSON on purpose and logs an error, so that mergedata() fails. +# ####################################################### body common control { diff --git a/tests/acceptance/01_vars/04_containers/parseyaml_abuse.cf b/tests/acceptance/01_vars/04_containers/parseyaml_abuse.error.pass.cf similarity index 87% rename from tests/acceptance/01_vars/04_containers/parseyaml_abuse.cf rename to tests/acceptance/01_vars/04_containers/parseyaml_abuse.error.pass.cf index 316b0ac7576..0878b53f51a 100644 --- a/tests/acceptance/01_vars/04_containers/parseyaml_abuse.cf +++ b/tests/acceptance/01_vars/04_containers/parseyaml_abuse.error.pass.cf @@ -2,6 +2,9 @@ # # Abuse parseyaml() # +# This is an .error.pass.cf test, because parseyaml() is given strings +# which are not valid YAML containers on purpose and logs errors. +# ####################################################### body common control { diff --git a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.cf b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.error.pass.cf similarity index 86% rename from tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.cf rename to tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.error.pass.cf index d8e0d02a920..deabdd53c7e 100644 --- a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.cf +++ b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_empty_list.error.pass.cf @@ -1,4 +1,7 @@ # Test that select_class is skipped when no classes are given +# +# This is an .error.pass.cf test, because select_class is given an empty +# list on purpose and logs an error. body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.cf b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.error.pass.cf similarity index 81% rename from tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.cf rename to tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.error.pass.cf index 833304f5120..cdf9cd73d8b 100644 --- a/tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.cf +++ b/tests/acceptance/02_classes/01_basic/common_bundle_select_class_variable_expands_empty_list.error.pass.cf @@ -1,4 +1,7 @@ # Test that select class is skipped when the list of classes is empty +# +# This is an .error.pass.cf test, because select_class is given a list +# variable which expands to an empty list on purpose and logs an error. body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.cf b/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.error.pass.cf similarity index 92% rename from tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.cf rename to tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.error.pass.cf index 1ef22d44ab8..78531aa664e 100644 --- a/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.cf +++ b/tests/acceptance/02_classes/02_functions/isipinsubnet-valid-ip.error.pass.cf @@ -2,6 +2,9 @@ # # Test isipinsubnet() # +# This is an .error.pass.cf test, because isipinsubnet() is given +# 'not-an-ip-address' on purpose and logs an error. +# ####################################################### body common control { diff --git a/tests/acceptance/05_processes/01_matching/process_select_fncalls.cf b/tests/acceptance/05_processes/01_matching/process_select_fncalls.error.pass.cf similarity index 95% rename from tests/acceptance/05_processes/01_matching/process_select_fncalls.cf rename to tests/acceptance/05_processes/01_matching/process_select_fncalls.error.pass.cf index 027efcc2828..bba2f72dacd 100644 --- a/tests/acceptance/05_processes/01_matching/process_select_fncalls.cf +++ b/tests/acceptance/05_processes/01_matching/process_select_fncalls.error.pass.cf @@ -1,3 +1,6 @@ +# This is an .error.pass.cf test, because getuid() is called for the +# non-existent user 'nosuchuser' on purpose and logs errors (CFE-1968). + body common control { inputs => { "../../default.sub.cf" }; From 506d4330702668db4fc4b869a3f60e0e54e9c2b9 Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Thu, 15 Oct 2026 16:18:37 +0300 Subject: [PATCH 17/22] Fixed linting issues Signed-off-by: Ihor Aleksandrychiev (cherry picked from commit 22cab402bd836266f983eb258fb1df32260a414e) --- tests/acceptance/01_vars/02_functions/011.cf | 4 +++- tests/acceptance/01_vars/02_functions/012.cf | 4 +++- tests/acceptance/01_vars/02_functions/013.cf | 4 +++- tests/acceptance/01_vars/02_functions/014.cf | 4 +++- tests/acceptance/01_vars/02_functions/015.cf | 4 +++- tests/acceptance/01_vars/02_functions/016.cf | 4 +++- tests/acceptance/01_vars/02_functions/017.cf | 4 +++- tests/acceptance/01_vars/02_functions/018.cf | 4 +++- tests/acceptance/01_vars/02_functions/019.cf | 4 +++- tests/acceptance/01_vars/02_functions/020.cf | 4 +++- tests/acceptance/01_vars/02_functions/021.cf | 4 +++- tests/acceptance/01_vars/02_functions/024.cf | 4 +++- tests/acceptance/01_vars/02_functions/025.cf | 4 +++- tests/acceptance/01_vars/02_functions/026.cf | 4 +++- tests/acceptance/01_vars/02_functions/027.cf | 4 +++- tests/acceptance/01_vars/02_functions/028.cf | 4 +++- tests/acceptance/01_vars/02_functions/029.cf | 4 +++- tests/acceptance/01_vars/02_functions/030.cf | 4 +++- tests/acceptance/01_vars/02_functions/031.cf | 4 +++- tests/acceptance/01_vars/02_functions/032.cf | 4 +++- tests/acceptance/01_vars/02_functions/033.cf | 4 +++- tests/acceptance/01_vars/02_functions/034.cf | 4 +++- tests/acceptance/01_vars/02_functions/037.cf | 4 +++- tests/acceptance/01_vars/02_functions/038.cf | 4 +++- tests/acceptance/01_vars/02_functions/039.cf | 4 +++- tests/acceptance/01_vars/02_functions/040.cf | 4 +++- tests/acceptance/01_vars/02_functions/041.cf | 4 +++- tests/acceptance/01_vars/02_functions/042.cf | 4 +++- tests/acceptance/01_vars/02_functions/043.cf | 4 +++- tests/acceptance/01_vars/02_functions/044.cf | 4 +++- tests/acceptance/01_vars/02_functions/045.cf | 4 +++- tests/acceptance/01_vars/02_functions/046.cf | 4 +++- tests/acceptance/01_vars/02_functions/047.cf | 4 +++- tests/acceptance/01_vars/02_functions/050.cf | 4 +++- tests/acceptance/01_vars/02_functions/410.cf | 4 +++- tests/acceptance/01_vars/02_functions/420.cf | 3 ++- tests/acceptance/01_vars/02_functions/421.cf | 3 ++- tests/acceptance/01_vars/02_functions/447.cf | 4 +++- tests/acceptance/01_vars/02_functions/520.cf | 4 +++- tests/acceptance/01_vars/02_functions/521.cf | 4 +++- tests/acceptance/01_vars/02_functions/620.cf | 3 ++- tests/acceptance/01_vars/02_functions/621.cf | 3 ++- .../01_vars/02_functions/CFE-2704-0.error.pass.cf | 1 - .../01_vars/02_functions/CFE-2704-1.error.pass.cf | 1 - .../acceptance/01_vars/02_functions/findfiles_up.cf | 3 ++- tests/acceptance/01_vars/02_functions/getfields.cf | 3 ++- .../02_functions/long_string_from_text_file.cf | 4 +++- ...ray_weird_indices_real_comments_noemptyfields2.cf | 4 +++- .../01_vars/02_functions/read_empty_file.cf | 7 +++++-- tests/acceptance/01_vars/02_functions/regextract.cf | 4 +++- tests/acceptance/01_vars/04_containers/readjson.cf | 3 ++- .../01_vars/04_containers/readjson_arrays.cf | 3 ++- .../acceptance/01_vars/04_containers/readjson_new.cf | 3 ++- .../01_vars/04_containers/readjson_null.cf | 3 ++- .../01_vars/04_containers/readjson_objects.cf | 3 ++- .../01_vars/04_containers/readjson_scalar.cf | 3 ++- .../01_vars/04_containers/readjson_subindex.cf | 3 ++- .../04_containers/readjson_subindex_quoted.cf | 3 ++- .../02_functions/classesmatching_inherit_2.cf | 3 ++- .../01_matching/process_select_fncalls.error.pass.cf | 1 - tests/acceptance/08_commands/arglist.cf | 4 +++- .../10_files/09_insert_lines/multi-files-dirs.cf | 12 +++++++++--- .../09_insert_lines/preserve_block_blank_lines.cf | 4 +++- .../10_files/templating/empty_template_empty_file.cf | 4 +++- .../10_files/templating/large_template_blocks.cf | 4 +++- .../templating/mustache_container_serialization.cf | 4 +++- .../10_files/templating/mustache_datastate_demo.cf | 3 ++- .../acceptance/10_files/templating/mustache_demo.cf | 4 +++- .../templating/mustache_expect_list_find_string.cf | 8 ++++++-- .../10_files/templating/mustache_html_escape.cf | 4 +++- .../10_files/templating/mustache_inline_demo.cf | 3 ++- .../10_files/templating/mustache_render_quote.cf | 4 +++- .../10_files/templating/mustache_repair_existing.cf | 4 +++- .../classic_evaluation_custom_promise_types.cf | 6 ++++-- .../01_common/classic_evaluation_long_policy.cf | 7 +++++-- .../01_common/top_down_evaluation_long_policy.cf | 7 +++++-- tests/acceptance/31_tickets/CFE-3866/test.cf | 4 +++- 77 files changed, 221 insertions(+), 84 deletions(-) diff --git a/tests/acceptance/01_vars/02_functions/011.cf b/tests/acceptance/01_vars/02_functions/011.cf index 93a5a1c3384..b9a7aebe1e6 100644 --- a/tests/acceptance/01_vars/02_functions/011.cf +++ b/tests/acceptance/01_vars/02_functions/011.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/012.cf b/tests/acceptance/01_vars/02_functions/012.cf index 55de4ce5573..7ce4aa0c051 100644 --- a/tests/acceptance/01_vars/02_functions/012.cf +++ b/tests/acceptance/01_vars/02_functions/012.cf @@ -38,8 +38,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/013.cf b/tests/acceptance/01_vars/02_functions/013.cf index 4e493478c13..37821656b07 100644 --- a/tests/acceptance/01_vars/02_functions/013.cf +++ b/tests/acceptance/01_vars/02_functions/013.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/014.cf b/tests/acceptance/01_vars/02_functions/014.cf index c981a70bac4..ba82a13c2bc 100644 --- a/tests/acceptance/01_vars/02_functions/014.cf +++ b/tests/acceptance/01_vars/02_functions/014.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\.", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "\.", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/015.cf b/tests/acceptance/01_vars/02_functions/015.cf index f96df7ab224..9071d657bdc 100644 --- a/tests/acceptance/01_vars/02_functions/015.cf +++ b/tests/acceptance/01_vars/02_functions/015.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/016.cf b/tests/acceptance/01_vars/02_functions/016.cf index 2b7482ddb8f..c646ecc710f 100644 --- a/tests/acceptance/01_vars/02_functions/016.cf +++ b/tests/acceptance/01_vars/02_functions/016.cf @@ -38,8 +38,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/017.cf b/tests/acceptance/01_vars/02_functions/017.cf index 0b15619d31e..3a61a27d7e5 100644 --- a/tests/acceptance/01_vars/02_functions/017.cf +++ b/tests/acceptance/01_vars/02_functions/017.cf @@ -38,8 +38,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/018.cf b/tests/acceptance/01_vars/02_functions/018.cf index 4173999135b..29a8a437490 100644 --- a/tests/acceptance/01_vars/02_functions/018.cf +++ b/tests/acceptance/01_vars/02_functions/018.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/019.cf b/tests/acceptance/01_vars/02_functions/019.cf index d269fda0c69..ce2cd9145e0 100644 --- a/tests/acceptance/01_vars/02_functions/019.cf +++ b/tests/acceptance/01_vars/02_functions/019.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "X", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "X", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/020.cf b/tests/acceptance/01_vars/02_functions/020.cf index 3a1a1fe0723..2429c9eb059 100644 --- a/tests/acceptance/01_vars/02_functions/020.cf +++ b/tests/acceptance/01_vars/02_functions/020.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", "\s", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", "\s", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/021.cf b/tests/acceptance/01_vars/02_functions/021.cf index f62d85462bb..1e86c7e129e 100644 --- a/tests/acceptance/01_vars/02_functions/021.cf +++ b/tests/acceptance/01_vars/02_functions/021.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" slist => readstringlist("$(G.testfile)", "NoComment", ",", 5, 100), + "nums" + slist => readstringlist("$(G.testfile)", "NoComment", ",", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/024.cf b/tests/acceptance/01_vars/02_functions/024.cf index 6f7382d12d2..fa2da9fc34b 100644 --- a/tests/acceptance/01_vars/02_functions/024.cf +++ b/tests/acceptance/01_vars/02_functions/024.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/025.cf b/tests/acceptance/01_vars/02_functions/025.cf index 4c7c07f1079..b138c0f236c 100644 --- a/tests/acceptance/01_vars/02_functions/025.cf +++ b/tests/acceptance/01_vars/02_functions/025.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/026.cf b/tests/acceptance/01_vars/02_functions/026.cf index 5e0ea912cc8..20a3158df7a 100644 --- a/tests/acceptance/01_vars/02_functions/026.cf +++ b/tests/acceptance/01_vars/02_functions/026.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/027.cf b/tests/acceptance/01_vars/02_functions/027.cf index 75e7c539cd5..84930ea5a8a 100644 --- a/tests/acceptance/01_vars/02_functions/027.cf +++ b/tests/acceptance/01_vars/02_functions/027.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\.", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "\.", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/028.cf b/tests/acceptance/01_vars/02_functions/028.cf index 850cbb5fc44..7ac8f774d9b 100644 --- a/tests/acceptance/01_vars/02_functions/028.cf +++ b/tests/acceptance/01_vars/02_functions/028.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/029.cf b/tests/acceptance/01_vars/02_functions/029.cf index b15d19dcffa..09ff4b92689 100644 --- a/tests/acceptance/01_vars/02_functions/029.cf +++ b/tests/acceptance/01_vars/02_functions/029.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/030.cf b/tests/acceptance/01_vars/02_functions/030.cf index 3938eda2acb..83d89216bf1 100644 --- a/tests/acceptance/01_vars/02_functions/030.cf +++ b/tests/acceptance/01_vars/02_functions/030.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/031.cf b/tests/acceptance/01_vars/02_functions/031.cf index dd199a7d122..2fb7d1e63f9 100644 --- a/tests/acceptance/01_vars/02_functions/031.cf +++ b/tests/acceptance/01_vars/02_functions/031.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/032.cf b/tests/acceptance/01_vars/02_functions/032.cf index 2c0d4cf6c0f..2827c7dd1b5 100644 --- a/tests/acceptance/01_vars/02_functions/032.cf +++ b/tests/acceptance/01_vars/02_functions/032.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "X", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "X", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/033.cf b/tests/acceptance/01_vars/02_functions/033.cf index 7e3a5d367d3..59680fe18f8 100644 --- a/tests/acceptance/01_vars/02_functions/033.cf +++ b/tests/acceptance/01_vars/02_functions/033.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", "\s", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", "\s", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/034.cf b/tests/acceptance/01_vars/02_functions/034.cf index 38abced469c..7ac2dcfaef1 100644 --- a/tests/acceptance/01_vars/02_functions/034.cf +++ b/tests/acceptance/01_vars/02_functions/034.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" ilist => readintlist("$(G.testfile)", "NoComment", ",", 5, 100), + "nums" + ilist => readintlist("$(G.testfile)", "NoComment", ",", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/037.cf b/tests/acceptance/01_vars/02_functions/037.cf index 6e65a785ceb..860710e89d7 100644 --- a/tests/acceptance/01_vars/02_functions/037.cf +++ b/tests/acceptance/01_vars/02_functions/037.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/038.cf b/tests/acceptance/01_vars/02_functions/038.cf index 4fc8fb18a79..303a3915e56 100644 --- a/tests/acceptance/01_vars/02_functions/038.cf +++ b/tests/acceptance/01_vars/02_functions/038.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/039.cf b/tests/acceptance/01_vars/02_functions/039.cf index 6f72f753c8c..0e67007ee63 100644 --- a/tests/acceptance/01_vars/02_functions/039.cf +++ b/tests/acceptance/01_vars/02_functions/039.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/040.cf b/tests/acceptance/01_vars/02_functions/040.cf index 4c10aaa8d9d..5b8cee5c36a 100644 --- a/tests/acceptance/01_vars/02_functions/040.cf +++ b/tests/acceptance/01_vars/02_functions/040.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/041.cf b/tests/acceptance/01_vars/02_functions/041.cf index 7fefc1cb209..99c50764f8e 100644 --- a/tests/acceptance/01_vars/02_functions/041.cf +++ b/tests/acceptance/01_vars/02_functions/041.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/042.cf b/tests/acceptance/01_vars/02_functions/042.cf index a1e160b2a42..bbd55f03c90 100644 --- a/tests/acceptance/01_vars/02_functions/042.cf +++ b/tests/acceptance/01_vars/02_functions/042.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/043.cf b/tests/acceptance/01_vars/02_functions/043.cf index 54b5bff2c65..27fcc3ddfb3 100644 --- a/tests/acceptance/01_vars/02_functions/043.cf +++ b/tests/acceptance/01_vars/02_functions/043.cf @@ -37,8 +37,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/044.cf b/tests/acceptance/01_vars/02_functions/044.cf index a28458dcc12..81690b5133d 100644 --- a/tests/acceptance/01_vars/02_functions/044.cf +++ b/tests/acceptance/01_vars/02_functions/044.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\s+", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/045.cf b/tests/acceptance/01_vars/02_functions/045.cf index 4aaa3c1fd7f..5fe7c79764e 100644 --- a/tests/acceptance/01_vars/02_functions/045.cf +++ b/tests/acceptance/01_vars/02_functions/045.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "X", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "X", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/046.cf b/tests/acceptance/01_vars/02_functions/046.cf index 251535cd8bb..895e665f796 100644 --- a/tests/acceptance/01_vars/02_functions/046.cf +++ b/tests/acceptance/01_vars/02_functions/046.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\s", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\s", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/047.cf b/tests/acceptance/01_vars/02_functions/047.cf index b6b1384ee9b..456b7637def 100644 --- a/tests/acceptance/01_vars/02_functions/047.cf +++ b/tests/acceptance/01_vars/02_functions/047.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", ",", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", ",", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/050.cf b/tests/acceptance/01_vars/02_functions/050.cf index b53302a9df0..659225ef5d5 100644 --- a/tests/acceptance/01_vars/02_functions/050.cf +++ b/tests/acceptance/01_vars/02_functions/050.cf @@ -36,8 +36,10 @@ body delete init_delete bundle agent test { vars: - "nums" rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100), + "nums" + rlist => readreallist("$(G.testfile)", "NoComment", "\.", 5, 100), if => fileexists("$(G.testfile)"); + "sum" real => sum("nums"); } diff --git a/tests/acceptance/01_vars/02_functions/410.cf b/tests/acceptance/01_vars/02_functions/410.cf index e05695088a1..3a0fa32e4bf 100644 --- a/tests/acceptance/01_vars/02_functions/410.cf +++ b/tests/acceptance/01_vars/02_functions/410.cf @@ -48,8 +48,10 @@ body delete init_delete bundle agent test { vars: - "cnt" int => readstringarray("ary", "$(G.testfile)", "^#.*", ":+", 10, 14), + "cnt" + int => readstringarray("ary", "$(G.testfile)", "^#.*", ":+", 10, 14), if => fileexists("$(G.testfile)"); + "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/420.cf b/tests/acceptance/01_vars/02_functions/420.cf index 122a91e0c22..fb6947473ea 100644 --- a/tests/acceptance/01_vars/02_functions/420.cf +++ b/tests/acceptance/01_vars/02_functions/420.cf @@ -42,7 +42,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000), + "teststr" + string => readfile("$(G.testfile)", 1000), if => fileexists("$(G.testfile)"); "cnt" diff --git a/tests/acceptance/01_vars/02_functions/421.cf b/tests/acceptance/01_vars/02_functions/421.cf index 9c5fb087d24..d571a65a372 100644 --- a/tests/acceptance/01_vars/02_functions/421.cf +++ b/tests/acceptance/01_vars/02_functions/421.cf @@ -42,7 +42,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000), + "teststr" + string => readfile("$(G.testfile)", 1000), if => fileexists("$(G.testfile)"); "cnt" diff --git a/tests/acceptance/01_vars/02_functions/447.cf b/tests/acceptance/01_vars/02_functions/447.cf index 0632d00fc67..43379594bbf 100644 --- a/tests/acceptance/01_vars/02_functions/447.cf +++ b/tests/acceptance/01_vars/02_functions/447.cf @@ -48,8 +48,10 @@ body delete init_delete bundle agent test { vars: - "cnt" int => readstringarrayidx("ary", "$(G.testfile)", "", ":", 10, 1000), + "cnt" + int => readstringarrayidx("ary", "$(G.testfile)", "", ":", 10, 1000), if => fileexists("$(G.testfile)"); + "num" int => "9"; } diff --git a/tests/acceptance/01_vars/02_functions/520.cf b/tests/acceptance/01_vars/02_functions/520.cf index d1ab666bce3..b592f86c158 100644 --- a/tests/acceptance/01_vars/02_functions/520.cf +++ b/tests/acceptance/01_vars/02_functions/520.cf @@ -41,8 +41,10 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000), + "teststr" + string => readfile("$(G.testfile)", 1000), if => fileexists("$(G.testfile)"); + "cnt" int => parseintarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/521.cf b/tests/acceptance/01_vars/02_functions/521.cf index 84233e9db8b..79bc5877efe 100644 --- a/tests/acceptance/01_vars/02_functions/521.cf +++ b/tests/acceptance/01_vars/02_functions/521.cf @@ -41,8 +41,10 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000), + "teststr" + string => readfile("$(G.testfile)", 1000), if => fileexists("$(G.testfile)"); + "cnt" int => parseintarray("ary", "$(teststr)", "NoComment", ":", 10, 1000); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/620.cf b/tests/acceptance/01_vars/02_functions/620.cf index 50f06d423e9..cdcb767c6ea 100644 --- a/tests/acceptance/01_vars/02_functions/620.cf +++ b/tests/acceptance/01_vars/02_functions/620.cf @@ -41,7 +41,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000), + "teststr" + string => readfile("$(G.testfile)", 1000), if => fileexists("$(G.testfile)"); "cnt" diff --git a/tests/acceptance/01_vars/02_functions/621.cf b/tests/acceptance/01_vars/02_functions/621.cf index dc908d968cd..db38a789d46 100644 --- a/tests/acceptance/01_vars/02_functions/621.cf +++ b/tests/acceptance/01_vars/02_functions/621.cf @@ -41,7 +41,8 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000), + "teststr" + string => readfile("$(G.testfile)", 1000), if => fileexists("$(G.testfile)"); "cnt" diff --git a/tests/acceptance/01_vars/02_functions/CFE-2704-0.error.pass.cf b/tests/acceptance/01_vars/02_functions/CFE-2704-0.error.pass.cf index 06279efded8..8ea6f4a21ca 100644 --- a/tests/acceptance/01_vars/02_functions/CFE-2704-0.error.pass.cf +++ b/tests/acceptance/01_vars/02_functions/CFE-2704-0.error.pass.cf @@ -1,7 +1,6 @@ # This is an .error.pass.cf test, because mergedata() is given data # which is not a container on purpose and logs an error, the test checks # that the agent does not crash. - body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/01_vars/02_functions/CFE-2704-1.error.pass.cf b/tests/acceptance/01_vars/02_functions/CFE-2704-1.error.pass.cf index 10acfccee9a..7538a59b762 100644 --- a/tests/acceptance/01_vars/02_functions/CFE-2704-1.error.pass.cf +++ b/tests/acceptance/01_vars/02_functions/CFE-2704-1.error.pass.cf @@ -1,7 +1,6 @@ # This is an .error.pass.cf test, because mergedata() is given data # which is not a container on purpose and logs an error, the test checks # that the agent does not crash. - body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/01_vars/02_functions/findfiles_up.cf b/tests/acceptance/01_vars/02_functions/findfiles_up.cf index faf55b5abb3..3cfd153bb36 100755 --- a/tests/acceptance/01_vars/02_functions/findfiles_up.cf +++ b/tests/acceptance/01_vars/02_functions/findfiles_up.cf @@ -53,7 +53,8 @@ bundle agent test data => findfiles_up("$(G.testdir)/core/libntech/libutils/", "string.?"), if => isdir("$(G.testdir)/core/libntech/libutils/"); - "t3" data => findfiles_up("$(G.testdir)/core/libntech/libutils/", ".git/"), + "t3" + data => findfiles_up("$(G.testdir)/core/libntech/libutils/", ".git/"), if => isdir("$(G.testdir)/core/libntech/libutils/"); "t4" diff --git a/tests/acceptance/01_vars/02_functions/getfields.cf b/tests/acceptance/01_vars/02_functions/getfields.cf index b1f1adc32f8..037a0e86e59 100644 --- a/tests/acceptance/01_vars/02_functions/getfields.cf +++ b/tests/acceptance/01_vars/02_functions/getfields.cf @@ -41,7 +41,8 @@ body delete init_delete bundle agent test { vars: - "num_matching" int => getfields("t.*", "$(G.testfile)", ":", "fields"), + "num_matching" + int => getfields("t.*", "$(G.testfile)", ":", "fields"), if => fileexists("$(G.testfile)"); } diff --git a/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf b/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf index 25a0bbce723..9c0ff0128b3 100644 --- a/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf +++ b/tests/acceptance/01_vars/02_functions/long_string_from_text_file.cf @@ -26,7 +26,9 @@ bundle agent test { vars: "keyfile" string => "$(G.testfile).data"; - "keys" slist => readstringlist("$(keyfile)", "#[^\n]*", "\n", 10, 3072), + + "keys" + slist => readstringlist("$(keyfile)", "#[^\n]*", "\n", 10, 3072), if => fileexists("$(keyfile)"); } diff --git a/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf b/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf index 79539da135d..6443272ee0f 100644 --- a/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf +++ b/tests/acceptance/01_vars/02_functions/parsestringarray_weird_indices_real_comments_noemptyfields2.cf @@ -48,8 +48,10 @@ body delete init_delete bundle agent test { vars: - "teststr" string => readfile("$(G.testfile)", 1000), + "teststr" + string => readfile("$(G.testfile)", 1000), if => fileexists("$(G.testfile)"); + "cnt" int => parsestringarray("ary", "$(teststr)", "^#.*", ":+", 10, 14); "num" int => "3"; } diff --git a/tests/acceptance/01_vars/02_functions/read_empty_file.cf b/tests/acceptance/01_vars/02_functions/read_empty_file.cf index d1f37354b8a..ca4281153a6 100644 --- a/tests/acceptance/01_vars/02_functions/read_empty_file.cf +++ b/tests/acceptance/01_vars/02_functions/read_empty_file.cf @@ -15,9 +15,12 @@ bundle agent init bundle agent test { vars: - "value1" string => readfile("$(G.testfile)", 10000), + "value1" + string => readfile("$(G.testfile)", 10000), if => fileexists("$(G.testfile)"); - "value2" string => readfile("$(G.testfile)", 0), + + "value2" + string => readfile("$(G.testfile)", 0), if => fileexists("$(G.testfile)"); } diff --git a/tests/acceptance/01_vars/02_functions/regextract.cf b/tests/acceptance/01_vars/02_functions/regextract.cf index e356e5f0879..ff7c86c7c9f 100644 --- a/tests/acceptance/01_vars/02_functions/regextract.cf +++ b/tests/acceptance/01_vars/02_functions/regextract.cf @@ -32,7 +32,9 @@ bundle agent test "lefts" string => "$(init.pair[1])"; "lefti" int => "$(init.pair[1])"; "rights" string => "$(init.pair[2])"; - "rightr" real => "$(init.pair[2])", + + "rightr" + real => "$(init.pair[2])", if => isvariable("init.pair[2]"); } diff --git a/tests/acceptance/01_vars/04_containers/readjson.cf b/tests/acceptance/01_vars/04_containers/readjson.cf index 3317af28d2f..4774201ddf4 100644 --- a/tests/acceptance/01_vars/04_containers/readjson.cf +++ b/tests/acceptance/01_vars/04_containers/readjson.cf @@ -40,7 +40,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024), + "load" + data => readjson("$(G.testfile).json", 1024), if => fileexists("$(G.testfile).json"); files: diff --git a/tests/acceptance/01_vars/04_containers/readjson_arrays.cf b/tests/acceptance/01_vars/04_containers/readjson_arrays.cf index bc120e55e8a..6e96734d8ca 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_arrays.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_arrays.cf @@ -43,7 +43,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024), + "load" + data => readjson("$(G.testfile).json", 1024), if => fileexists("$(G.testfile).json"); files: diff --git a/tests/acceptance/01_vars/04_containers/readjson_new.cf b/tests/acceptance/01_vars/04_containers/readjson_new.cf index a411f6614b9..ebc1f19ff6b 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_new.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_new.cf @@ -40,7 +40,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json"), + "load" + data => readjson("$(G.testfile).json"), if => fileexists("$(G.testfile).json"); files: diff --git a/tests/acceptance/01_vars/04_containers/readjson_null.cf b/tests/acceptance/01_vars/04_containers/readjson_null.cf index 92309aa6386..e9115b410cc 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_null.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_null.cf @@ -39,7 +39,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024), + "load" + data => readjson("$(G.testfile).json", 1024), if => fileexists("$(G.testfile).json"); files: diff --git a/tests/acceptance/01_vars/04_containers/readjson_objects.cf b/tests/acceptance/01_vars/04_containers/readjson_objects.cf index 54422b46662..8ba8cf47110 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_objects.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_objects.cf @@ -40,7 +40,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024), + "load" + data => readjson("$(G.testfile).json", 1024), if => fileexists("$(G.testfile).json"); files: diff --git a/tests/acceptance/01_vars/04_containers/readjson_scalar.cf b/tests/acceptance/01_vars/04_containers/readjson_scalar.cf index ba32e03860b..859aee42cc2 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_scalar.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_scalar.cf @@ -39,7 +39,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024), + "load" + data => readjson("$(G.testfile).json", 1024), if => fileexists("$(G.testfile).json"); files: diff --git a/tests/acceptance/01_vars/04_containers/readjson_subindex.cf b/tests/acceptance/01_vars/04_containers/readjson_subindex.cf index bd669b3ddae..51f0ae06df6 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_subindex.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_subindex.cf @@ -41,7 +41,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024), + "load" + data => readjson("$(G.testfile).json", 1024), if => fileexists("$(G.testfile).json"); files: diff --git a/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf b/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf index 17d8c7fadf2..dce9a2b4bf7 100644 --- a/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf +++ b/tests/acceptance/01_vars/04_containers/readjson_subindex_quoted.cf @@ -41,7 +41,8 @@ bundle edit_line init_insert_lines bundle agent test { vars: - "load" data => readjson("$(G.testfile).json", 1024), + "load" + data => readjson("$(G.testfile).json", 1024), if => fileexists("$(G.testfile).json"); files: diff --git a/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf b/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf index ad2062ed2d1..8f661fa559d 100644 --- a/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf +++ b/tests/acceptance/02_classes/02_functions/classesmatching_inherit_2.cf @@ -59,7 +59,8 @@ bundle agent check "defined_classes: defined_in_second$(const.n)" ); - "actual" string => readfile("$(common.logfile)", inf), + "actual" + string => readfile("$(common.logfile)", inf), if => fileexists("$(common.logfile)"); reports: diff --git a/tests/acceptance/05_processes/01_matching/process_select_fncalls.error.pass.cf b/tests/acceptance/05_processes/01_matching/process_select_fncalls.error.pass.cf index bba2f72dacd..cccdc262618 100644 --- a/tests/acceptance/05_processes/01_matching/process_select_fncalls.error.pass.cf +++ b/tests/acceptance/05_processes/01_matching/process_select_fncalls.error.pass.cf @@ -1,6 +1,5 @@ # This is an .error.pass.cf test, because getuid() is called for the # non-existent user 'nosuchuser' on purpose and logs errors (CFE-1968). - body common control { inputs => { "../../default.sub.cf" }; diff --git a/tests/acceptance/08_commands/arglist.cf b/tests/acceptance/08_commands/arglist.cf index 1948f33e815..bbf52686c0d 100644 --- a/tests/acceptance/08_commands/arglist.cf +++ b/tests/acceptance/08_commands/arglist.cf @@ -46,8 +46,10 @@ bundle agent test bundle agent check { vars: - "actual" string => readfile("$(G.testfile).actual"), + "actual" + string => readfile("$(G.testfile).actual"), if => fileexists("$(G.testfile).actual"); + "expected" string => "one two three diff --git a/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf b/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf index 43b9fac0d5d..9f0836b75d8 100644 --- a/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf +++ b/tests/acceptance/10_files/09_insert_lines/multi-files-dirs.cf @@ -54,11 +54,17 @@ bundle agent check vars: "expect" string => "one two three test"; "results" slist => { "resultA", "resultB", "resultC" }; - "resultA" string => readfile("$(G.testdir)/dirA/testfa", "33"), + + "resultA" + string => readfile("$(G.testdir)/dirA/testfa", "33"), if => fileexists("$(G.testdir)/dirA/testfa"); - "resultB" string => readfile("$(G.testdir)/dirB/testfb", "33"), + + "resultB" + string => readfile("$(G.testdir)/dirB/testfb", "33"), if => fileexists("$(G.testdir)/dirB/testfb"); - "resultC" string => readfile("$(G.testdir)/dirC/testfc", "33"), + + "resultC" + string => readfile("$(G.testdir)/dirC/testfc", "33"), if => fileexists("$(G.testdir)/dirC/testfc"); classes: diff --git a/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf b/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf index d39a6f50b73..c2c4e60f067 100644 --- a/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf +++ b/tests/acceptance/10_files/09_insert_lines/preserve_block_blank_lines.cf @@ -38,7 +38,9 @@ bundle agent check Bad 3 "; - "actual" string => readfile("$(init.test_file)", "inf"), + + "actual" + string => readfile("$(init.test_file)", "inf"), if => fileexists("$(init.test_file)"); classes: diff --git a/tests/acceptance/10_files/templating/empty_template_empty_file.cf b/tests/acceptance/10_files/templating/empty_template_empty_file.cf index 38cc6730655..f41409d8de4 100644 --- a/tests/acceptance/10_files/templating/empty_template_empty_file.cf +++ b/tests/acceptance/10_files/templating/empty_template_empty_file.cf @@ -53,7 +53,9 @@ bundle agent check { vars: "expect" string => ""; - "actual" string => readfile("$(G.testfile)", 1000), + + "actual" + string => readfile("$(G.testfile)", 1000), if => fileexists("$(G.testfile)"); classes: diff --git a/tests/acceptance/10_files/templating/large_template_blocks.cf b/tests/acceptance/10_files/templating/large_template_blocks.cf index 2f3fedeba3a..c6c77f527aa 100644 --- a/tests/acceptance/10_files/templating/large_template_blocks.cf +++ b/tests/acceptance/10_files/templating/large_template_blocks.cf @@ -50,7 +50,9 @@ bundle agent check { vars: "expected" int => "110"; - "actual" int => countlinesmatching(".*0123456789.*", "$(G.testfile)"), + + "actual" + int => countlinesmatching(".*0123456789.*", "$(G.testfile)"), if => fileexists("$(G.testfile)"); classes: diff --git a/tests/acceptance/10_files/templating/mustache_container_serialization.cf b/tests/acceptance/10_files/templating/mustache_container_serialization.cf index d41dcf9e398..b626ce3cea3 100644 --- a/tests/acceptance/10_files/templating/mustache_container_serialization.cf +++ b/tests/acceptance/10_files/templating/mustache_container_serialization.cf @@ -64,7 +64,9 @@ bundle edit_line readthem { vars: "test" slist => { @(test.test) }; - "read_$(test)" string => readfile("$(G.testdir)/$(test)", 1k), + + "read_$(test)" + string => readfile("$(G.testdir)/$(test)", 1k), if => fileexists("$(G.testdir)/$(test)"); insert_lines: diff --git a/tests/acceptance/10_files/templating/mustache_datastate_demo.cf b/tests/acceptance/10_files/templating/mustache_datastate_demo.cf index 43f2cc0a920..ee5724997ab 100644 --- a/tests/acceptance/10_files/templating/mustache_datastate_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_datastate_demo.cf @@ -101,7 +101,8 @@ bundle agent check }" '; - "actual" string => readfile("$(G.testfile)", inf), + "actual" + string => readfile("$(G.testfile)", inf), if => fileexists("$(G.testfile)"); classes: diff --git a/tests/acceptance/10_files/templating/mustache_demo.cf b/tests/acceptance/10_files/templating/mustache_demo.cf index 3b016edaedb..1e321f5bbb5 100644 --- a/tests/acceptance/10_files/templating/mustache_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_demo.cf @@ -49,7 +49,9 @@ bundle agent check { vars: "expect" string => readfile("$(init.origtestdir)/demo.expected", 10000); - "actual" string => readfile("$(G.testfile)", 10000), + + "actual" + string => readfile("$(G.testfile)", 10000), if => fileexists("$(G.testfile)"); classes: diff --git a/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf b/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf index 52b0077414c..3092114d1d9 100644 --- a/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf +++ b/tests/acceptance/10_files/templating/mustache_expect_list_find_string.cf @@ -85,9 +85,13 @@ bundle agent test vars: "template" string => "$(this.promise_filename).mustache"; - "actual_good" string => readfile("$(G.testfile).good", 4096), + + "actual_good" + string => readfile("$(G.testfile).good", 4096), if => fileexists("$(G.testfile).good"); - "actual_bad" string => readfile("$(G.testfile).bad", 4096), + + "actual_bad" + string => readfile("$(G.testfile).bad", 4096), if => fileexists("$(G.testfile).bad"); } diff --git a/tests/acceptance/10_files/templating/mustache_html_escape.cf b/tests/acceptance/10_files/templating/mustache_html_escape.cf index 2f4a3b958eb..e3d85d91240 100644 --- a/tests/acceptance/10_files/templating/mustache_html_escape.cf +++ b/tests/acceptance/10_files/templating/mustache_html_escape.cf @@ -54,7 +54,9 @@ bundle agent check { vars: "expect" string => readfile("$(this.promise_filename).expected", 10000); - "actual" string => readfile("$(G.testfile)", 10000), + + "actual" + string => readfile("$(G.testfile)", 10000), if => fileexists("$(G.testfile)"); classes: diff --git a/tests/acceptance/10_files/templating/mustache_inline_demo.cf b/tests/acceptance/10_files/templating/mustache_inline_demo.cf index 6ae16b65a4d..97c841e004a 100644 --- a/tests/acceptance/10_files/templating/mustache_inline_demo.cf +++ b/tests/acceptance/10_files/templating/mustache_inline_demo.cf @@ -52,7 +52,8 @@ bundle agent check "expect" string => readfile("$(init.origtestdir)/inline_demo.expected", 10000); - "actual" string => readfile("$(G.testfile)", 10000), + "actual" + string => readfile("$(G.testfile)", 10000), if => fileexists("$(G.testfile)"); classes: diff --git a/tests/acceptance/10_files/templating/mustache_render_quote.cf b/tests/acceptance/10_files/templating/mustache_render_quote.cf index 4def7b9364b..1d70e421b53 100644 --- a/tests/acceptance/10_files/templating/mustache_render_quote.cf +++ b/tests/acceptance/10_files/templating/mustache_render_quote.cf @@ -54,7 +54,9 @@ bundle agent check { vars: "expect" string => readfile("$(this.promise_filename).expected", 4000); - "actual" string => readfile("$(G.testfile)", 4000), + + "actual" + string => readfile("$(G.testfile)", 4000), if => fileexists("$(G.testfile)"); classes: diff --git a/tests/acceptance/10_files/templating/mustache_repair_existing.cf b/tests/acceptance/10_files/templating/mustache_repair_existing.cf index 2429e350ed6..c7c78943fed 100644 --- a/tests/acceptance/10_files/templating/mustache_repair_existing.cf +++ b/tests/acceptance/10_files/templating/mustache_repair_existing.cf @@ -50,7 +50,9 @@ bundle agent check { vars: "expect" string => readfile("$(init.origtestdir)/demo.expected", 4096); - "actual" string => readfile("$(G.testfile)", 4096), + + "actual" + string => readfile("$(G.testfile)", 4096), if => fileexists("$(G.testfile)"); classes: diff --git a/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf b/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf index 4976b216f4c..d5ea9e47962 100644 --- a/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf +++ b/tests/acceptance/15_control/01_common/classic_evaluation_custom_promise_types.cf @@ -23,14 +23,16 @@ bundle agent test "/tmp/dummyfile" smth => "hello"; vars: - "content" string => readfile("/tmp/dummyfile"), + "content" + string => readfile("/tmp/dummyfile"), if => fileexists("/tmp/dummyfile"); files: "/tmp/dummyfile" content => "ok"; vars: - "content" string => readfile("/tmp/dummyfile"), + "content" + string => readfile("/tmp/dummyfile"), if => fileexists("/tmp/dummyfile"); classes: diff --git a/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf b/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf index 3fedb3a4bcd..1a06957f2e9 100644 --- a/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf +++ b/tests/acceptance/15_control/01_common/classic_evaluation_long_policy.cf @@ -34,8 +34,10 @@ bundle agent test "/tmp/example" content => "fourth"; vars: - "content" string => readfile("/tmp/example"), + "content" + string => readfile("/tmp/example"), if => fileexists("/tmp/example"); + "result" string => concat("$(result)", ", $(content)"); classes: @@ -49,7 +51,8 @@ bundle agent test "/tmp/otherfile" content => "something"; vars: - "othercontent" string => readfile("/tmp/otherfile"), + "othercontent" + string => readfile("/tmp/otherfile"), if => fileexists("/tmp/otherfile"); files: diff --git a/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf b/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf index a60342fd22b..01151c1248f 100644 --- a/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf +++ b/tests/acceptance/15_control/01_common/top_down_evaluation_long_policy.cf @@ -34,8 +34,10 @@ bundle agent test "/tmp/example" content => "fourth"; vars: - "content" string => readfile("/tmp/example"), + "content" + string => readfile("/tmp/example"), if => fileexists("/tmp/example"); + "result" string => concat("$(result)", ", $(content)"); classes: @@ -49,7 +51,8 @@ bundle agent test "/tmp/otherfile" content => "something"; vars: - "othercontent" string => readfile("/tmp/otherfile"), + "othercontent" + string => readfile("/tmp/otherfile"), if => fileexists("/tmp/otherfile"); files: diff --git a/tests/acceptance/31_tickets/CFE-3866/test.cf b/tests/acceptance/31_tickets/CFE-3866/test.cf index c90c082ed48..dd8c0a1d98d 100644 --- a/tests/acceptance/31_tickets/CFE-3866/test.cf +++ b/tests/acceptance/31_tickets/CFE-3866/test.cf @@ -68,7 +68,9 @@ bundle agent check "expected" string => "[section] key=value "; - "actual" string => readfile("$(G.testfile)", "1000"), + + "actual" + string => readfile("$(G.testfile)", "1000"), if => fileexists("$(G.testfile)"); classes: From 4fda97e2a6c69d7039dc8d98f6b4de7ba38ade94 Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Thu, 22 Oct 2026 16:00:02 -0500 Subject: [PATCH 18/22] Fixed unsafe and check_syntax.cf acceptance tests logging errors Ticket: CFE-3041 Signed-off-by: Nick Anderson (cherry picked from commit 14691f584c114467f91efa76f944458f7104589f) --- tests/acceptance/04_examples/syntax/check_syntax.cf | 2 +- tests/acceptance/10_files/unsafe/02_immutable.cf | 3 ++- tests/acceptance/10_files/unsafe/03_immutable.cf | 3 ++- tests/acceptance/10_files/unsafe/05_immutable.cf | 3 ++- tests/acceptance/10_files/unsafe/06_immutable.cf | 3 ++- tests/acceptance/10_files/unsafe/09_immutable.cf | 3 ++- tests/acceptance/10_files/unsafe/10_immutable.cf | 3 ++- tests/acceptance/10_files/unsafe/14_immutable_content.cf | 6 +++++- tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf | 6 +++++- tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf | 6 +++++- .../10_files/unsafe/17_immutable_template_mustache.cf | 6 +++++- .../10_files/unsafe/18_immutable_template_cfengine.cf | 6 +++++- tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf | 6 +++++- .../unsafe/20_immutable_template_inline_mustache.cf | 6 +++++- ...irst-found-group-perms-if-no-listed-candidate-matches.cf | 3 ++- ...first-found-user-perms-if-no-listed-candidate-matches.cf | 3 ++- 16 files changed, 52 insertions(+), 16 deletions(-) diff --git a/tests/acceptance/04_examples/syntax/check_syntax.cf b/tests/acceptance/04_examples/syntax/check_syntax.cf index 347329a35a5..420f58e4f94 100644 --- a/tests/acceptance/04_examples/syntax/check_syntax.cf +++ b/tests/acceptance/04_examples/syntax/check_syntax.cf @@ -124,7 +124,7 @@ bundle agent test_example(file) classes: "failure_$(cfile)" - not => returnszero("$(checker) $(file)", "noshell"), + not => returnszero("$(checker) $(file) >/dev/null 2>&1", "useshell"), scope => "namespace"; reports: diff --git a/tests/acceptance/10_files/unsafe/02_immutable.cf b/tests/acceptance/10_files/unsafe/02_immutable.cf index e078b05411d..edfb5f49db5 100644 --- a/tests/acceptance/10_files/unsafe/02_immutable.cf +++ b/tests/acceptance/10_files/unsafe/02_immutable.cf @@ -49,7 +49,8 @@ bundle agent check { vars: "expected" string => "But agent can override"; - "actual" string => readfile("$(global.testfile)"); + "actual" string => readfile("$(global.testfile)"), + if => fileexists("$(global.testfile)"); classes: "ok" expression => strcmp("$(actual)", "$(expected)"); diff --git a/tests/acceptance/10_files/unsafe/03_immutable.cf b/tests/acceptance/10_files/unsafe/03_immutable.cf index 97c0f81d88a..a24fd68d6aa 100644 --- a/tests/acceptance/10_files/unsafe/03_immutable.cf +++ b/tests/acceptance/10_files/unsafe/03_immutable.cf @@ -50,7 +50,8 @@ bundle agent check { vars: "expected" string => "But agent can override"; - "actual" string => readfile("$(global.testfile)"); + "actual" string => readfile("$(global.testfile)"), + if => fileexists("$(global.testfile)"); classes: "ok" expression => strcmp("$(actual)", "$(expected)"); diff --git a/tests/acceptance/10_files/unsafe/05_immutable.cf b/tests/acceptance/10_files/unsafe/05_immutable.cf index e96b3b9dba1..2f4efe522b4 100644 --- a/tests/acceptance/10_files/unsafe/05_immutable.cf +++ b/tests/acceptance/10_files/unsafe/05_immutable.cf @@ -57,7 +57,8 @@ bundle agent check "expected" string => "I'm immutable$(const.n)But agent can override$(const.n)"; - "actual" string => readfile("$(global.testfile)"); + "actual" string => readfile("$(global.testfile)"), + if => fileexists("$(global.testfile)"); classes: "ok" expression => strcmp("$(actual)", "$(expected)"); diff --git a/tests/acceptance/10_files/unsafe/06_immutable.cf b/tests/acceptance/10_files/unsafe/06_immutable.cf index f105c62fcb3..d27447c4181 100644 --- a/tests/acceptance/10_files/unsafe/06_immutable.cf +++ b/tests/acceptance/10_files/unsafe/06_immutable.cf @@ -56,7 +56,8 @@ bundle agent check "expected" string => '$(const.n)But agent can override$(const.n)'; - "actual" string => readfile("$(global.testfile)"); + "actual" string => readfile("$(global.testfile)"), + if => fileexists("$(global.testfile)"); classes: "ok" expression => strcmp("$(actual)", "$(expected)"); diff --git a/tests/acceptance/10_files/unsafe/09_immutable.cf b/tests/acceptance/10_files/unsafe/09_immutable.cf index 4b96b6acbe5..0671ce93604 100644 --- a/tests/acceptance/10_files/unsafe/09_immutable.cf +++ b/tests/acceptance/10_files/unsafe/09_immutable.cf @@ -56,7 +56,8 @@ bundle agent check { vars: "expected" string => "Hello larsewi!"; - "actual" string => readfile("$(global.testfile)"); + "actual" string => readfile("$(global.testfile)"), + if => fileexists("$(global.testfile)"); classes: "ok" expression => strcmp("$(actual)", "$(expected)"); diff --git a/tests/acceptance/10_files/unsafe/10_immutable.cf b/tests/acceptance/10_files/unsafe/10_immutable.cf index 855e245f777..fdf7af314f6 100644 --- a/tests/acceptance/10_files/unsafe/10_immutable.cf +++ b/tests/acceptance/10_files/unsafe/10_immutable.cf @@ -62,7 +62,8 @@ bundle agent check { vars: "expected" string => ".*user:root:rwx.*"; - "acls" slist => getacls("$(global.testfile)", "access"); + "acls" slist => getacls("$(global.testfile)", "access"), + if => fileexists("$(global.testfile)"); classes: "ok" expression => some("$(expected)", "acls"); diff --git a/tests/acceptance/10_files/unsafe/14_immutable_content.cf b/tests/acceptance/10_files/unsafe/14_immutable_content.cf index ffaab2545df..5b3b7fc15a3 100644 --- a/tests/acceptance/10_files/unsafe/14_immutable_content.cf +++ b/tests/acceptance/10_files/unsafe/14_immutable_content.cf @@ -46,6 +46,10 @@ bundle agent check ), with => regex_replace("$(this.promise_filename)", "\.cf$", ".sub.cf", ""); + # Indent the sub-agent output in the DEBUG report, so that errors it + # prints are not mistaken for errors of the test by testall + "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + classes: "ok" expression => regcmp( @@ -61,7 +65,7 @@ bundle agent check DEBUG:: "$(this.bundle): agent exited '$(run[exit_code])', output was:"; - "$(run[output])"; + "$(output_indented)"; } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf b/tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf index 45859a7fcdf..15ada3f246d 100644 --- a/tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf +++ b/tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf @@ -48,6 +48,10 @@ bundle agent check ), with => regex_replace("$(this.promise_filename)", "\.cf$", ".sub.cf", ""); + # Indent the sub-agent output in the DEBUG report, so that errors it + # prints are not mistaken for errors of the test by testall + "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + classes: "ok" expression => regcmp( @@ -63,7 +67,7 @@ bundle agent check DEBUG:: "$(this.bundle): agent exited '$(run[exit_code])', output was:"; - "$(run[output])"; + "$(output_indented)"; } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf b/tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf index 0c8865bdecb..a4af0e32ffd 100644 --- a/tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf +++ b/tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf @@ -49,6 +49,10 @@ bundle agent check ), with => regex_replace("$(this.promise_filename)", "\.cf$", ".sub.cf", ""); + # Indent the sub-agent output in the DEBUG report, so that errors it + # prints are not mistaken for errors of the test by testall + "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + classes: "ok" expression => regcmp( @@ -64,7 +68,7 @@ bundle agent check DEBUG:: "$(this.bundle): agent exited '$(run[exit_code])', output was:"; - "$(run[output])"; + "$(output_indented)"; } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/17_immutable_template_mustache.cf b/tests/acceptance/10_files/unsafe/17_immutable_template_mustache.cf index b1f3963649a..3040e15f0aa 100644 --- a/tests/acceptance/10_files/unsafe/17_immutable_template_mustache.cf +++ b/tests/acceptance/10_files/unsafe/17_immutable_template_mustache.cf @@ -49,6 +49,10 @@ bundle agent check ), with => regex_replace("$(this.promise_filename)", "\.cf$", ".sub.cf", ""); + # Indent the sub-agent output in the DEBUG report, so that errors it + # prints are not mistaken for errors of the test by testall + "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + classes: "ok" expression => regcmp( @@ -64,7 +68,7 @@ bundle agent check DEBUG:: "$(this.bundle): agent exited '$(run[exit_code])', output was:"; - "$(run[output])"; + "$(output_indented)"; } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/18_immutable_template_cfengine.cf b/tests/acceptance/10_files/unsafe/18_immutable_template_cfengine.cf index 49beabe0694..723656fd63b 100644 --- a/tests/acceptance/10_files/unsafe/18_immutable_template_cfengine.cf +++ b/tests/acceptance/10_files/unsafe/18_immutable_template_cfengine.cf @@ -50,6 +50,10 @@ bundle agent check ), with => regex_replace("$(this.promise_filename)", "\.cf$", ".sub.cf", ""); + # Indent the sub-agent output in the DEBUG report, so that errors it + # prints are not mistaken for errors of the test by testall + "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + classes: "ok" expression => regcmp( @@ -65,7 +69,7 @@ bundle agent check DEBUG:: "$(this.bundle): agent exited '$(run[exit_code])', output was:"; - "$(run[output])"; + "$(output_indented)"; } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf b/tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf index 4f08284cfac..df580fc39a5 100644 --- a/tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf +++ b/tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf @@ -48,6 +48,10 @@ bundle agent check ), with => regex_replace("$(this.promise_filename)", "\.cf$", ".sub.cf", ""); + # Indent the sub-agent output in the DEBUG report, so that errors it + # prints are not mistaken for errors of the test by testall + "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + classes: "ok" expression => regcmp( @@ -63,7 +67,7 @@ bundle agent check DEBUG:: "$(this.bundle): agent exited '$(run[exit_code])', output was:"; - "$(run[output])"; + "$(output_indented)"; } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/20_immutable_template_inline_mustache.cf b/tests/acceptance/10_files/unsafe/20_immutable_template_inline_mustache.cf index 2adaad5c3e3..a4d1b208c35 100644 --- a/tests/acceptance/10_files/unsafe/20_immutable_template_inline_mustache.cf +++ b/tests/acceptance/10_files/unsafe/20_immutable_template_inline_mustache.cf @@ -49,6 +49,10 @@ bundle agent check ), with => regex_replace("$(this.promise_filename)", "\.cf$", ".sub.cf", ""); + # Indent the sub-agent output in the DEBUG report, so that errors it + # prints are not mistaken for errors of the test by testall + "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + classes: "ok" expression => regcmp( @@ -64,7 +68,7 @@ bundle agent check DEBUG:: "$(this.bundle): agent exited '$(run[exit_code])', output was:"; - "$(run[output])"; + "$(output_indented)"; } bundle agent destroy diff --git a/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf b/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf index 00a8a5afc08..8c3f908cd70 100644 --- a/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf +++ b/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf @@ -69,7 +69,8 @@ bundle agent check { vars: "observed_gid" string => filestat($(G.testfile), gid); - "desired_gid" int => getgid("pr_gr_1"); + "desired_gid" int => getgid("pr_gr_1"), + if => groupexists("pr_gr_1"); reports: "$(this.promise_filename) Pass" diff --git a/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf b/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf index 2d7325fc70a..c1cad67424c 100644 --- a/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf +++ b/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf @@ -39,7 +39,8 @@ bundle agent check { vars: "observed_uid" string => filestat($(G.testfile), uid); - "desired_uid" int => getuid("pr_us_1"); + "desired_uid" int => getuid("pr_us_1"), + if => userexists("pr_us_1"); reports: "$(this.promise_filename) Pass" From 9536faaa25a677ce240d546c8f128d1659815bfb Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Thu, 22 Oct 2026 16:04:47 -0500 Subject: [PATCH 19/22] Fixed formatting of acceptance tests Ticket: CFE-3041 Signed-off-by: Nick Anderson (cherry picked from commit 5c6c04321f31cb4d36e6eb4bb43b9dbcabbdd774) --- tests/acceptance/10_files/unsafe/02_immutable.cf | 4 +++- tests/acceptance/10_files/unsafe/03_immutable.cf | 4 +++- tests/acceptance/10_files/unsafe/05_immutable.cf | 3 ++- tests/acceptance/10_files/unsafe/06_immutable.cf | 3 ++- tests/acceptance/10_files/unsafe/09_immutable.cf | 4 +++- tests/acceptance/10_files/unsafe/10_immutable.cf | 4 +++- tests/acceptance/10_files/unsafe/14_immutable_content.cf | 3 ++- tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf | 3 ++- tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf | 3 ++- .../10_files/unsafe/17_immutable_template_mustache.cf | 3 ++- .../10_files/unsafe/18_immutable_template_cfengine.cf | 3 ++- tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf | 3 ++- .../10_files/unsafe/20_immutable_template_inline_mustache.cf | 3 ++- ...-first-found-group-perms-if-no-listed-candidate-matches.cf | 4 +++- ...s-first-found-user-perms-if-no-listed-candidate-matches.cf | 4 +++- 15 files changed, 36 insertions(+), 15 deletions(-) diff --git a/tests/acceptance/10_files/unsafe/02_immutable.cf b/tests/acceptance/10_files/unsafe/02_immutable.cf index edfb5f49db5..47a1dc2ea8a 100644 --- a/tests/acceptance/10_files/unsafe/02_immutable.cf +++ b/tests/acceptance/10_files/unsafe/02_immutable.cf @@ -49,7 +49,9 @@ bundle agent check { vars: "expected" string => "But agent can override"; - "actual" string => readfile("$(global.testfile)"), + + "actual" + string => readfile("$(global.testfile)"), if => fileexists("$(global.testfile)"); classes: diff --git a/tests/acceptance/10_files/unsafe/03_immutable.cf b/tests/acceptance/10_files/unsafe/03_immutable.cf index a24fd68d6aa..4e6ddaa683c 100644 --- a/tests/acceptance/10_files/unsafe/03_immutable.cf +++ b/tests/acceptance/10_files/unsafe/03_immutable.cf @@ -50,7 +50,9 @@ bundle agent check { vars: "expected" string => "But agent can override"; - "actual" string => readfile("$(global.testfile)"), + + "actual" + string => readfile("$(global.testfile)"), if => fileexists("$(global.testfile)"); classes: diff --git a/tests/acceptance/10_files/unsafe/05_immutable.cf b/tests/acceptance/10_files/unsafe/05_immutable.cf index 2f4efe522b4..87d2c85ddf5 100644 --- a/tests/acceptance/10_files/unsafe/05_immutable.cf +++ b/tests/acceptance/10_files/unsafe/05_immutable.cf @@ -57,7 +57,8 @@ bundle agent check "expected" string => "I'm immutable$(const.n)But agent can override$(const.n)"; - "actual" string => readfile("$(global.testfile)"), + "actual" + string => readfile("$(global.testfile)"), if => fileexists("$(global.testfile)"); classes: diff --git a/tests/acceptance/10_files/unsafe/06_immutable.cf b/tests/acceptance/10_files/unsafe/06_immutable.cf index d27447c4181..c04b5c5f510 100644 --- a/tests/acceptance/10_files/unsafe/06_immutable.cf +++ b/tests/acceptance/10_files/unsafe/06_immutable.cf @@ -56,7 +56,8 @@ bundle agent check "expected" string => '$(const.n)But agent can override$(const.n)'; - "actual" string => readfile("$(global.testfile)"), + "actual" + string => readfile("$(global.testfile)"), if => fileexists("$(global.testfile)"); classes: diff --git a/tests/acceptance/10_files/unsafe/09_immutable.cf b/tests/acceptance/10_files/unsafe/09_immutable.cf index 0671ce93604..9b133625559 100644 --- a/tests/acceptance/10_files/unsafe/09_immutable.cf +++ b/tests/acceptance/10_files/unsafe/09_immutable.cf @@ -56,7 +56,9 @@ bundle agent check { vars: "expected" string => "Hello larsewi!"; - "actual" string => readfile("$(global.testfile)"), + + "actual" + string => readfile("$(global.testfile)"), if => fileexists("$(global.testfile)"); classes: diff --git a/tests/acceptance/10_files/unsafe/10_immutable.cf b/tests/acceptance/10_files/unsafe/10_immutable.cf index fdf7af314f6..9815ecc2621 100644 --- a/tests/acceptance/10_files/unsafe/10_immutable.cf +++ b/tests/acceptance/10_files/unsafe/10_immutable.cf @@ -62,7 +62,9 @@ bundle agent check { vars: "expected" string => ".*user:root:rwx.*"; - "acls" slist => getacls("$(global.testfile)", "access"), + + "acls" + slist => getacls("$(global.testfile)", "access"), if => fileexists("$(global.testfile)"); classes: diff --git a/tests/acceptance/10_files/unsafe/14_immutable_content.cf b/tests/acceptance/10_files/unsafe/14_immutable_content.cf index 5b3b7fc15a3..0b01e255768 100644 --- a/tests/acceptance/10_files/unsafe/14_immutable_content.cf +++ b/tests/acceptance/10_files/unsafe/14_immutable_content.cf @@ -48,7 +48,8 @@ bundle agent check # Indent the sub-agent output in the DEBUG report, so that errors it # prints are not mistaken for errors of the test by testall - "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + "output_indented" + string => regex_replace("$(run[output])", "^", " | ", "gm"); classes: "ok" diff --git a/tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf b/tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf index 15ada3f246d..d3fbc9504bb 100644 --- a/tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf +++ b/tests/acceptance/10_files/unsafe/15_immutable_edit_line.cf @@ -50,7 +50,8 @@ bundle agent check # Indent the sub-agent output in the DEBUG report, so that errors it # prints are not mistaken for errors of the test by testall - "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + "output_indented" + string => regex_replace("$(run[output])", "^", " | ", "gm"); classes: "ok" diff --git a/tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf b/tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf index a4af0e32ffd..c718109c35a 100644 --- a/tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf +++ b/tests/acceptance/10_files/unsafe/16_immutable_copy_from.cf @@ -51,7 +51,8 @@ bundle agent check # Indent the sub-agent output in the DEBUG report, so that errors it # prints are not mistaken for errors of the test by testall - "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + "output_indented" + string => regex_replace("$(run[output])", "^", " | ", "gm"); classes: "ok" diff --git a/tests/acceptance/10_files/unsafe/17_immutable_template_mustache.cf b/tests/acceptance/10_files/unsafe/17_immutable_template_mustache.cf index 3040e15f0aa..5d2861bda61 100644 --- a/tests/acceptance/10_files/unsafe/17_immutable_template_mustache.cf +++ b/tests/acceptance/10_files/unsafe/17_immutable_template_mustache.cf @@ -51,7 +51,8 @@ bundle agent check # Indent the sub-agent output in the DEBUG report, so that errors it # prints are not mistaken for errors of the test by testall - "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + "output_indented" + string => regex_replace("$(run[output])", "^", " | ", "gm"); classes: "ok" diff --git a/tests/acceptance/10_files/unsafe/18_immutable_template_cfengine.cf b/tests/acceptance/10_files/unsafe/18_immutable_template_cfengine.cf index 723656fd63b..a0a98401259 100644 --- a/tests/acceptance/10_files/unsafe/18_immutable_template_cfengine.cf +++ b/tests/acceptance/10_files/unsafe/18_immutable_template_cfengine.cf @@ -52,7 +52,8 @@ bundle agent check # Indent the sub-agent output in the DEBUG report, so that errors it # prints are not mistaken for errors of the test by testall - "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + "output_indented" + string => regex_replace("$(run[output])", "^", " | ", "gm"); classes: "ok" diff --git a/tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf b/tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf index df580fc39a5..a5ee0e8177c 100644 --- a/tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf +++ b/tests/acceptance/10_files/unsafe/19_immutable_edit_xml.cf @@ -50,7 +50,8 @@ bundle agent check # Indent the sub-agent output in the DEBUG report, so that errors it # prints are not mistaken for errors of the test by testall - "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + "output_indented" + string => regex_replace("$(run[output])", "^", " | ", "gm"); classes: "ok" diff --git a/tests/acceptance/10_files/unsafe/20_immutable_template_inline_mustache.cf b/tests/acceptance/10_files/unsafe/20_immutable_template_inline_mustache.cf index a4d1b208c35..115f1c6650e 100644 --- a/tests/acceptance/10_files/unsafe/20_immutable_template_inline_mustache.cf +++ b/tests/acceptance/10_files/unsafe/20_immutable_template_inline_mustache.cf @@ -51,7 +51,8 @@ bundle agent check # Indent the sub-agent output in the DEBUG report, so that errors it # prints are not mistaken for errors of the test by testall - "output_indented" string => regex_replace("$(run[output])", "^", " | ", "gm"); + "output_indented" + string => regex_replace("$(run[output])", "^", " | ", "gm"); classes: "ok" diff --git a/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf b/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf index 8c3f908cd70..ab2172503ed 100644 --- a/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf +++ b/tests/acceptance/10_files/unsafe/multiple-group-candidates-first-found-group-perms-if-no-listed-candidate-matches.cf @@ -69,7 +69,9 @@ bundle agent check { vars: "observed_gid" string => filestat($(G.testfile), gid); - "desired_gid" int => getgid("pr_gr_1"), + + "desired_gid" + int => getgid("pr_gr_1"), if => groupexists("pr_gr_1"); reports: diff --git a/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf b/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf index c1cad67424c..2da83d66422 100644 --- a/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf +++ b/tests/acceptance/10_files/unsafe/multiple-owner-candidates-first-found-user-perms-if-no-listed-candidate-matches.cf @@ -39,7 +39,9 @@ bundle agent check { vars: "observed_uid" string => filestat($(G.testfile), uid); - "desired_uid" int => getuid("pr_us_1"), + + "desired_uid" + int => getuid("pr_us_1"), if => userexists("pr_us_1"); reports: From 2d91fc467ed7e20197b8cbbb4e2c0d1ab50582e9 Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Fri, 23 Oct 2026 14:10:52 -0500 Subject: [PATCH 20/22] Fixed mapdata_json_pipe.cf logging errors Ticket: CFE-3041 (cherry picked from commit 3e5e69024b9781491c5576e364f9ed48364a22b9) --- tests/acceptance/01_vars/02_functions/mapdata_json_pipe.cf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/01_vars/02_functions/mapdata_json_pipe.cf b/tests/acceptance/01_vars/02_functions/mapdata_json_pipe.cf index 1a3d32ece7d..3f354cc6b33 100644 --- a/tests/acceptance/01_vars/02_functions/mapdata_json_pipe.cf +++ b/tests/acceptance/01_vars/02_functions/mapdata_json_pipe.cf @@ -19,7 +19,12 @@ bundle agent test vars: "items" data => '{"user":"stedolan","titles":["JQ Primer", "More JQ"]}'; - "items_passthrough" data => mapdata("json_pipe", "$(G.cat)", items); + + # G comes from dynamically loaded dcs.sub.cf, so $(G.cat) is unresolved + # during pre-evaluation and json_pipe would execute it literally + "items_passthrough" + data => mapdata("json_pipe", "$(G.cat)", items), + if => isvariable("G.cat"); "items_jqinput" data => mapdata( From 244c09a310abb2219c09d898b2854ff447d180da Mon Sep 17 00:00:00 2001 From: Ihor Aleksandrychiev Date: Mon, 26 Oct 2026 11:21:27 +0200 Subject: [PATCH 21/22] Made .error.pass.cf tests respect soft fails and skips The errorpass branch only checked for logged errors and the Pass message, so a test marked test_soft_fail or test_skip_unsupported was reported as FAIL (e.g. process_select_fncalls.error.pass.cf on Windows, which soft fails due to ENT-10217 and logs no errors there). Errorpass tests now go through the regular outcome handling and only differ in requiring at least one logged error on Pass. (cherry picked from commit a73a0c1e00046bbc81fc93f19250a30d6ce74336) --- tests/acceptance/testall | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/tests/acceptance/testall b/tests/acceptance/testall index bac12595d0c..d6eb27b6c70 100755 --- a/tests/acceptance/testall +++ b/tests/acceptance/testall @@ -573,26 +573,8 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR RESULT=FAIL RESULT_MSG="${COLOR_FAILURE}FAIL (No errors printed)${COLOR_NORMAL}" fi - elif [ $TEST_TYPE = errorpass ] - then - ESCAPED_TEST="$(echo "($TEST|dcs.sub.cf)" | sed -e 's/\./\\./g')" - if [ $RETVAL != 0 ] - then - RESULT=FAIL - RESULT_MSG="${COLOR_FAILURE}FAIL (NON-ZERO EXIT CODE!)${COLOR_NORMAL}" - elif ! grep -F 'error: ' "$OUTFILE" > /dev/null - then - RESULT=FAIL - RESULT_MSG="${COLOR_FAILURE}FAIL (No error message!)${COLOR_NORMAL}" - elif ! grep -E "R: .*$ESCAPED_TEST Pass" $OUTFILE > /dev/null - then - RESULT=FAIL - RESULT_MSG="${COLOR_FAILURE}FAIL (Pass not printed!)${COLOR_NORMAL}" - else - RESULT=Pass - RESULT_MSG="${COLOR_SUCCESS}Pass${COLOR_NORMAL}" - fi - else # TEST_TYPE is not errorlog or errorexit or errorpass + else # TEST_TYPE is not errorlog or errorexit (errorpass is handled here + # too, so that soft fails and skips work for it) # We need to be careful when matching test outcomes. Because of convergence # passes, a test may output FAIL before it outputs Pass; in this case the # latter trumps the former. Also be careful when matching an [XS]FAIL; the @@ -647,7 +629,17 @@ export CFENGINE_TEST_OVERRIDE_WORKDIR TEMP CFENGINE_TEST_OVERRIDE_EXTENSION_LIBR then # Regular tests must not log errors, tests which are expected # to log errors should be named *.error.cf or *.error.pass.cf - if grep -E '^ *error: ' $OUTFILE > /dev/null + if [ $TEST_TYPE = errorpass ] + then + if grep -F 'error: ' "$OUTFILE" > /dev/null + then + RESULT=Pass + RESULT_MSG="${COLOR_SUCCESS}Pass${COLOR_NORMAL}" + else + RESULT=FAIL + RESULT_MSG="${COLOR_FAILURE}FAIL (No error message!)${COLOR_NORMAL}" + fi + elif grep -E '^ *error: ' $OUTFILE > /dev/null then RESULT=FAIL RESULT_MSG="${COLOR_FAILURE}FAIL (Error printed)${COLOR_NORMAL}" From eaa665d67fa5ed3916c378ec71553a696675297e Mon Sep 17 00:00:00 2001 From: Nick Anderson Date: Tue, 27 Oct 2026 21:34:20 -0500 Subject: [PATCH 22/22] Fixed diff_mode_ownership.cf logging errors Ticket: CFE-3041 Signed-off-by: Nick Anderson (cherry picked from commit 4cb9088142a6dc73e823925cfbd851dbd2124b7c) --- tests/acceptance/29_simulate_mode/diff_mode_ownership.cf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/acceptance/29_simulate_mode/diff_mode_ownership.cf b/tests/acceptance/29_simulate_mode/diff_mode_ownership.cf index 2fcde3b7ab2..80fb53de40c 100644 --- a/tests/acceptance/29_simulate_mode/diff_mode_ownership.cf +++ b/tests/acceptance/29_simulate_mode/diff_mode_ownership.cf @@ -36,7 +36,9 @@ bundle agent test bundle agent check { vars: - "actual" string => readfile("$(this.promise_filename).actual", inf); + "actual" + string => readfile("$(this.promise_filename).actual", inf), + if => fileexists("$(this.promise_filename).actual"); classes: "has_owner_change"