Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/windows-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
# this is a "prepare" only step for this workflow only, so build
# without any optional packages as one-time build speeding up this part
../configure --without-db --without-curses --without-xml2 --without-json \
--without-iconv --disable-dependency-tracking
--without-iconv --disable-dependency-tracking CFLAGS=--std=c17

- name: Build GnuCOBOL Source Distribution
shell: msys2 {0}
Expand Down Expand Up @@ -133,7 +133,7 @@ jobs:
tar -xvf gnucobol*.tar.* --strip-components=1
mkdir _build
cd _build
../configure $CFGOPT
PATH="$PATH:/c/Program Files/Git/usr/bin" ../configure $CFGOPT CFLAGS=--std=c17

- name: Build GnuCOBOL
shell: msys2 {0}
Expand Down
4 changes: 4 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

2025-05-13 David Declerck <david.declerck@ocamlpro.com>

* configure.ac: testing working diff with the option to override by DIFF

2025-03-27 Simon Sobisch <simonsobisch@gnu.org>

* configure.ac: fix --without-iconv; use iconv includes, if necessary;
Expand Down
13 changes: 12 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,25 @@ AC_PROG_LEX([noyywrap])
AX_PROG_FLEX
AX_PROG_BISON

AC_CACHE_CHECK([for diff], [ac_cv_path_DIFF],
[AC_PATH_PROGS_FEATURE_CHECK([DIFF], [diff],
[[echo "x" > fx1 ; echo "x" > fx2 ; echo "y" > fy
"$ac_path_DIFF" fx1 fx2 >/dev/null ; res0=$?
"$ac_path_DIFF" fx1 fy >/dev/null ; res1=$?
rm -f fx1 fx2 fy
test $res0 = 0 -a $res1 = 1 \
&& ac_cv_path_DIFF="$ac_path_DIFF" ac_path_DIFF_found=:]],
[AC_MSG_ERROR([could not find a working diff])])])
AC_SUBST([DIFF], [$ac_cv_path_DIFF])

AC_ARG_VAR(DIFF_FLAGS, arguments passed to diff)
AC_MSG_CHECKING([for diff arguments])
case "$DIFF_FLAGS" in
*--strip-trailing-cr*)
AC_MSG_RESULT([specified as $DIFF_FLAGS])
;;
*)
diff $DIFF_FLAGS --strip-trailing-cr --version 1>/dev/null 2>&1
"$DIFF" $DIFF_FLAGS --strip-trailing-cr --version 1>/dev/null 2>&1
if test $? -eq 0; then
if test -z "$DIFF_FLAGS"; then
DIFF_FLAGS="--strip-trailing-cr"
Expand Down
6 changes: 6 additions & 0 deletions tests/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

2025-05-13 David Declerck <david.declerck@ocamlpro.com>

* atlocal.in, atlocal_win, cobol85/Makefile.am,
cobol85/Makefile.module.in, testsuite.src/*.at:
use the new DIFF variable to invoke the diff command

2025-03-16 Simon Sobisch <simonsobisch@gnu.org>

* atlocal.in: adjusted to handle newer MSYS2's setting OSTYPE=cygwin
Expand Down
7 changes: 7 additions & 0 deletions tests/atlocal.in
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,13 @@ else
ABS_COBCRUN="$(which cobcrun)"
fi

# We need to define a diff function, because:
# - we want autotest to use our custom diff command
# - the DIFF variable might contain spaces
diff() {
command "@DIFF@" @DIFF_FLAGS@ "$@"
}
DIFF=diff
AWK=@AWK@
GREP=@GREP@
SED=@SED@
Expand Down
1 change: 1 addition & 0 deletions tests/atlocal_win
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ LOCAL_ENV=""
PATH="${COB_WIN_BUILDPATH}:${PATH}"
export PATH

DIFF=diff
AWK=awk
GREP=grep
SED=sed
Expand Down
8 changes: 5 additions & 3 deletions tests/cobol85/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Makefile gnucobol/tests/cobol85
#
# Copyright (C) 2002-2012, 2015-2024 Free Software Foundation, Inc.
# Copyright (C) 2002-2012, 2015-2025 Free Software Foundation, Inc.
# Written by Keisuke Nishida, Roger While, Simon Sobisch
#
# This file is part of GnuCOBOL.
Expand Down Expand Up @@ -59,6 +59,7 @@ COBC_FLAGS = -std=cobol85 -debug $(COBOL_FLAGS)

CURL_FLAGS =
WGET_FLAGS = -t1 -T5
DIFF = @DIFF@
DIFF_FLAGS = @DIFF_FLAGS@

PRE_INST_ENV = "$(abs_top_builddir)/pre-inst-env"
Expand Down Expand Up @@ -163,7 +164,7 @@ diff:
@echo "Comparing test results for each module"
@retd=0; for m in $(MODULES); do \
echo "diff $$m/report.txt..."; \
diff $(DIFF_FLAGS) "$(srcdir)/$$m.txt" "$$m/report.txt"; \
"$(DIFF)" $(DIFF_FLAGS) "$(srcdir)/$$m.txt" "$$m/report.txt"; \
ret=$$? && if test $$ret -gt $$retd; then retd=$$ret; fi \
done; \
if test $$retd -gt 1; then exit $$retd; fi
Expand All @@ -175,7 +176,7 @@ diff-summary:
$(MAKE) summary.log
@echo "Comparing total test results..."
@echo "diff $(SUMMARY)..."
@diff $(DIFF_FLAGS) "$(srcdir)/$(SUMMARY)" "summary.log"
@"$(DIFF)" $(DIFF_FLAGS) "$(srcdir)/$(SUMMARY)" "summary.log"
@echo Done

newcob.val.Z:
Expand Down Expand Up @@ -246,6 +247,7 @@ $(MODULES_ALL): newcob.val EXEC85$(EXEEXT) $(srcdir)/EXEC85.conf.in Makefile.mod
@(export CBL_LIST="`ls $@/*.CBL | cut -f2 -d/ | tr '\n' ' '`" && \
$(SED) -e 's/##MODULE##/'"$@"'/' \
-e 's|##COB85DIR##|'$(abs_srcdir)'|' \
-e 's|##DIFF##|'"$(DIFF)"'|' \
-e 's|##DIFF_FLAGS##|'"$(DIFF_FLAGS)"'|' \
-e 's|##PERL##|'"$(PERL)"'|' \
-e 's|##TESTS##|'"` echo $$CBL_LIST | $(SED) -e 's/\.CBL//g'`"'|' \
Expand Down
7 changes: 4 additions & 3 deletions tests/cobol85/Makefile.module.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Makefile gnucobol/tests/cobol85/##MODULE##
#
# Copyright (C) 2002-2012, 2015-2020, 2022-2023 Free Software Foundation, Inc.
# Copyright (C) 2002-2012, 2015-2020, 2022-2023, 2025 Free Software Foundation, Inc.
# Written by Keisuke Nishida, Roger While, Simon Sobisch
#
# This file is part of GnuCOBOL.
Expand All @@ -23,6 +23,7 @@ TESTS = ##TESTS##
TESTS_LOCAL = ##TESTS_LOCAL##

RM = rm -rf
DIFF = ##DIFF##
DIFF_FLAGS = ##DIFF_FLAGS##

PERL = ##PERL##
Expand Down Expand Up @@ -61,7 +62,7 @@ test-local:
diff: report.txt
@echo
@echo "Comparing test results for module directory ##MODULE##"
@diff $(DIFF_FLAGS) ##COB85DIR##/##MODULE##.txt report.txt || true
@"$(DIFF)" $(DIFF_FLAGS) ##COB85DIR##/##MODULE##.txt report.txt || true

test-O:
@. ../../atconfig && . ../../atlocal && $(MAKE) $@-local
Expand Down Expand Up @@ -93,7 +94,7 @@ $(TESTS):
$(TESTS_LOCAL): libs-local
@echo "Running single test `echo $@ | sed -e 's|-.*||g'`"
@$(PERL) ##COB85DIR##/report.pl `echo $@ | sed -e 's|-.*||g'` 2>$@.log
@grep `echo $@ | sed -e 's|-.*||g'` ##COB85DIR##/##MODULE##.txt | diff - $@.log
@grep `echo $@ | sed -e 's|-.*||g'` ##COB85DIR##/##MODULE##.txt | "$(DIFF)" - $@.log
@rm -rf $@.log

clean: clean-log clean-db clean-debug clean-bin
Expand Down
28 changes: 14 additions & 14 deletions tests/testsuite.src/listings.at
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ AT_CHECK([$COMPILE_ONLY -t prog.lst -tlines=2 prog.cob], [0], [],
])

AT_CHECK([$UNIFY_LISTING prog.lst prog.lis], [0], [], [])
AT_CHECK([diff expected.lst prog.lis], [0], [], [])
AT_CHECK([$DIFF expected.lst prog.lis], [0], [], [])

AT_CLEANUP

Expand Down Expand Up @@ -1709,9 +1709,9 @@ SIZE TYPE LVL NAME PICTURE
# Check once with $COMPILE and once with $COMPILE_ONLY.
# This tests whether codegen affects the listing.
AT_CHECK([$COMPILE $LISTING_FLAGS -t prog.lst -ftsymbols prog.cob], [0], [], [])
AT_CHECK([diff prog20.lst prog.lst], [0], [], [])
AT_CHECK([$DIFF prog20.lst prog.lst], [0], [], [])
AT_CHECK([$COMPILE_LISTING -t prog2.lst -ftsymbols prog.cob], [0], [], [])
AT_CHECK([diff prog20.lst prog2.lst], [0], [], [])
AT_CHECK([$DIFF prog20.lst prog2.lst], [0], [], [])

AT_CHECK([rm -f prog.lst prog2.lst], [0], [], [])

Expand Down Expand Up @@ -1776,9 +1776,9 @@ SIZE TYPE LVL NAME PICTURE
# Check once with $COMPILE and once with $COMPILE_ONLY.
# This tests whether codegen affects the listing.
AT_CHECK([$COMPILE $LISTING_FLAGS -t prog.lst -ftsymbols progb.cob], [0], [], [])
AT_CHECK([diff prog20b.lst prog.lst], [0], [], [])
AT_CHECK([$DIFF prog20b.lst prog.lst], [0], [], [])
AT_CHECK([$COMPILE_LISTING -t prog2.lst -ftsymbols progb.cob], [0], [], [])
AT_CHECK([diff prog20b.lst prog2.lst], [0], [], [])
AT_CHECK([$DIFF prog20b.lst prog2.lst], [0], [], [])

AT_CHECK([rm -f prog.lst prog2.lst], [0], [], [])

Expand Down Expand Up @@ -1850,9 +1850,9 @@ progc.cob:13: error: syntax error, unexpected ., expecting DIVISION
# Check once with $COMPILE and once with $COMPILE_ONLY.
# This tests whether codegen affects the listing.
AT_CHECK([$COMPILE $LISTING_FLAGS -t prog.lst -ftsymbols progc.cob], [1], [], [ignore])
AT_CHECK([diff prog20c.lst prog.lst], [0], [], [])
AT_CHECK([$DIFF prog20c.lst prog.lst], [0], [], [])
AT_CHECK([$COMPILE_LISTING -t prog2.lst -ftsymbols progc.cob], [1], [], [ignore])
AT_CHECK([diff prog20c.lst prog2.lst], [0], [], [])
AT_CHECK([$DIFF prog20c.lst prog2.lst], [0], [], [])

AT_CLEANUP

Expand Down Expand Up @@ -2027,10 +2027,10 @@ prog-2.cob:16: warning: unreachable statement 'ACCEPT'
# This tests whether codegen affects the listing.

AT_CHECK([$COMPILE $LISTING_FLAGS -Wunreachable -t prog.lst -Xref -ftsymbols prog-1.cob prog-2.cob], [0], [], [ignore])
AT_CHECK([diff expected.lst prog.lst], [0], [], [])
AT_CHECK([$DIFF expected.lst prog.lst], [0], [], [])

AT_CHECK([$COMPILE_LISTING -Wunreachable -t prog.lst -Xref -ftsymbols prog-1.cob prog-2.cob], [0], [], [ignore])
AT_CHECK([diff expected.lst prog.lst], [0], [], [])
AT_CHECK([$DIFF expected.lst prog.lst], [0], [], [])

AT_CLEANUP

Expand Down Expand Up @@ -2307,12 +2307,12 @@ SIZE TYPE LVL NAME PICTURE

])

AT_CHECK([diff prog15-1.lst prog.lst], [0], [], [])
AT_CHECK([$DIFF prog15-1.lst prog.lst], [0], [], [])

# verify that the symbol listing is identical if full codegen was done
AT_CHECK([$COMPILE $LISTING_FLAGS -t prog2.lst -tlines=0 -fno-tsource -fno-tmessages -ftsymbols prog3.cob], [0], [], [])

AT_CHECK([diff prog15-1.lst prog2.lst], [0], [], [])
AT_CHECK([$DIFF prog15-1.lst prog2.lst], [0], [], [])

AT_CLEANUP

Expand Down Expand Up @@ -2478,7 +2478,7 @@ SIZE TYPE LVL NAME PICTURE
0 errors in compilation group
])

AT_CHECK([diff prog17-32.lst prog.lst], [0], [], [])
AT_CHECK([$DIFF prog17-32.lst prog.lst], [0], [], [])

,

Expand Down Expand Up @@ -2587,7 +2587,7 @@ SIZE TYPE LVL NAME PICTURE
0 errors in compilation group
])

AT_CHECK([diff prog17-64.lst prog.lst], [0], [], [])
AT_CHECK([$DIFF prog17-64.lst prog.lst], [0], [], [])

)

Expand Down Expand Up @@ -3666,7 +3666,7 @@ prog.cob:81: warning: uncommon parentheses
50 errors in compilation group
])

AT_CHECK([diff expected.lst prog.lst], [0])
AT_CHECK([$DIFF expected.lst prog.lst], [0])

AT_CLEANUP

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite.src/run_extensions.at
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ AT_DATA([reference],
040310Howdy 1 2 3<> 01***Abcdefghij. 34545656702***Abcdefghij. 45656767803***Abcdefghij. 567678789<>
])

AT_CHECK([diff reference SEQODO], [0], [], [])
AT_CHECK([$DIFF reference SEQODO], [0], [], [])

AT_CLEANUP

Expand Down
Loading
Loading