[compiler-rt] r185076 - [msan] Optionally disable 2 tests (dlopen & gethostbyname).

Evgeniy Stepanov eugeni.stepanov at gmail.com
Thu Jun 27 06:21:00 PDT 2013


Author: eugenis
Date: Thu Jun 27 08:21:00 2013
New Revision: 185076

URL: http://llvm.org/viewvc/llvm-project?rev=185076&view=rev
Log:
[msan] Optionally disable 2 tests (dlopen & gethostbyname).

Modified:
    compiler-rt/trunk/lib/msan/tests/msan_test.cc

Modified: compiler-rt/trunk/lib/msan/tests/msan_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/msan/tests/msan_test.cc?rev=185076&r1=185075&r2=185076&view=diff
==============================================================================
--- compiler-rt/trunk/lib/msan/tests/msan_test.cc (original)
+++ compiler-rt/trunk/lib/msan/tests/msan_test.cc Thu Jun 27 08:21:00 2013
@@ -780,12 +780,16 @@ TEST(MemorySanitizer, gethostent) {
   EXPECT_HOSTENT_NOT_POISONED(he);
 }
 
+#ifndef MSAN_TEST_DISABLE_GETHOSTBYNAME
+
 TEST(MemorySanitizer, gethostbyname) {
   struct hostent *he = gethostbyname("localhost");
   ASSERT_NE((void *)NULL, he);
   EXPECT_HOSTENT_NOT_POISONED(he);
 }
 
+#endif // MSAN_TEST_DISABLE_GETHOSTBYNAME
+
 TEST(MemorySanitizer, gethostbyname2) {
   struct hostent *he = gethostbyname2("localhost", AF_INET);
   ASSERT_NE((void *)NULL, he);
@@ -1762,18 +1766,6 @@ extern char *program_invocation_name;
 # error "TODO: port this"
 #endif
 
-// Compute the path to our loadable DSO.  We assume it's in the same
-// directory.  Only use string routines that we intercept so far to do this.
-static int PathToLoadable(char *buf, size_t sz) {
-  const char *basename = "libmsan_loadable.x86_64.so";
-  char *argv0 = program_invocation_name;
-  char *last_slash = strrchr(argv0, '/');
-  assert(last_slash);
-  int res =
-      snprintf(buf, sz, "%.*s/%s", int(last_slash - argv0), argv0, basename);
-  return res < sz ? 0 : res;
-}
-
 static void dladdr_testfn() {}
 
 TEST(MemorySanitizer, dladdr) {
@@ -1801,6 +1793,20 @@ static int dl_phdr_callback(struct dl_ph
   return 0;
 }
 
+#ifndef MSAN_TEST_DISABLE_DLOPEN
+
+// Compute the path to our loadable DSO.  We assume it's in the same
+// directory.  Only use string routines that we intercept so far to do this.
+static int PathToLoadable(char *buf, size_t sz) {
+  const char *basename = "libmsan_loadable.x86_64.so";
+  char *argv0 = program_invocation_name;
+  char *last_slash = strrchr(argv0, '/');
+  assert(last_slash);
+  int res =
+      snprintf(buf, sz, "%.*s/%s", int(last_slash - argv0), argv0, basename);
+  return res < sz ? 0 : res;
+}
+
 TEST(MemorySanitizer, dl_iterate_phdr) {
   char path[4096];
   int res = PathToLoadable(path, sizeof(path));
@@ -1852,6 +1858,8 @@ TEST(MemorySanitizer, dlopenFailed) {
   ASSERT_EQ(0, lib);
 }
 
+#endif // MSAN_TEST_DISABLE_DLOPEN
+
 TEST(MemorySanitizer, scanf) {
   const char *input = "42 hello";
   int* d = new int;





More information about the llvm-commits mailing list