[PATCH] D55473: [Sanitizer] expand sysctl/getmntinfo/nl_langinfo to Darwin

David CARLIER via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 10 01:12:27 PST 2018


devnexen updated this revision to Diff 177467.
devnexen added a comment.
Herald added a subscriber: krytarowski.

- Create empty shells unit tests for non NetBSD hosts.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55473/new/

https://reviews.llvm.org/D55473

Files:
  lib/sanitizer_common/sanitizer_platform_interceptors.h
  test/sanitizer_common/TestCases/Posix/getmntinfo.cc
  test/sanitizer_common/TestCases/Posix/sysctl.cc


Index: test/sanitizer_common/TestCases/Posix/sysctl.cc
===================================================================
--- test/sanitizer_common/TestCases/Posix/sysctl.cc
+++ test/sanitizer_common/TestCases/Posix/sysctl.cc
@@ -1,6 +1,6 @@
 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
 //
-// UNSUPPORTED: linux, darwin, solaris
+// UNSUPPORTED: linux, solaris
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -84,6 +84,18 @@
 
   printf("sysctlgetmibinfo: '%s' size: '%zu'\n", buf, len);
 }
+#else
+void test_asysctl() {
+  printf("asysctl: '(null)' size: '0'\n");
+}
+
+void test_asysctlbyname() {
+  printf("asysctlbyname: '(null)' size: '0'\n");
+}
+
+void test_sysctlgetmibinfo() {
+  printf("sysctlgetmibinfo: '(null)' size: '0'\n");
+}
 #endif
 
 int main(void) {
@@ -92,21 +104,17 @@
   test_sysctl();
   test_sysctlbyname();
   test_sysctlnametomib();
-#if defined(__NetBSD__)
   test_asysctl();
   test_asysctlbyname();
   test_sysctlgetmibinfo();
-#endif
 
   // CHECK: sysctl
   // CHECK: sysctl: '{{.*}}' size: '{{.*}}'
   // CHECK: sysctlbyname: '{{.*}}' size: '{{.*}}'
   // CHECK: sysctlnametomib: '{{.*}}' size: '{{.*}}'
-#if defined(__NetBSD__)
   // CHECK: asysctl: '{{.*}}' size: '{{.*}}'
   // CHECK: asysctlbyname: '{{.*}}' size: '{{.*}}'
   // CHECK: sysctlgetmibinfo: '{{.*}}' size: '{{.*}}'
-#endif
 
   return 0;
 }
Index: test/sanitizer_common/TestCases/Posix/getmntinfo.cc
===================================================================
--- test/sanitizer_common/TestCases/Posix/getmntinfo.cc
+++ test/sanitizer_common/TestCases/Posix/getmntinfo.cc
@@ -1,6 +1,6 @@
 // RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck %s
 //
-// UNSUPPORTED: linux, darwin, solaris
+// UNSUPPORTED: linux, solaris
 
 #include <sys/types.h>
 
Index: lib/sanitizer_common/sanitizer_platform_interceptors.h
===================================================================
--- lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -519,15 +519,15 @@
 #define SANITIZER_INTERCEPT_NETENT SI_NETBSD
 #define SANITIZER_INTERCEPT_SETVBUF (SI_NETBSD || SI_FREEBSD || \
   SI_LINUX || SI_MAC)
-#define SANITIZER_INTERCEPT_GETMNTINFO (SI_NETBSD || SI_FREEBSD)
+#define SANITIZER_INTERCEPT_GETMNTINFO (SI_NETBSD || SI_FREEBSD || SI_MAC)
 #define SANITIZER_INTERCEPT_MI_VECTOR_HASH SI_NETBSD
 #define SANITIZER_INTERCEPT_GETVFSSTAT SI_NETBSD
 #define SANITIZER_INTERCEPT_REGEX SI_NETBSD
 #define SANITIZER_INTERCEPT_FTS SI_NETBSD
-#define SANITIZER_INTERCEPT_SYSCTL (SI_NETBSD || SI_FREEBSD)
+#define SANITIZER_INTERCEPT_SYSCTL (SI_NETBSD || SI_FREEBSD || SI_MAC)
 #define SANITIZER_INTERCEPT_ASYSCTL SI_NETBSD
 #define SANITIZER_INTERCEPT_SYSCTLGETMIBINFO SI_NETBSD
-#define SANITIZER_INTERCEPT_NL_LANGINFO (SI_NETBSD || SI_FREEBSD)
+#define SANITIZER_INTERCEPT_NL_LANGINFO (SI_NETBSD || SI_FREEBSD || SI_MAC)
 #define SANITIZER_INTERCEPT_MODCTL SI_NETBSD
 #define SANITIZER_INTERCEPT_CAPSICUM SI_FREEBSD
 #define SANITIZER_INTERCEPT_STRTONUM SI_NETBSD


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55473.177467.patch
Type: text/x-patch
Size: 3057 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181210/ce5957ee/attachment.bin>


More information about the llvm-commits mailing list