|
Mark Wielaard |
2a1835 |
commit 88cf06207b074f387c04de4938a0bb20366616b0
|
|
Mark Wielaard |
2a1835 |
Author: mjw <mjw@a5019735-40e9-0310-863c-91ae7b9d1cf9>
|
|
Mark Wielaard |
2a1835 |
Date: Fri Oct 21 00:02:10 2016 +0000
|
|
Mark Wielaard |
2a1835 |
|
|
Mark Wielaard |
2a1835 |
Add libc_test to workaround pth_cond_destroy_busy test hangs.
|
|
Mark Wielaard |
2a1835 |
|
|
Mark Wielaard |
2a1835 |
This is a workaround for bug #371396. It adds a new test program
|
|
Mark Wielaard |
2a1835 |
that can be used skip tests given a specific libc implementation
|
|
Mark Wielaard |
2a1835 |
and optionally a specific minimum version. Currently only glibc
|
|
Mark Wielaard |
2a1835 |
is recognized. This is used for the drd and helgrind tests
|
|
Mark Wielaard |
2a1835 |
pth_cond_destroy_busy to be skipped on glibc 2.24.90+.
|
|
Mark Wielaard |
2a1835 |
|
|
Mark Wielaard |
2a1835 |
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@16097 a5019735-40e9-0310-863c-91ae7b9d1cf9
|
|
Mark Wielaard |
2a1835 |
|
|
Mark Wielaard |
2a1835 |
diff --git a/drd/tests/pth_cond_destroy_busy.vgtest b/drd/tests/pth_cond_destroy_busy.vgtest
|
|
Mark Wielaard |
2a1835 |
index eafbd74..f3cf778 100644
|
|
Mark Wielaard |
2a1835 |
--- a/drd/tests/pth_cond_destroy_busy.vgtest
|
|
Mark Wielaard |
2a1835 |
+++ b/drd/tests/pth_cond_destroy_busy.vgtest
|
|
Mark Wielaard |
2a1835 |
@@ -1,2 +1,2 @@
|
|
Mark Wielaard |
2a1835 |
-prereq: ./supported_libpthread
|
|
Mark Wielaard |
2a1835 |
+prereq: ./supported_libpthread && ! ../../tests/libc_test glibc 2.24.90
|
|
Mark Wielaard |
2a1835 |
prog: pth_cond_destroy_busy
|
|
Mark Wielaard |
2a1835 |
diff --git a/helgrind/tests/pth_cond_destroy_busy.vgtest b/helgrind/tests/pth_cond_destroy_busy.vgtest
|
|
Mark Wielaard |
2a1835 |
index 45d7853..2957cc3 100644
|
|
Mark Wielaard |
2a1835 |
--- a/helgrind/tests/pth_cond_destroy_busy.vgtest
|
|
Mark Wielaard |
2a1835 |
+++ b/helgrind/tests/pth_cond_destroy_busy.vgtest
|
|
Mark Wielaard |
2a1835 |
@@ -1,2 +1,2 @@
|
|
Mark Wielaard |
2a1835 |
-prereq: ! ../../tests/os_test darwin
|
|
Mark Wielaard |
2a1835 |
+prereq: ! ../../tests/os_test darwin && ! ../../tests/libc_test glibc 2.24.90
|
|
Mark Wielaard |
2a1835 |
prog: ../../drd/tests/pth_cond_destroy_busy
|
|
Mark Wielaard |
2a1835 |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
Mark Wielaard |
2a1835 |
index 9c0cc3a..7233626 100644
|
|
Mark Wielaard |
2a1835 |
--- a/tests/Makefile.am
|
|
Mark Wielaard |
2a1835 |
+++ b/tests/Makefile.am
|
|
Mark Wielaard |
2a1835 |
@@ -44,6 +44,7 @@ noinst_HEADERS = \
|
|
Mark Wielaard |
2a1835 |
check_PROGRAMS = \
|
|
Mark Wielaard |
2a1835 |
arch_test \
|
|
Mark Wielaard |
2a1835 |
os_test \
|
|
Mark Wielaard |
2a1835 |
+ libc_test \
|
|
Mark Wielaard |
2a1835 |
true \
|
|
Mark Wielaard |
2a1835 |
x86_amd64_features \
|
|
Mark Wielaard |
2a1835 |
s390x_features \
|
|
Mark Wielaard |
2a1835 |
diff --git a/tests/libc_test.c b/tests/libc_test.c
|
|
Mark Wielaard |
2a1835 |
new file mode 100644
|
|
Mark Wielaard |
2a1835 |
index 0000000..0de3d5d
|
|
Mark Wielaard |
2a1835 |
--- /dev/null
|
|
Mark Wielaard |
2a1835 |
+++ b/tests/libc_test.c
|
|
Mark Wielaard |
2a1835 |
@@ -0,0 +1,78 @@
|
|
Mark Wielaard |
2a1835 |
+// Compare given libc name and version number to system name and version.
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+// Returns
|
|
Mark Wielaard |
2a1835 |
+// - 0 if the libc name matches is at least the minimum version (if given).
|
|
Mark Wielaard |
2a1835 |
+// - 1 if the libc name doesn't match or the version is lower than requested.
|
|
Mark Wielaard |
2a1835 |
+// - 2 if the requested libc name isn't recognised.
|
|
Mark Wielaard |
2a1835 |
+// - 3 if there was a usage error (it also prints an error message).
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+#include <stdio.h>
|
|
Mark Wielaard |
2a1835 |
+#include <stdlib.h>
|
|
Mark Wielaard |
2a1835 |
+#include <string.h>
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+#ifdef __GLIBC__
|
|
Mark Wielaard |
2a1835 |
+#include <gnu/libc-version.h>
|
|
Mark Wielaard |
2a1835 |
+#endif
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+#define False 0
|
|
Mark Wielaard |
2a1835 |
+#define True 1
|
|
Mark Wielaard |
2a1835 |
+typedef int Bool;
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+/* Assumes the versions are x.y.z, with y and z optional. */
|
|
Mark Wielaard |
2a1835 |
+static Bool matches_version(char *min_version) {
|
|
Mark Wielaard |
2a1835 |
+ int a1=0, a2=0, a3=0, g1=0, g2=0, g3=0; // 'a' = actual; 'g' = given
|
|
Mark Wielaard |
2a1835 |
+ const char *aversion;
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+ if (min_version == NULL) return True; // no version specified
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+ // get actual version number
|
|
Mark Wielaard |
2a1835 |
+#ifdef __GLIBC__
|
|
Mark Wielaard |
2a1835 |
+ aversion = gnu_get_libc_version();
|
|
Mark Wielaard |
2a1835 |
+#else
|
|
Mark Wielaard |
2a1835 |
+ aversion = "unknown";
|
|
Mark Wielaard |
2a1835 |
+#endif
|
|
Mark Wielaard |
2a1835 |
+ // We expect at least one number.
|
|
Mark Wielaard |
2a1835 |
+ if (sscanf(aversion, "%d.%d.%d", &a1, &a2, &a3) < 1) return False;
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+ // parse given version number.
|
|
Mark Wielaard |
2a1835 |
+ if (sscanf(min_version, "%d.%d.%d", &g1, &g2, &g3) < 1) return False;
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+ if (a1 > g1) return True;
|
|
Mark Wielaard |
2a1835 |
+ if (a1 < g1) return False;
|
|
Mark Wielaard |
2a1835 |
+ if (a2 > g2) return True;
|
|
Mark Wielaard |
2a1835 |
+ if (a2 < g2) return False;
|
|
Mark Wielaard |
2a1835 |
+ if (a3 >= g3) return True;
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+ return False;
|
|
Mark Wielaard |
2a1835 |
+}
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+static Bool go(char* libc, char *min_version)
|
|
Mark Wielaard |
2a1835 |
+{
|
|
Mark Wielaard |
2a1835 |
+#ifdef __GLIBC__
|
|
Mark Wielaard |
2a1835 |
+ if ( 0 == strcmp( libc, "glibc" )
|
|
Mark Wielaard |
2a1835 |
+ && matches_version( min_version ))
|
|
Mark Wielaard |
2a1835 |
+ return True;
|
|
Mark Wielaard |
2a1835 |
+#endif
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+ return False;
|
|
Mark Wielaard |
2a1835 |
+}
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+//---------------------------------------------------------------------------
|
|
Mark Wielaard |
2a1835 |
+// main
|
|
Mark Wielaard |
2a1835 |
+//---------------------------------------------------------------------------
|
|
Mark Wielaard |
2a1835 |
+int main(int argc, char **argv)
|
|
Mark Wielaard |
2a1835 |
+{
|
|
Mark Wielaard |
2a1835 |
+ if ( argc < 2 ) {
|
|
Mark Wielaard |
2a1835 |
+ fprintf( stderr, "usage: libc_test <libc-name> [<min-version>]\n" );
|
|
Mark Wielaard |
2a1835 |
+ exit(3); // Usage error.
|
|
Mark Wielaard |
2a1835 |
+ }
|
|
Mark Wielaard |
2a1835 |
+ if (go( argv[1], argv[2] )) {
|
|
Mark Wielaard |
2a1835 |
+ return 0; // Matched.
|
|
Mark Wielaard |
2a1835 |
+ }
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
+ if ( 0 == strcmp ( argv[1], "glibc" ) ) {
|
|
Mark Wielaard |
2a1835 |
+ return 1; // Requested libc name known, but this isn't it.
|
|
Mark Wielaard |
2a1835 |
+ // Or it wasn't the minimum requested version.
|
|
Mark Wielaard |
2a1835 |
+ }
|
|
Mark Wielaard |
2a1835 |
+ return 2; // Didn't match any known libc name.
|
|
Mark Wielaard |
2a1835 |
+}
|
|
Mark Wielaard |
2a1835 |
Only in valgrind-3.12.0.RC2: autom4te.cache
|
|
Mark Wielaard |
2a1835 |
diff -ur valgrind-3.12.0.RC2.orig/tests/Makefile.in valgrind-3.12.0.RC2/tests/Makefile.in
|
|
Mark Wielaard |
2a1835 |
--- valgrind-3.12.0.RC2.orig/tests/Makefile.in 2016-10-21 02:10:24.283643034 +0200
|
|
Mark Wielaard |
2a1835 |
+++ valgrind-3.12.0.RC2/tests/Makefile.in 2016-10-21 02:11:09.668003685 +0200
|
|
Mark Wielaard |
2a1835 |
@@ -121,10 +121,11 @@
|
|
Mark Wielaard |
2a1835 |
@COMPILER_IS_CLANG_TRUE@ -Wno-uninitialized -Wno-unused-value # \
|
|
Mark Wielaard |
2a1835 |
@COMPILER_IS_CLANG_TRUE@ clang 3.0.0
|
|
Mark Wielaard |
2a1835 |
@COMPILER_IS_CLANG_TRUE@am__append_7 = -Wno-unused-private-field # drd/tests/tsan_unittest.cpp
|
|
Mark Wielaard |
2a1835 |
-check_PROGRAMS = arch_test$(EXEEXT) os_test$(EXEEXT) true$(EXEEXT) \
|
|
Mark Wielaard |
2a1835 |
- x86_amd64_features$(EXEEXT) s390x_features$(EXEEXT) \
|
|
Mark Wielaard |
2a1835 |
- mips_features$(EXEEXT) power_insn_available$(EXEEXT) \
|
|
Mark Wielaard |
2a1835 |
- is_ppc64_BE$(EXEEXT) min_power_isa$(EXEEXT)
|
|
Mark Wielaard |
2a1835 |
+check_PROGRAMS = arch_test$(EXEEXT) os_test$(EXEEXT) \
|
|
Mark Wielaard |
2a1835 |
+ libc_test$(EXEEXT) true$(EXEEXT) x86_amd64_features$(EXEEXT) \
|
|
Mark Wielaard |
2a1835 |
+ s390x_features$(EXEEXT) mips_features$(EXEEXT) \
|
|
Mark Wielaard |
2a1835 |
+ power_insn_available$(EXEEXT) is_ppc64_BE$(EXEEXT) \
|
|
Mark Wielaard |
2a1835 |
+ min_power_isa$(EXEEXT)
|
|
Mark Wielaard |
2a1835 |
subdir = tests
|
|
Mark Wielaard |
2a1835 |
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
|
Mark Wielaard |
2a1835 |
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
|
|
Mark Wielaard |
2a1835 |
@@ -142,6 +143,9 @@
|
|
Mark Wielaard |
2a1835 |
is_ppc64_BE_SOURCES = is_ppc64_BE.c
|
|
Mark Wielaard |
2a1835 |
is_ppc64_BE_OBJECTS = is_ppc64_BE.$(OBJEXT)
|
|
Mark Wielaard |
2a1835 |
is_ppc64_BE_LDADD = $(LDADD)
|
|
Mark Wielaard |
2a1835 |
+libc_test_SOURCES = libc_test.c
|
|
Mark Wielaard |
2a1835 |
+libc_test_OBJECTS = libc_test.$(OBJEXT)
|
|
Mark Wielaard |
2a1835 |
+libc_test_LDADD = $(LDADD)
|
|
Mark Wielaard |
2a1835 |
min_power_isa_SOURCES = min_power_isa.c
|
|
Mark Wielaard |
2a1835 |
min_power_isa_OBJECTS = min_power_isa-min_power_isa.$(OBJEXT)
|
|
Mark Wielaard |
2a1835 |
min_power_isa_LDADD = $(LDADD)
|
|
Mark Wielaard |
2a1835 |
@@ -201,10 +205,10 @@
|
|
Mark Wielaard |
2a1835 |
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
|
Mark Wielaard |
2a1835 |
am__v_CCLD_0 = @echo " CCLD " $@;
|
|
Mark Wielaard |
2a1835 |
am__v_CCLD_1 =
|
|
Mark Wielaard |
2a1835 |
-SOURCES = arch_test.c is_ppc64_BE.c min_power_isa.c mips_features.c \
|
|
Mark Wielaard |
2a1835 |
- os_test.c power_insn_available.c s390x_features.c true.c \
|
|
Mark Wielaard |
2a1835 |
- x86_amd64_features.c
|
|
Mark Wielaard |
2a1835 |
-DIST_SOURCES = arch_test.c is_ppc64_BE.c min_power_isa.c \
|
|
Mark Wielaard |
2a1835 |
+SOURCES = arch_test.c is_ppc64_BE.c libc_test.c min_power_isa.c \
|
|
Mark Wielaard |
2a1835 |
+ mips_features.c os_test.c power_insn_available.c \
|
|
Mark Wielaard |
2a1835 |
+ s390x_features.c true.c x86_amd64_features.c
|
|
Mark Wielaard |
2a1835 |
+DIST_SOURCES = arch_test.c is_ppc64_BE.c libc_test.c min_power_isa.c \
|
|
Mark Wielaard |
2a1835 |
mips_features.c os_test.c power_insn_available.c \
|
|
Mark Wielaard |
2a1835 |
s390x_features.c true.c x86_amd64_features.c
|
|
Mark Wielaard |
2a1835 |
am__can_run_installinfo = \
|
|
Mark Wielaard |
2a1835 |
@@ -681,6 +685,10 @@
|
|
Mark Wielaard |
2a1835 |
@rm -f is_ppc64_BE$(EXEEXT)
|
|
Mark Wielaard |
2a1835 |
$(AM_V_CCLD)$(LINK) $(is_ppc64_BE_OBJECTS) $(is_ppc64_BE_LDADD) $(LIBS)
|
|
Mark Wielaard |
2a1835 |
|
|
Mark Wielaard |
2a1835 |
+libc_test$(EXEEXT): $(libc_test_OBJECTS) $(libc_test_DEPENDENCIES) $(EXTRA_libc_test_DEPENDENCIES)
|
|
Mark Wielaard |
2a1835 |
+ @rm -f libc_test$(EXEEXT)
|
|
Mark Wielaard |
2a1835 |
+ $(AM_V_CCLD)$(LINK) $(libc_test_OBJECTS) $(libc_test_LDADD) $(LIBS)
|
|
Mark Wielaard |
2a1835 |
+
|
|
Mark Wielaard |
2a1835 |
min_power_isa$(EXEEXT): $(min_power_isa_OBJECTS) $(min_power_isa_DEPENDENCIES) $(EXTRA_min_power_isa_DEPENDENCIES)
|
|
Mark Wielaard |
2a1835 |
@rm -f min_power_isa$(EXEEXT)
|
|
Mark Wielaard |
2a1835 |
$(AM_V_CCLD)$(min_power_isa_LINK) $(min_power_isa_OBJECTS) $(min_power_isa_LDADD) $(LIBS)
|
|
Mark Wielaard |
2a1835 |
@@ -717,6 +725,7 @@
|
|
Mark Wielaard |
2a1835 |
|
|
Mark Wielaard |
2a1835 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arch_test.Po@am__quote@
|
|
Mark Wielaard |
2a1835 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/is_ppc64_BE.Po@am__quote@
|
|
Mark Wielaard |
2a1835 |
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libc_test.Po@am__quote@
|
|
Mark Wielaard |
2a1835 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/min_power_isa-min_power_isa.Po@am__quote@
|
|
Mark Wielaard |
2a1835 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mips_features.Po@am__quote@
|
|
Mark Wielaard |
2a1835 |
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_test.Po@am__quote@
|