public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libgomp: Use absolute pathname to testsuite/flock [PR113192]
@ 2024-01-09  9:01 Jakub Jelinek
  2024-01-10  9:32 ` Rainer Orth
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2024-01-09  9:01 UTC (permalink / raw)
  To: gcc-patches

Hi!

When flock program doesn't exist, libgomp configure attempts to
offer a fallback version using a perl script, but we weren't using
absolute filename to that, so it apparently failed to work correctly.

The following patch arranges for it to get the absolute filename.

Tested by John David in the PR.

2024-01-09  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/113192
	* configure.ac (FLOCK): Use \$(abs_top_srcdir)/testsuite/flock
	rather than $srcdir/testsuite/flock.
	* configure: Regenerated.

--- libgomp/configure.ac.jj	2023-11-02 07:49:21.693801244 +0100
+++ libgomp/configure.ac	2024-01-08 21:46:21.014765685 +0100
@@ -343,7 +343,7 @@ AX_COUNT_CPUS
 AC_CHECK_PROGS(FLOCK, flock)
 # Fallback if 'perl' is available.
 if test -z "$FLOCK"; then
-  AC_CHECK_PROG(FLOCK, perl, $srcdir/testsuite/flock)
+  AC_CHECK_PROG(FLOCK, perl, \$(abs_top_srcdir)/testsuite/flock)
 fi
 
 AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
--- libgomp/configure.jj	2024-01-06 02:29:24.566795886 +0100
+++ libgomp/configure	2024-01-08 21:46:23.799726387 +0100
@@ -16655,7 +16655,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_FLOCK="$srcdir/testsuite/flock"
+    ac_cv_prog_FLOCK="\$(abs_top_srcdir)/testsuite/flock"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi

	Jakub


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [committed] libgomp: Use absolute pathname to testsuite/flock [PR113192]
  2024-01-09  9:01 [committed] libgomp: Use absolute pathname to testsuite/flock [PR113192] Jakub Jelinek
@ 2024-01-10  9:32 ` Rainer Orth
  2024-01-10 11:14   ` [PATCH] libgomp, v2: " Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Rainer Orth @ 2024-01-10  9:32 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Hi Jakub,

> When flock program doesn't exist, libgomp configure attempts to
> offer a fallback version using a perl script, but we weren't using
> absolute filename to that, so it apparently failed to work correctly.
>
> The following patch arranges for it to get the absolute filename.
>
> Tested by John David in the PR.

This patch completely broke parallel libgomp testing on Solaris:

ERROR: couldn't execute "\$(abs_top_srcdir)/testsuite/flock": no such file or directory

FLOCK is also substituted into testsuite/libgomp-site-extra.exp.in,
which gets included into site.exp.  That one has

## Begin content included from file libgomp-site-extra.exp.  Do not modify. ##
set FLOCK {$(abs_top_srcdir)/testsuite/flock}

So expect tries to literally execute '$(abs_top_srcdir)/testsuite/flock'
which cannot work.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] libgomp, v2: Use absolute pathname to testsuite/flock [PR113192]
  2024-01-10  9:32 ` Rainer Orth
@ 2024-01-10 11:14   ` Jakub Jelinek
  2024-01-10 12:20     ` Rainer Orth
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2024-01-10 11:14 UTC (permalink / raw)
  To: Rainer Orth, John David Anglin; +Cc: gcc-patches

On Wed, Jan 10, 2024 at 10:32:56AM +0100, Rainer Orth wrote:
> > When flock program doesn't exist, libgomp configure attempts to
> > offer a fallback version using a perl script, but we weren't using
> > absolute filename to that, so it apparently failed to work correctly.
> >
> > The following patch arranges for it to get the absolute filename.
> >
> > Tested by John David in the PR.
> 
> This patch completely broke parallel libgomp testing on Solaris:
> 
> ERROR: couldn't execute "\$(abs_top_srcdir)/testsuite/flock": no such file or directory

Sorry for that.

> FLOCK is also substituted into testsuite/libgomp-site-extra.exp.in,
> which gets included into site.exp.  That one has
> 
> ## Begin content included from file libgomp-site-extra.exp.  Do not modify. ##
> set FLOCK {$(abs_top_srcdir)/testsuite/flock}
> 
> So expect tries to literally execute '$(abs_top_srcdir)/testsuite/flock'
> which cannot work.

Does the following work then?

Using autoconf's internal _AC_SRCDIRS macro doesn't seem to be a good idea
to me, so I've copied what e.g. libobjc configure does instead.

2024-01-10  Jakub Jelinek  <jakub@redhat.com>

	PR libgomp/113192
	* configure.ac (FLOCK): Use $libgomp_abs_srcdir/testsuite/flock
	instead of \$(abs_top_srcdir)/testsuite/flock.
	* configure: Regenerated.

--- libgomp/configure.ac.jj	2024-01-09 09:54:03.398011788 +0100
+++ libgomp/configure.ac	2024-01-10 12:09:05.558162522 +0100
@@ -343,7 +343,16 @@ AC_MSG_NOTICE([checking for flock implem
 AC_CHECK_PROGS(FLOCK, flock)
 # Fallback if 'perl' is available.
 if test -z "$FLOCK"; then
-  AC_CHECK_PROG(FLOCK, perl, \$(abs_top_srcdir)/testsuite/flock)
+  # These need to be absolute paths, yet at the same time need to
+  # canonicalize only relative paths, because then amd will not unmount
+  # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
+  case $srcdir in
+changequote(,)dnl
+    [\\/$]* | ?:[\\/]*) libgomp_abs_srcdir=${srcdir} ;;
+changequote([,])dnl
+    *) libgomp_abs_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
+  esac
+  AC_CHECK_PROG(FLOCK, perl, $libgomp_abs_srcdir/testsuite/flock)
 fi
 
 AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)
--- libgomp/configure.jj	2024-01-09 09:54:03.486010551 +0100
+++ libgomp/configure	2024-01-10 12:09:15.960016006 +0100
@@ -16638,6 +16638,13 @@ done
 
 # Fallback if 'perl' is available.
 if test -z "$FLOCK"; then
+  # These need to be absolute paths, yet at the same time need to
+  # canonicalize only relative paths, because then amd will not unmount
+  # drives. Thus the use of PWDCMD: set it to 'pawd' or 'amq -w' if using amd.
+  case $srcdir in
+    [\\/$]* | ?:[\\/]*) libgomp_abs_srcdir=${srcdir} ;;
+    *) libgomp_abs_srcdir=`cd "$srcdir" && ${PWDCMD-pwd} || echo "$srcdir"` ;;
+  esac
   # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
@@ -16655,7 +16662,7 @@ do
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
   if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
-    ac_cv_prog_FLOCK="\$(abs_top_srcdir)/testsuite/flock"
+    ac_cv_prog_FLOCK="$libgomp_abs_srcdir/testsuite/flock"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
   fi


	Jakub


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] libgomp, v2: Use absolute pathname to testsuite/flock [PR113192]
  2024-01-10 11:14   ` [PATCH] libgomp, v2: " Jakub Jelinek
@ 2024-01-10 12:20     ` Rainer Orth
  0 siblings, 0 replies; 4+ messages in thread
From: Rainer Orth @ 2024-01-10 12:20 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: John David Anglin, gcc-patches

Hi Jakub,

>> FLOCK is also substituted into testsuite/libgomp-site-extra.exp.in,
>> which gets included into site.exp.  That one has
>> 
>> ## Begin content included from file libgomp-site-extra.exp.  Do not modify. ##
>> set FLOCK {$(abs_top_srcdir)/testsuite/flock}
>> 
>> So expect tries to literally execute '$(abs_top_srcdir)/testsuite/flock'
>> which cannot work.
>
> Does the following work then?
>
> Using autoconf's internal _AC_SRCDIRS macro doesn't seem to be a good idea
> to me, so I've copied what e.g. libobjc configure does instead.

The patch worked just fine (tested on i386-pc-solaris2.11 by
rebuilding/testing libgomp from scratch).  site.exp is as expected:

set FLOCK {/vol/gcc/src/hg/master/local/libgomp/testsuite/flock}

Thanks a lot.

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-10 12:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-09  9:01 [committed] libgomp: Use absolute pathname to testsuite/flock [PR113192] Jakub Jelinek
2024-01-10  9:32 ` Rainer Orth
2024-01-10 11:14   ` [PATCH] libgomp, v2: " Jakub Jelinek
2024-01-10 12:20     ` Rainer Orth

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).