Skip to content

Commit

Permalink
Cygwin: testsuite: Drop using DejaGnu to run tests
Browse files Browse the repository at this point in the history
A more sophisticated (and modern) test harness would probably be useful,
but switching to Automake's built-in test harness gets us parallel test
execution, colourization of failures, simplifies matters, seems adequate
for the current testuite, and means we don't need to write any icky Tcl.

Signed-off-by: Jon Turney <[email protected]>
  • Loading branch information
jon-turney committed Jul 22, 2023
1 parent 971d2df commit a1ee8a0
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 149 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cygwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ jobs:
export MAKEFLAGS=-j$(nproc) &&
cd build &&
(export PATH=${{ matrix.target }}/winsup/testsuite/testinst/bin:${PATH} && cmd /c $(cygpath -wa ${{ matrix.target }}/winsup/cygserver/cygserver) &) &&
(cd ${{ matrix.target }}/winsup; make check || true)
(cd ${{ matrix.target }}/winsup; make check AM_COLOR_TESTS=always || true)
shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
2 changes: 1 addition & 1 deletion winsup/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AC_PREREQ([2.59])
AC_INIT([Cygwin],[0],[[email protected]],[cygwin],[https://cygwin.com])
AC_CONFIG_AUX_DIR(..)
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([dejagnu foreign no-define no-dist subdir-objects -Wall -Wno-portability -Wno-extra-portability])
AM_INIT_AUTOMAKE([foreign no-define no-dist subdir-objects -Wall -Wno-portability -Wno-extra-portability])
AM_SILENT_RULES([yes])

realdirpath() {
Expand Down
5 changes: 2 additions & 3 deletions winsup/doc/faq-programming.xml
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,8 @@ Building these programs can be disabled with the <literal>--without-cross-bootst
option to <literal>configure</literal>.
</para>

<!-- If you want to run the tests, <literal>dejagnu</literal>,
<literal>busybox</literal> and <literal>cygutils-extra<literal> are also
required. -->
<!-- If you want to run the tests <literal>busybox</literal> and
<literal>cygutils-extra<literal> are also required. -->

<para>
Building the documentation also requires the <literal>dblatex</literal>,
Expand Down
27 changes: 16 additions & 11 deletions winsup/testsuite/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -328,19 +328,23 @@ LDADD = $(builddir)/libltp.a $(builddir)/../cygwin/binmode.o $(LDADD_FOR_TESTDLL
# additional flags for specific test executables
winsup_api_devdsp_LDADD = -lwinmm $(LDADD)

DEJATOOL = winsup
# all tests
TESTS = $(check_PROGRAMS) \
mingw/cygload

# Add '-v' to RUNTESTFLAGS if V=1
RUNTESTFLAGS_1 = -v
RUNTESTFLAGS = $(RUNTESTFLAGS_$(V))
# expected fail tests
XFAIL_TESTS = \
winsup.api/ltp/setgroups01 \
winsup.api/ltp/setuid02 \
winsup.api/ltp/ulimit01 \
winsup.api/ltp/unlink08 \
winsup.api/samples/sample-fail

site-extra.exp: ../config.status Makefile
@rm -f ./tmp0
@echo "set runtime_root \"`pwd`/testinst/bin\"" >> ./tmp0
@echo "set cygrun \"`pwd`/mingw/cygrun\"" >> ./tmp0
@mv ./tmp0 site-extra.exp
# cygrun.sh test-runner script, and variables used by it:
LOG_COMPILER = $(srcdir)/cygrun.sh

EXTRA_DEJAGNU_SITE_CONFIG = site-extra.exp
export runtime_root=$(abs_builddir)/testinst/bin
export cygrun=$(builddir)/mingw/cygrun

# Set up things in the Cygwin 'installation' at testsuite/testinst/ to provide
# things which tests need to work
Expand Down Expand Up @@ -369,7 +373,8 @@ check-local:
check_programs: $(check_PROGRAMS)

clean-local:
rm -f *.log *.exe *.exp *.bak *.stackdump winsup.sum
rm -f *.stackdump
rm -rf ${builddir}/testinst/tmp

if CROSS_BOOTSTRAP
SUBDIRS = mingw
Expand Down
22 changes: 10 additions & 12 deletions winsup/testsuite/README
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
1999-12-23 DJ Delorie <[email protected]>

Here are some notes about adding and using this testsuite.

The testsuite adds a directory containing the just built cygwin1.dll to the PATH
Expand All @@ -20,18 +18,18 @@ The testsuite/winsup.api subdirectory is for testing the API to
cygwin1.dll ONLY. Create other subdirs under testsuite/ for other
classes of testing.

Tests in winsup.api/*.c or winsup.api/*/*.c (only one subdirectory
level is allowed) either run, and exit(0) or they fail.
Either abort or exit with a non-zero code to indicate failure. Don't
print anything to the screen if you can avoid it (except for failure
reasons, of course). One .c file per test, no compile options are
allowed (we're testing the api, not the compiler).
Tests under winsup.api/ either run successfully and exit(0), exit(77) to
indicate a skipped test, or any other exit status to indicate a failure.

Don't print anything to the screen if you can avoid it (except for failure
reasons, of course). One .c file per test, no compile options are allowed
(we're testing the api, not the compiler).

Tests whose filename is mentioned in known-bugs.tcl will be *expected*
to fail, and will "fail" if they compile, run, and return zero.
Tests whose filename is mentioned in XFAIL_TESTS are expected to fail,
effectively reversing the result of those.

"make check" will only work if you run it *on* an NT machine.
Cross-checking is not supported.

To test a subset of the test-suite, use
$ make check CYGWIN_TESTSUITE_TESTS=regexp
To run selected tests, use e.g:
$ make check TESTS="winsup.api/ltp/umask03 winsup.api/ltp/stat06"
13 changes: 0 additions & 13 deletions winsup/testsuite/config/default.exp

This file was deleted.

17 changes: 17 additions & 0 deletions winsup/testsuite/cygrun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/dash
#
# test driver to run $1 in the appropriate environment
#

# $1 = test executable to run
exe=$1

export PATH="$runtime_root:${PATH}"

if [ "$1" = "./mingw/cygload" ]
then
windows_runtime_root=$(cygpath -m $runtime_root)
$exe -v -cygwin $windows_runtime_root/cygwin1.dll
else
cygdrop $cygrun $exe
fi
30 changes: 0 additions & 30 deletions winsup/testsuite/winsup.api/cygload.exp

This file was deleted.

4 changes: 0 additions & 4 deletions winsup/testsuite/winsup.api/known_bugs.tcl

This file was deleted.

74 changes: 0 additions & 74 deletions winsup/testsuite/winsup.api/winsup.exp

This file was deleted.

0 comments on commit a1ee8a0

Please sign in to comment.