Skip to content

Commit

Permalink
Fix testsuite 8, 808 and 809 on Windows/MSYS2
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jan 18, 2024
1 parent c0d64ad commit 3327e68
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 30 deletions.
57 changes: 29 additions & 28 deletions tests/testsuite.src/run_misc.at
Original file line number Diff line number Diff line change
Expand Up @@ -10795,14 +10795,7 @@ AT_CHECK([diff reference tstdump.sed], [0], [], [])



AT_CHECK([$COMPILE prog.cob sub2.cob], [0], [], [])

# also checking that a dump file without anything to dump does not do anything
AT_CHECK([COB_STACKTRACE=1 COB_DUMP_FILE=tstdump.dump \
$COBCRUN_DIRECT ./prog], [1],
[X is 000000001
X is 000005441
],
AT_DATA([reference_stderr],
[libcob: cpyabrt:4: error: LINKAGE item 'TSPFL-RECORD' (accessed by 'CM-COMPANY') not passed by caller
libcob: cpyabrt:4: warning: implicit CLOSE of FLATFILE ('RELFIX')

Expand All @@ -10820,30 +10813,35 @@ libcob: cpyabrt:4: warning: implicit CLOSE of FLATFILE ('RELFIX')
Started by ./prog
])

AT_CAPTURE_FILE([stderr.txt])

AT_CHECK([$COMPILE prog.cob sub2.cob], [0], [], [])

# also checking that a dump file without anything to dump does not do anything
AT_CHECK([COB_STACKTRACE=1 COB_DUMP_FILE=tstdump.dump \
$COBCRUN_DIRECT ./prog 2>stderr.txt], [1],
[X is 000000001
X is 000005441
], [])

AT_CHECK([$SED -e 's/Started by .*prog.exe/Started by .\/prog/g' \
stderr.txt > stderr.sed], [0], [], [])

AT_CHECK([diff reference_stderr stderr.sed], [0], [], [])

AT_CHECK([$COMPILE -fdump=ALL -fno-dump prog.cob sub2.cob], [0], [], [])

# also checking that a dump file without anything to dump does not do anything
AT_CHECK([COB_STACKTRACE=1 COB_DUMP_FILE=tstdump.dump \
$COBCRUN_DIRECT ./prog], [1],
$COBCRUN_DIRECT ./prog 2>stderr.txt], [1],
[X is 000000001
X is 000005441
],
[libcob: cpyabrt:4: error: LINKAGE item 'TSPFL-RECORD' (accessed by 'CM-COMPANY') not passed by caller
libcob: cpyabrt:4: warning: implicit CLOSE of FLATFILE ('RELFIX')
], [])

Last statement of "sub1" was MOVE
MAIN-2 OF MAIN-1 at cpyabrt:4
MAIN-1 at prog.cob:177
ENTRY sub1 at prog.cob:159
Last statement of "sub2" was CALL
DO-CALL OF SubwaY at sub2.cob:48
ENTRY sub2 at sub2.cob:39
Last statement of "prog" was CALL
CALL-IT-OMIT at prog.cob:118
MAIN-100 at prog.cob:85
ENTRY prog at prog.cob:77
Started by ./prog
])
AT_CHECK([$SED -e 's/Started by .*prog.exe/Started by .\/prog/g' \
stderr.txt > stderr.sed], [0], [], [])

AT_CHECK([diff reference_stderr stderr.sed], [0], [], [])

AT_CHECK([$COMPILE -fdump=FD,LS prog.cob sub2.cob -o prog_fdls], [0], [], [])

Expand Down Expand Up @@ -10921,7 +10919,8 @@ END OF DUMP - prog

# AT_DATA workaround via sed:
AT_CHECK([$SED -e 's/_$//' reference_fdls_tmpl > reference], [0], [], [])
AT_CHECK([$SED -e 's/compiled ... .. .... ..:..:../compiled MMM DD YYYY HH:MM:SS/g' \
AT_CHECK([$SED -e 's/compiled ... .. .... ..:..:../compiled MMM DD YYYY HH:MM:SS/g;
s/Started by .*prog_fdls.exe/Started by .\/prog_fdls/g' \
tstdump_fdls.dump > tstdump.sed], [0], [], [])

AT_CHECK([diff reference tstdump.sed], [0], [], [])
Expand All @@ -10939,7 +10938,8 @@ libcob: cpyabrt:4: warning: implicit CLOSE of FLATFILE ('RELFIX')
dump written to tstdump_allfdls.dump
])

AT_CHECK([$SED -e 's/compiled ... .. .... ..:..:../compiled MMM DD YYYY HH:MM:SS/g' \
AT_CHECK([$SED -e 's/compiled ... .. .... ..:..:../compiled MMM DD YYYY HH:MM:SS/g;
s/Started by .*prog_allfdls.exe/Started by .\/prog_allfdls/g' \
tstdump_allfdls.dump > tstdump.sed], [0], [], [])

AT_CHECK([$SED -e 's/prog_fdls/prog_allfdls/' \
Expand Down Expand Up @@ -11272,7 +11272,8 @@ END OF DUMP - prog
])

# AT_DATA workaround via sed:
AT_CHECK([$SED -e 's/compiled ... .. .... ..:..:../compiled MMM DD YYYY HH:MM:SS/g' \
AT_CHECK([$SED -e 's/compiled ... .. .... ..:..:../compiled MMM DD YYYY HH:MM:SS/g;
s/Started by .*prog.exe/Started by .\/prog/g' \
dumpall.txt > dumpall.sed], [0], [], [])

AT_CHECK([test "$COB_HAS_64_BIT_POINTER" = "yes"], [0], [], [],
Expand Down
9 changes: 7 additions & 2 deletions tests/testsuite.src/used_binaries.at
Original file line number Diff line number Diff line change
Expand Up @@ -387,11 +387,16 @@ AT_DATA([prog.cob], [
EXIT PROGRAM.
])

AT_CHECK([TMPDIR="" TMP="notthere" TEMP="" $COMPILE prog.cob], [0], [],
# Note: on Windows, GCC/MinGW randomly fails when it can't access the temporary directory,
# so we only perform the COBOL-to-C translation. This is sufficient since the error we want
# to check is a compile-time error. Note that we nevertheless perform a full compilation
# afterwards, without tweaking the temporary, so that we can test the actual execution.
AT_CHECK([TMPDIR="" TMP="notthere" TEMP="" $COMPILE_ONLY prog.cob], [0], [],
[libcob: warning: Temporary directory TMP is invalid, adjust TMPDIR!
])
AT_CHECK([$COMPILE prog.cob], [0], [], [])
AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [OK], [])
AT_CHECK([TMPDIR="" TMP="" TEMP="./prog.cob" $COMPILE prog.cob], [0], [],
AT_CHECK([TMPDIR="" TMP="" TEMP="./prog.cob" $COMPILE_ONLY prog.cob], [0], [],
[libcob: warning: Temporary directory TEMP is invalid, adjust TMPDIR!
])
# TMPDIR is only checked when actually needed which is currently only the case
Expand Down

0 comments on commit 3327e68

Please sign in to comment.