public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: Cygwin Patches <cygwin-patches@cygwin.com>
Subject: Re: [PATCH 11/11] Ensure temporary directory used by tests exists
Date: Mon, 9 Nov 2020 16:25:24 +0000	[thread overview]
Message-ID: <666af9fa-194d-7b6e-a165-18f8d5169b94@dronecode.org.uk> (raw)
In-Reply-To: <643396a1-21b0-88a6-3f6b-2eb2083821e7@cornell.edu>

[-- Attachment #1: Type: text/plain, Size: 1465 bytes --]

On 08/11/2020 19:27, Ken Brown via Cygwin-patches wrote:
> On 11/8/2020 1:52 PM, Jon Turney wrote:
>> On 08/11/2020 18:19, Ken Brown via Cygwin-patches wrote:
>>> On 11/5/2020 2:47 PM, Jon Turney wrote:
>>>> +# temporary directory to be used for files created by tests (as an 
>>>> absolute,
>>>> +# /cygdrive path, so it can be understood by the test DLL, which 
>>>> will have
>>>> +# different mount table)
>>>> +tmpdir = $(shell cygpath -ma $(objdir)/testsuite/tmp/ | sed -e 
>>>> 's#^\([A-Z]\):#/cygdrive/\L\1#')
>>>
>>> This isn't right if the cygdrive prefix is not 'cygdrive'.  Maybe use 
>>> 'proc/cygdrive' instead of 'cygdrive'?
>>>
>>
>> That's how I originally had it.  Unfortunately, test ltp/symlink01 
>> relies on the test directory being specified as a canonicalized 
>> pathname (i.e. is the same after realpath()).
>>
>> Since there's no /etc/fstab in the the filesystem relative to the test 
>> DLL, I think it should always be using the default cygdrive prefix?
> 
> But there's a mkdir command that seems to be run in the context of the 
> user running 'make check'.  If the cygdrive prefix is not 'cygdrive', 
> 'make check' fails as follows:
> 
> ERROR: tcl error sourcing 
> /home/kbrown/src/cygdll/newlib-cygwin/winsup/testsuite/winsup.api/winsup.exp. 
> 
> ERROR: can't create directory "/cygdrive": permission denied
>      while executing
> "file mkdir $tmpdir/$base"
> 

Ah, I see.

Maybe something like the attached is needed.

[-- Attachment #2: 0001-Fix-testsuite-tmpdir-creation-with-non-default-cygdr.patch --]
[-- Type: text/plain, Size: 2505 bytes --]

From 3f14d1a3c6197e52e083eb8a869573c5e2aab4ef Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Mon, 9 Nov 2020 13:48:38 +0000
Subject: [PATCH] Fix testsuite tmpdir creation with non-default cygdrive
 prefix

---
 winsup/testsuite/Makefile.in           | 10 ++++++----
 winsup/testsuite/winsup.api/winsup.exp |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/winsup/testsuite/Makefile.in b/winsup/testsuite/Makefile.in
index 7e1881761..da1684aef 100644
--- a/winsup/testsuite/Makefile.in
+++ b/winsup/testsuite/Makefile.in
@@ -108,10 +108,11 @@ $(RUNTIME) : $(cygwin_build)/Makefile
 # Set to $(target_alias)/ for cross.
 target_subdir = @target_subdir@
 
-# temporary directory to be used for files created by tests (as an absolute,
-# /cygdrive path, so it can be understood by the test DLL, which will have
-# different mount table)
-tmpdir = $(shell cygpath -ma $(objdir)/testsuite/tmp/ | sed -e 's#^\([A-Z]\):#/cygdrive/\L\1#')
+# a temporary directory, to be used for files created by tests
+tmpdir = $(abspath $(objdir)/testsuite/tmp/)
+# the same temporary directory, as an absolute, /cygdrive path (so it can be
+# understood by the test DLL, which will have a different mount table)
+testdll_tmpdir = $(shell cygpath -ma $(tmpdir) | sed -e 's#^\([A-Z]\):#/cygdrive/\L\1#')
 
 site.exp: ./config.status Makefile
 	@echo "Making a new config file..."
@@ -132,6 +133,7 @@ site.exp: ./config.status Makefile
 	@echo "set CFLAGS \"$(INCLUDES)\"" >> ./tmp0
 	@echo "set MINGW_CXX \"$(MINGW_CXX)\"" >> ./tmp0
 	@echo "set tmpdir $(tmpdir)" >> ./tmp0
+	@echo "set testdll_tmpdir $(testdll_tmpdir)" >> ./tmp0
 	@echo "set ltp_includes \"$(realpath $(libltp_srcdir))/include\"" >> ./tmp0
 	@echo "## All variables above are generated by configure. Do Not Edit ##" >> ./tmp0
 	@cat ./tmp0 > site.exp
diff --git a/winsup/testsuite/winsup.api/winsup.exp b/winsup/testsuite/winsup.api/winsup.exp
index cd5964d47..4978136a1 100644
--- a/winsup/testsuite/winsup.api/winsup.exp
+++ b/winsup/testsuite/winsup.api/winsup.exp
@@ -69,7 +69,7 @@ foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c $srcdir/$subdir/*/*.{cc
 	       set redirect_output /dev/null
 	    }
 	    file mkdir $tmpdir/$base
-	    ws_spawn "$rootme/cygrun ./$base.exe $tmpdir/$base > $redirect_output"
+	    ws_spawn "$rootme/cygrun ./$base.exe $testdll_tmpdir/$base > $redirect_output"
 	    file delete -force $tmpdir/$base
 	    if { $rv } {
 		fail "$testcase (execute)"
-- 
2.29.2


  parent reply	other threads:[~2020-11-09 16:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-05 19:47 [PATCH 00/11] testsuite refurbishment Jon Turney
2020-11-05 19:47 ` [PATCH 01/11] Add testsuite directory to autogen.sh Jon Turney
2020-11-05 19:47 ` [PATCH 02/11] Always configure in testsuite subdirectory Jon Turney
2020-11-05 19:47 ` [PATCH 03/11] Add rule to testsuite Makefile to regenerate it when needed Jon Turney
2020-11-05 19:47 ` [PATCH 04/11] Avoid 'Makefile.in seems to ignore the --datarootdir setting' warning Jon Turney
2020-11-05 19:47 ` [PATCH 05/11] Move adding libltp to VPATH after Makefile.common Jon Turney
2020-11-05 19:47 ` [PATCH 06/11] Define target_builddir autoconf and Makefile variables Jon Turney
2020-11-05 19:47 ` [PATCH 07/11] Detect and use MinGW compilers for testsuite wrappers Jon Turney
2020-11-05 19:47 ` [PATCH 08/11] Use absolute path to libltp includes Jon Turney
2020-11-05 19:47 ` [PATCH 09/11] Check exit code of a test, rather than stdout Jon Turney
2020-11-05 19:47 ` [PATCH 10/11] Set PATH for tests to pick up cygwin0.dll Jon Turney
2020-11-05 19:47 ` [PATCH 11/11] Ensure temporary directory used by tests exists Jon Turney
2020-11-08 18:19   ` Ken Brown
2020-11-08 18:52     ` Jon Turney
2020-11-08 19:27       ` Ken Brown
2020-11-08 23:38         ` Brian Inglis
2020-11-09 16:25         ` Jon Turney [this message]
2020-11-09 17:48           ` Ken Brown
2020-11-09 21:01             ` Jon Turney
2020-11-06  9:44 ` [PATCH 00/11] testsuite refurbishment 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=666af9fa-194d-7b6e-a165-18f8d5169b94@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).