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_
. "${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_
# 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_
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ df
+require_gcc_shared_
df || skip_ "df fails"
# 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
. "${srcdir=.}/tests/init.sh"; path_prepend_ ./src
print_ver_ df
+require_gcc_shared_
df || skip_ "df fails"
# 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
. "${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"
# 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_