diff --git a/build_aux/ChangeLog b/build_aux/ChangeLog index 1fb7bf70b..97b51928b 100644 --- a/build_aux/ChangeLog +++ b/build_aux/ChangeLog @@ -1,4 +1,8 @@ +2023-02-06 Simon Sobisch + + * pre-inst-env.in: export COB_ON_CYGWIN for testsuite checks + 2023-01-21 Simon Sobisch * pre-inst-env.in: prefer config.status replacement over environment var diff --git a/build_aux/pre-inst-env.in b/build_aux/pre-inst-env.in index ffffbae2c..a99fc9dd4 100644 --- a/build_aux/pre-inst-env.in +++ b/build_aux/pre-inst-env.in @@ -65,6 +65,13 @@ export COB_CONFIG_DIR COB_COPY_DIR export LD_LIBRARY_PATH DYLD_LIBRARY_PATH SHLIB_PATH LIBPATH export COB_LIBRARY_PATH +# ensure we don't execute windows paths within programs generated by cygwin +# by passing a hint +if test "$OSTYPE" == "cygwin"; then + COB_ON_CYGWIN=1 + export COB_ON_CYGWIN +fi + # not robust check, but better than none if test "x${BASH_SOURCE}" != "x" -a "${BASH_SOURCE}" != "$0"; then echo "This script should not be sourced but called instead!" diff --git a/tests/ChangeLog b/tests/ChangeLog index cee4ac95b..51e255033 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -6,6 +6,14 @@ under MSVC Release, by forcing a flush of stdout with fflush and using cob_free instead of free in C codes +2023-02-06 Simon Sobisch + + * atlocal.in, atlocal_valgrind, atlocal_win: do not unset OS + as this is an external var we need to keep for win32 + * atlocal_valgrind, atlocal_win: added notes for things we + explicit don't want to do + * testsuite.src/run_file.at: skip OS recognition on cygwin + 2023-01-23 David Declerck * testsuite.src/configuration.at: test reading translation diff --git a/tests/atlocal.in b/tests/atlocal.in index ef679d979..3e65d8a8a 100644 --- a/tests/atlocal.in +++ b/tests/atlocal.in @@ -116,7 +116,7 @@ UNIFY_LISTING="@abs_srcdir@/listings-sed.sh" # test runner for manual tests, content may be adjusted by the user RUN_PROG_MANUAL="@abs_builddir@/run_prog_manual.sh" -# unset option if not internally set in this script +# unset option if not internally set in this script - or external _unset_option () { if test "$1" != "COB_CONFIG_DIR" \ -a "$1" != "COB_COPY_DIR" \ @@ -125,7 +125,8 @@ _unset_option () { -a "$1" != "COB_CFLAGS" \ -a "$1" != "COB_LDFLAGS" \ -a "$1" != "COB_LIBS" \ - -a "$1" != "COB_UNIX_LF"; then + -a "$1" != "COB_UNIX_LF" \ + -a "$1" != "OS"; then unset $1 fi } @@ -137,6 +138,13 @@ _return_path () { echo "$1" } +# ensure we don't execute windows paths within programs generated by cygwin +# by passing a hint +if test "$OSTYPE" == "cygwin"; then + COB_ON_CYGWIN=1 + export COB_ON_CYGWIN +fi + # Fix for testcases where cobc translates path to win32 equivalents if test "x$MSYSTEM" != "x"; then PATHSEP=";" @@ -147,7 +155,7 @@ if test "x$MSYSTEM" != "x"; then # the Win32 variant when starting the cobc process) COBCRUN=${ABS_COBCRUN} else - PATHSEP='@PATH_SEPARATOR@'; + PATHSEP='@PATH_SEPARATOR@' fi export PATHSEP diff --git a/tests/atlocal_valgrind b/tests/atlocal_valgrind index 38f00ccab..3a357fddd 100644 --- a/tests/atlocal_valgrind +++ b/tests/atlocal_valgrind @@ -121,7 +121,7 @@ COMPILE_MODULE="${COBC} -m ${FLAGS}" # test runner for manual tests, content may be adjusted by the user RUN_PROG_MANUAL="${abs_builddir}/run_prog_manual.sh" -# unset option if not internally set in this script +# unset option if not internally set in this script - or external _unset_option () { if test "$1" != "COB_CONFIG_DIR" \ -a "$1" != "COB_COPY_DIR" \ @@ -130,7 +130,8 @@ _unset_option () { -a "$1" != "COB_CFLAGS" \ -a "$1" != "COB_LDFLAGS" \ -a "$1" != "COB_LIBS" \ - -a "$1" != "COB_UNIX_LF"; then + -a "$1" != "COB_UNIX_LF" \ + -a "$1" != "OS"; then unset $1 fi } @@ -143,13 +144,12 @@ _return_path () { echo "$1" } -# Fix for testcases where cobc translates path to win32 equivalents -if test "x$MSYSTEM" != "x"; then - PATHSEP=";" -else - PATHSEP='@PATH_SEPARATOR@'; -fi -export PATHSEP +# Note: we explicit do not set COB_ON_CYGWIN here, +# as this is file is about running non-cygwin binaries + +# Note: we explicit do not handle PATHSEP here, +# as this is file is about running non-windows binaries +PATHSEP='@PATH_SEPARATOR@' # entries likely referenced in the LIBS entries below prefix="@prefix@" diff --git a/tests/atlocal_win b/tests/atlocal_win index 9158c7d03..959e8f0fa 100644 --- a/tests/atlocal_win +++ b/tests/atlocal_win @@ -58,7 +58,7 @@ COMPILE_MODULE="${COBC} -m ${FLAGS}" # test runner for manual tests, content may be adjusted by the user RUN_PROG_MANUAL="${abs_builddir}/run_prog_manual.sh" -# unset option if not internally set in this script +# unset option if not internally set in this script - or external _unset_option () { if test "$1" != "COB_CONFIG_DIR" \ -a "$1" != "COB_COPY_DIR" \ @@ -67,7 +67,8 @@ _unset_option () { -a "$1" != "COB_CFLAGS" \ -a "$1" != "COB_LDFLAGS" \ -a "$1" != "COB_LIBS" \ - -a "$1" != "COB_UNIX_LF"; then + -a "$1" != "COB_UNIX_LF" \ + -a "$1" != "OS"; then unset $1 fi } @@ -89,6 +90,9 @@ _return_path () { fi } +# Note: we explicit do not set COB_ON_CYGWIN here, +# as this is file is about running non-cygwin binaries + # Fix for testcases where cobc uses win32 paths internally PATHSEP=";" export PATHSEP diff --git a/tests/testsuite.src/run_file.at b/tests/testsuite.src/run_file.at index d9023f1a9..641c76914 100644 --- a/tests/testsuite.src/run_file.at +++ b/tests/testsuite.src/run_file.at @@ -1,4 +1,4 @@ -## Copyright (C) 2003-2012, 2014-2022 Free Software Foundation, Inc. +## Copyright (C) 2003-2012, 2014-2023 Free Software Foundation, Inc. ## Written by Keisuke Nishida, Roger While, Simon Sobisch, Ron Norman, ## Brian Tiffin, Joe Robbins, Edward Hart ## @@ -6645,7 +6645,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open input file1. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -6711,7 +6713,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open i-o file1 with lock. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -6779,7 +6783,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open input file1. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -6847,7 +6853,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open input file1. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -6919,7 +6927,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open i-o file1. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -7276,7 +7286,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open input file1. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -7350,7 +7362,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open input file1 with lock. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -7427,7 +7441,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open input file1. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -7504,7 +7520,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open input file1. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -7583,7 +7601,9 @@ AT_DATA([prog1.cob], [ open output file1. close file1. open input file1. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -7674,7 +7694,9 @@ AT_DATA([prog1.cob], [ read file1. if fs not = "00" display "FAILED 1::r fs=" fs. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -7765,7 +7787,9 @@ AT_DATA([prog1.cob], [ rewrite file1-rec. if fs not = "00" display "FAILED 1::rw fs=" fs. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -7852,7 +7876,9 @@ AT_DATA([prog1.cob], [ read file1 with lock. if fs not = "00" display "FAILED 1::r fs=" fs. - accept os-check from environment "OS". + accept os-check from environment "COB_ON_CYGWIN". + if os-check = spaces + accept os-check from environment "OS". if os-check = spaces accept os-check from environment "OS_NAME". inspect os-check converting "werfdosin" to "WERFDOSIN". @@ -26584,9 +26610,13 @@ AT_DATA([prog.cob], [ *>> fileio-sort currently returns constant length records MOVE 1-rsz(ix-1) TO rsz *>> END-OF-DETOUR - IF (1-rsz(ix-1) <> rsz) or - (1-rec(ix-1) <> file2-rec) - DISPLAY "FAILED" + IF (1-rsz(ix-1) <> rsz) + DISPLAY "FAILED Test " ix-1 ": " + 1-rsz(ix-1) " <> " rsz + END-IF + IF (1-rec(ix-1) <> file2-rec) + DISPLAY "FAILED Test " ix-1 ": " + 1-rec(ix-1) " <> " file2-rec END-IF END-PERFORM. CLOSE file2.