On 03/27/2013 11:47 AM, Ellis N. Thomas wrote:
> Pádraig,
> 
>     Thanks for your response and provision of 8.21.
> 
>     I have  rebuilt coreutils just to see if the test bug
> is still present.  Unfortunately, this shows two more!

>     Results of grep FAIL: tests/test-suite.log
> FAIL: tests/cp/nfs-removal-race.sh (exit: 99)
> FAIL: tests/ls/getxattr-speedup.sh (exit: 99)

Both of those are caused by:

> + gcc -std=gnu99 -shared -fPIC -O2 k.c -o k.so
> Undefined symbols:
>   "_main", referenced from:
>       start in crt1.10.5.o
> ld: symbol(s) not found

It seems like older  OS X doesn't support the gcc -shared option:
http://blog.yimingliu.com/2008/01/23/building-dynamic-library-on-os-x/
The attached should avoid those tests on your platform.

As for:

> FAIL: tests/install/install-C.sh (exit: 1)

> + echo test

> + ginstall -Cv -m0644 a b

> + ginstall -Cv -m0644 a b
> + compare out out_empty

> + diff -u out out_empty
> --- out    2013-03-27 10:44:28.000000000 +0000
> +++ out_empty    2013-03-27 10:44:28.000000000 +0000
> @@ -1,2 +0,0 @@
> -removed 'b'
> -'a' -> 'b'
> + fail=1

This might actually be a problem in ginstall, but I don't have enough
info to diagnose. Could you indicate the file system you're using,
give the output of:

echo test > a
ginstall -Cv -m0644 a b
stat a b
ginstall -Cv -m0644 a b

thanks,
Pádraig.
>From eebc52030b67c9c290378945b79a15e2fce1addc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <[email protected]>
Date: Wed, 27 Mar 2013 12:51:43 +0000
Subject: [PATCH] tests: avoid shared lib tests on unsupported platforms

* init.cfg (require_gcc_shared_): A new function to check
that we can build shared libraries in the particular manner
we use in our tests.
* tests/cp/nfs-removal-race.sh: Use require_gcc_shared_.
Then fail rather than skip, if the actual shared lib build fails.
* tests/df/no-mtab-status.sh: Likewise.
* tests/df/skip-duplicates.sh: Likewise.
* tests/ls/getxattr-speedup.sh: Likewise.
Reported in http://bugs.gnu.org/14024
---
 init.cfg                     |    9 +++++++++
 tests/cp/nfs-removal-race.sh |    3 ++-
 tests/df/no-mtab-status.sh   |    3 ++-
 tests/df/skip-duplicates.sh  |    3 ++-
 tests/ls/getxattr-speedup.sh |    3 ++-
 5 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/init.cfg b/init.cfg
index afee930..093cd85 100644
--- a/init.cfg
+++ b/init.cfg
@@ -466,6 +466,15 @@ require_sparse_support_()
   fi
 }
 
+# There are a myriad of ways to build shared libs,
+# so we only consider running tests requiring shared libs,
+# on platforms that support building them as follows.
+require_gcc_shared_()
+{
+  $CC -shared -fPIC -O2 -xc -o d.so -ldl - < /dev/null 2>&1 \
+    || skip_ '$CC -shared ... failed to build a shared lib'
+}
+
 mkfifo_or_skip_()
 {
   test $# = 1 || framework_failure_
diff --git a/tests/cp/nfs-removal-race.sh b/tests/cp/nfs-removal-race.sh
index b606784..e59908a 100755
--- a/tests/cp/nfs-removal-race.sh
+++ b/tests/cp/nfs-removal-race.sh
@@ -30,6 +30,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ cp
+require_gcc_shared_
 
 # Replace each stat call with a call to this wrapper.
 cat > k.c <<'EOF' || framework_failure_
@@ -58,7 +59,7 @@ EOF
 
 # Then compile/link it:
 $CC -shared -fPIC -O2 k.c -o k.so -ldl \
-  || framework_failure_ 'failed to compile with -shared -fPIC'
+  || framework_failure_ 'failed to build shared library'
 
 touch d2 || framework_failure_
 echo xyz > src || framework_failure_
diff --git a/tests/df/no-mtab-status.sh b/tests/df/no-mtab-status.sh
index 896a9fe..2e6b61b 100755
--- a/tests/df/no-mtab-status.sh
+++ b/tests/df/no-mtab-status.sh
@@ -19,6 +19,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ df
+require_gcc_shared_
 
 df || skip_ "df fails"
 
@@ -45,7 +46,7 @@ EOF
 
 # Then compile/link it:
 $CC -shared -fPIC -ldl -O2 k.c -o k.so \
-  || skip_ "getmntent hack does not work on this platform"
+  || framework_failure_ 'failed to build shared library'
 
 # Test if LD_PRELOAD works:
 LD_PRELOAD=./k.so df
diff --git a/tests/df/skip-duplicates.sh b/tests/df/skip-duplicates.sh
index ad5249b..2b7de56 100755
--- a/tests/df/skip-duplicates.sh
+++ b/tests/df/skip-duplicates.sh
@@ -19,6 +19,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ df
+require_gcc_shared_
 
 df || skip_ "df fails"
 
@@ -58,7 +59,7 @@ EOF
 
 # Then compile/link it:
 gcc --std=gnu99 -shared -fPIC -ldl -O2 k.c -o k.so \
-  || skip_ "getmntent hack does not work on this platform"
+  || framework_failure_ 'failed to build shared library'
 
 # Test if LD_PRELOAD works:
 LD_PRELOAD=./k.so df
diff --git a/tests/ls/getxattr-speedup.sh b/tests/ls/getxattr-speedup.sh
index 224362f..989a526 100755
--- a/tests/ls/getxattr-speedup.sh
+++ b/tests/ls/getxattr-speedup.sh
@@ -21,6 +21,7 @@
 
 . "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
 print_ver_ ls
+require_gcc_shared_
 
 # Replace each getxattr and lgetxattr call with a call to these stubs.
 # Count those and write the total number of calls to the file "x"
@@ -48,7 +49,7 @@ EOF
 
 # Then compile/link it:
 $CC -shared -fPIC -O2 k.c -o k.so \
-  || framework_failure_ 'failed to compile with -shared -fPIC'
+  || framework_failure_ 'failed to build shared library'
 
 # Create a few files:
 seq 20 | xargs touch || framework_failure_
-- 
1.7.7.6

Reply via email to