Skip to content

Commit

Permalink
Testsuite fixup for MacOS (from 5245)
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Feb 13, 2025
1 parent fba7cb2 commit 6a9bd44
Showing 1 changed file with 30 additions and 11 deletions.
41 changes: 30 additions & 11 deletions tests/testsuite.src/used_binaries.at
Original file line number Diff line number Diff line change
Expand Up @@ -1089,9 +1089,10 @@ AT_CLEANUP


AT_SETUP([check include header file])
#AT_KEYWORDS([include])
#AT_KEYWORDS([cobc copy])

AT_DATA([file.h], [
AT_DATA([filec.h], [
/* COB_EXT_IMPORT will be defined by libcob.h up-front */
COB_EXT_IMPORT void f (char *, long);
])
AT_DATA([prog.cob], [
Expand All @@ -1101,13 +1102,13 @@ AT_DATA([prog.cob], [
CALL "f" USING "Hello".
])

# No check, program seems correct
# dynamic call - program seems correct
AT_CHECK([$COMPILE_MODULE prog.cob], [0], [], [])

AT_CHECK([$COBC -m -fstatic-call prog.cob], [0], [], [])
# mismatch in function signature - we ignore the error output,
# as it depends on the C compiler in use
AT_CHECK([$COMPILE_MODULE --include $(_return_path "$(pwd)/filec.h") -fstatic-call prog.cob], [1], [], [ignore])

# We ignore the error output, as it depends on the C compiler in use

AT_CHECK([$COBC -m --include "$PWD/file.h" -fstatic-call prog.cob], [1], [], [ignore])
AT_DATA([prog2.cob], [
IDENTIFICATION DIVISION.
PROGRAM-ID. prog.
Expand All @@ -1118,9 +1119,24 @@ AT_DATA([prog2.cob], [
CALL "f" USING "Hello" BY VALUE long RETURNING NOTHING.
])

AT_CHECK([$COBC -m --include "$PWD/file.h" -fstatic-call prog2.cob], [0], [], [])
# note: we likely need to build an import library for some environments
AT_DATA([filec.c], [
/* for COB_EXT_EXPORT */
#include <libcob.h>
COB_EXT_IMPORT void f (char *str, long num) {};
])
AT_CHECK([$COMPILE_MODULE --save-temps filec.c -o libfoo.$COB_MODULE_EXT], [0], [], [])


AT_CHECK([$COBC -I . -m --include "file.h" -fstatic-call prog2.cob], [0], [], [])
# static build with correct function signature
AT_CHECK([$COMPILE_MODULE --include $(_return_path "$(pwd)/filec.h") -fstatic-call prog2.cob], [0], [], [], [
# Previous test "failed" --> retry with import library
AT_CHECK([$COMPILE_MODULE --include $(_return_path "$(pwd)/filec.h") -fstatic-call -lfilec prog2.cob], [0], [], [])]
)
AT_CHECK([$COMPILE_MODULE -I . --include "filec.h" -fstatic-call prog2.cob -o prog2b], [0], [], [], [
# Previous test "failed" --> retry with import library
AT_CHECK([$COMPILE_MODULE -I . --include "filec.h" -fstatic-call -lfilec prog2.cob -o prog2b], [0], [], [])]
)

# We can use --copy to check a CALL against a prototype. However, this
# feature is not fully supported by GnuCOBOL yet, so we get some
Expand All @@ -1140,8 +1156,11 @@ AT_DATA([f.copy], [
END PROGRAM f.
])

AT_CHECK([$COMPILE_MODULE -Wno-unfinished --copy "f.copy" -fstatic-call prog2.cob], [0], [],
AT_CHECK([$COMPILE_MODULE -Wno-unfinished --copy "f.copy" -fstatic-call prog2.cob -o prog2c], [0], [],
[prog2.cob:8: warning: unexpected RETURNING item
])
], [
# Previous test "failed" --> retry with import library
AT_CHECK([$COMPILE_MODULE -Wno-unfinished --copy "f.copy" -fstatic-call -lfilec prog2.cob -o prog2c], [0], [], ignore)]
)

AT_CLEANUP

0 comments on commit 6a9bd44

Please sign in to comment.