]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: avoid shared lib tests on unsupported platforms
authorPádraig Brady <P@draigBrady.com>
Wed, 27 Mar 2013 12:51:43 +0000 (12:51 +0000)
committerPádraig Brady <P@draigBrady.com>
Thu, 4 Apr 2013 02:02:10 +0000 (03:02 +0100)
* 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
tests/cp/nfs-removal-race.sh
tests/df/no-mtab-status.sh
tests/df/skip-duplicates.sh
tests/ls/getxattr-speedup.sh

index afee93077c6d29b3b0ddddc543de3b1416ac81be..093cd85863c3787f4bb4dcb74242fe60b5a79af2 100644 (file)
--- 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_
index b606784ec7dca36f8092e150f10c38648c4411e2..e59908a913ac4dc3edbd40448937bbec6c3b43a1 100755 (executable)
@@ -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_
index 896a9fe55121164164b86f67f2e6d4ed3d46c283..2e6b61bb81bc25659ba81c0317879442ff333df4 100755 (executable)
@@ -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
index ad5249b59088b910ff60435083ea852ceec16916..2b7de562bf2a8c0683844ef0196b92f47b9b3935 100755 (executable)
@@ -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
index 224362f0c12ec5ea6474ae18e2a217874d6c5cd2..989a5263d0f7632776b1a922b905f2f2ef766438 100755 (executable)
@@ -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_