public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-patches@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH 01/11] Cygwin: testsuite: Setup test prereqs in 'installation' the tests run in
Date: Thu, 13 Jul 2023 12:38:54 +0100	[thread overview]
Message-ID: <20230713113904.1752-2-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20230713113904.1752-1-jon.turney@dronecode.org.uk>

Do some setup in the Cygwin 'installation' at testsuite/testinst/:

* Ensure /tmp exists

* Use BusyBox to provide executables needed by tests which use system()
(sh, sleep, ls)

This enables tests which use system(), or require /tmp to exist to pass.
---
 .github/workflows/cygwin.yml   |  3 ++-
 winsup/cygwin/Makefile.am      |  4 ++--
 winsup/doc/faq-programming.xml |  3 ++-
 winsup/testsuite/Makefile.am   | 25 ++++++++++++++++++++++++-
 4 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml
index 575ff1fdc..248a3e4cd 100644
--- a/.github/workflows/cygwin.yml
+++ b/.github/workflows/cygwin.yml
@@ -71,6 +71,7 @@ jobs:
         packages: >-
           autoconf,
           automake,
+          busybox,
           cocom,
           dblatex,
           dejagnu,
@@ -116,6 +117,6 @@ jobs:
         export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32 &&
         export MAKEFLAGS=-j$(nproc) &&
         cd build &&
-        (export PATH=${{ matrix.target }}/winsup/testsuite/runtime:${PATH} && cmd /c $(cygpath -wa ${{ matrix.target }}/winsup/cygserver/cygserver) &) &&
+        (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)
       shell: C:\cygwin\bin\bash.exe --noprofile --norc -eo pipefail '{0}'
diff --git a/winsup/cygwin/Makefile.am b/winsup/cygwin/Makefile.am
index c34ca6ddc..bfb5ead10 100644
--- a/winsup/cygwin/Makefile.am
+++ b/winsup/cygwin/Makefile.am
@@ -602,8 +602,8 @@ $(NEW_DLL_NAME): $(LDSCRIPT) libdll.a $(VERSION_OFILES) $(LIBSERVER)\
 	$(newlib_build)/libm.a \
 	$(newlib_build)/libc.a \
 	-lgcc -lkernel32 -lntdll -Wl,-Map,cygwin.map
-	@$(MKDIR_P) ${target_builddir}/winsup/testsuite/runtime/
-	$(AM_V_at)$(INSTALL_PROGRAM) $(NEW_DLL_NAME) ${target_builddir}/winsup/testsuite/runtime/$(DLL_NAME)
+	@$(MKDIR_P) ${target_builddir}/winsup/testsuite/testinst/bin/
+	$(AM_V_at)$(INSTALL_PROGRAM) $(NEW_DLL_NAME) ${target_builddir}/winsup/testsuite/testinst/bin/$(DLL_NAME)
 
 # cygwin import library
 toolopts=--cpu=@target_cpu@ --ar=@AR@ --as=@AS@ --nm=@NM@ --objcopy=@OBJCOPY@
diff --git a/winsup/doc/faq-programming.xml b/winsup/doc/faq-programming.xml
index 7fc6baf25..15ae6eac4 100644
--- a/winsup/doc/faq-programming.xml
+++ b/winsup/doc/faq-programming.xml
@@ -697,7 +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> is also required. -->
+<!-- If you want to run the tests, <literal>dejagnu</literal> and
+     <literal>busybox</literal> are also required. -->
 
 <para>
 Building the documentation also requires the <literal>dblatex</literal>,
diff --git a/winsup/testsuite/Makefile.am b/winsup/testsuite/Makefile.am
index 7853d98e8..11332eda2 100644
--- a/winsup/testsuite/Makefile.am
+++ b/winsup/testsuite/Makefile.am
@@ -339,7 +339,7 @@ testdll_tmpdir = $(shell cygpath -ma $(tmpdir) | sed -e 's#^\([A-Z]\):#/cygdrive
 
 site-extra.exp: ../config.status Makefile
 	@rm -f ./tmp0
-	@echo "set runtime_root \"`pwd`/runtime\"" >> ./tmp0
+	@echo "set runtime_root \"`pwd`/testinst/bin\"" >> ./tmp0
 	@echo "set tmpdir $(tmpdir)" >> ./tmp0
 	@echo "set testdll_tmpdir $(testdll_tmpdir)" >> ./tmp0
 	@echo "set cygrun \"`pwd`/mingw/cygrun\"" >> ./tmp0
@@ -347,6 +347,29 @@ site-extra.exp: ../config.status Makefile
 
 EXTRA_DEJAGNU_SITE_CONFIG = site-extra.exp
 
+# Set up things in the Cygwin 'installation' at testsuite/testinst/ to provide
+# things which tests need to work
+#
+# * Create /tmp
+# * Ensure there is a /usr/bin/sh for tests which use system()
+# * Ensure there is a /usr/bin/sleep for tests which use system("sleep 10")
+# * Ensure there is a /usr/bin/ls for tests which  use system("ls")
+#
+# copy to avoid all the complexities: hardlink will fail if builddir is on a
+# separate filesystem, symlink would need to be constructed with regard to the
+# mounts of the test installation, and making it into /bin/ will cause
+# CreateProcess() to load cygwin1.dll from there.
+#
+# use busybox executables as they don't have any other shared library
+# dependencies other than cygwin1.dll.
+#
+
+check-local:
+	$(MKDIR_P) ${builddir}/testinst/tmp
+	cd ${builddir}/testinst/bin && cp /usr/libexec/busybox/bin/busybox.exe sh.exe
+	cd ${builddir}/testinst/bin && cp /usr/libexec/busybox/bin/busybox.exe sleep.exe
+	cd ${builddir}/testinst/bin && cp /usr/libexec/busybox/bin/busybox.exe ls.exe
+
 # target to build all the programs needed by check, without running check
 check_programs: $(check_PROGRAMS)
 
-- 
2.39.0


  reply	other threads:[~2023-07-13 11:39 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13 11:38 [PATCH 00/11] More testsuite fixes Jon Turney
2023-07-13 11:38 ` Jon Turney [this message]
2023-07-13 11:38 ` [PATCH 02/11] Cygwin: testsuite: Add a simple timeout mechanism Jon Turney
2023-07-13 11:38 ` [PATCH 03/11] Cygwin: testsuite: Remove const from writable string in fcntl07b Jon Turney
2023-07-13 11:38 ` [PATCH 04/11] Cygwin: testsuite: Skip devdsp test when no audio devices present Jon Turney
2023-07-13 11:38 ` [PATCH 05/11] Cygwin: testsuite: Just log result of second open of /dev/dsp Jon Turney
2023-07-13 11:38 ` [PATCH 06/11] Cygwin: testsuite: Also check direct call in systemcall Jon Turney
2023-07-13 11:39 ` [PATCH 07/11] Cygwin: testsuite: Fix for limited thread priority values Jon Turney
2023-07-13 11:39 ` [PATCH 08/11] Cygwin: testsuite: Busy-wait in cancel3 and cancel5 Jon Turney
2023-07-13 11:43   ` Jon Turney
2023-07-13 18:16   ` Corinna Vinschen
2023-07-13 18:37     ` Corinna Vinschen
2023-07-13 18:53       ` Corinna Vinschen
2023-07-14 13:04         ` Jon Turney
2023-07-14 18:57           ` Corinna Vinschen
2023-07-17 11:05             ` Corinna Vinschen
2023-07-17 11:51               ` Jon Turney
2023-07-17 14:21                 ` Corinna Vinschen
2023-07-17 15:41                   ` Corinna Vinschen
2023-07-17 18:23                     ` Corinna Vinschen
2023-07-18 11:20                     ` Jon Turney
2023-07-18 12:09                       ` Corinna Vinschen
2023-07-18 15:52                         ` Jon Turney
2023-07-17 11:51           ` Jon Turney
2023-07-17 14:04             ` Corinna Vinschen
2023-07-17 14:22               ` Corinna Vinschen
2023-07-13 11:39 ` [PATCH 09/11] Cygwin: testsuite: Fix a buffer overflow in symlink01 Jon Turney
2023-07-13 18:17   ` Corinna Vinschen
2023-07-14 13:04     ` Jon Turney
2023-07-13 11:39 ` [PATCH 10/11] Cygwin: testsuite: Minor fixes to umask03 Jon Turney
2023-07-13 18:18   ` Corinna Vinschen
2023-07-13 11:39 ` [PATCH 11/11] Cygwin: testsuite: Drop Adminstrator privileges while running tests Jon Turney
2023-07-13 18:05 ` [PATCH 00/11] More testsuite fixes Corinna Vinschen
2023-07-17 11:58 ` Jon Turney
2023-07-17 14:02   ` Corinna Vinschen
2023-07-18 13:37     ` Jon Turney
2023-07-18 14:52       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230713113904.1752-2-jon.turney@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).