diff options
author | Pádraig Brady <P@draigBrady.com> | 2015-06-25 13:21:28 +0100 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2015-06-25 13:41:24 +0100 |
commit | 1d82751e2ca03084db4cb06c0b4eaf73036082d8 (patch) | |
tree | 04e6e03035b745632a22458a3351d5ea6337dc80 /tests/cp/nfs-removal-race.sh | |
parent | 381b797784b050f4eafc0dd4b6f070f2d1465f98 (diff) | |
download | coreutils-1d82751e2ca03084db4cb06c0b4eaf73036082d8.tar.xz |
tests: avoid false failures with LD_PRELOAD=libasan.so.2
The LD_PRELOAD checks by -fsanitize=address are overly strict:
https://groups.google.com/forum/#!topic/address-sanitizer/jEvOJgkDqQk
A workaround is to first export LD_PRELOAD=libasan.so.2
The tests below are adjusted so that workaround is not discarded.
* tests/cp/no-ctx.sh: Append to $LD_PRELOAD.
* tests/df/no-mtab-status.sh: Likewise.
* tests/df/skip-duplicates.sh: Likewise.
* tests/ls/getxattr-speedup.sh: Likewise.
* tests/rm/r-root.sh: Likewise.
* tests/cp/nfs-removal-race.sh: Likewise. Also check that
LD_PRELOAD is effective to aid future maintainability
and avoid false failure if libasan.so.2 is not preloaded.
Diffstat (limited to 'tests/cp/nfs-removal-race.sh')
-rwxr-xr-x | tests/cp/nfs-removal-race.sh | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/cp/nfs-removal-race.sh b/tests/cp/nfs-removal-race.sh index 70276a384..fdac03f7d 100755 --- a/tests/cp/nfs-removal-race.sh +++ b/tests/cp/nfs-removal-race.sh @@ -35,6 +35,7 @@ require_gcc_shared_ # Replace each stat call with a call to this wrapper. cat > k.c <<'EOF' || framework_failure_ #define _GNU_SOURCE +#include <stdio.h> #include <sys/types.h> #include <dlfcn.h> @@ -49,6 +50,7 @@ int __xstat (int ver, const char *path, struct stat *st) { static int (*real_stat)(int ver, const char *path, struct stat *st) = NULL; + fclose(fopen("preloaded", "w")); if (!real_stat) real_stat = dlsym (RTLD_NEXT, "__xstat"); /* When asked to stat nonexistent "d", @@ -65,7 +67,9 @@ touch d2 || framework_failure_ echo xyz > src || framework_failure_ # Finally, run the test: -LD_PRELOAD=./k.so cp src d || fail=1 +LD_PRELOAD=$LD_PRELOAD:./k.so cp src d || fail=1 + +test -f preloaded || skip_ 'LD_PRELOAD was ineffective?' compare src d || fail=1 Exit $fail |