diff options
author | Kamil Rytarowski <n54@gmx.com> | 2018-02-02 18:45:33 +0000 |
---|---|---|
committer | Kamil Rytarowski <n54@gmx.com> | 2018-02-02 18:45:33 +0000 |
commit | 485b985337d240a73fed614a954285e0e0908b35 (patch) | |
tree | 5811c841fdb47f78877c899670fac2a3dc6420ef /test/sanitizer_common | |
parent | 67df2e3675af69861d83ad18fff5e7ac99ffd347 (diff) |
Add new NetBSD interceptors: devname(3), devname_r(3)
Summary:
devname, devname_r - get device name
Sponsored by <The NetBSD Foundation>
Reviewers: joerg, vitalybuka
Reviewed By: vitalybuka
Subscribers: kubamracek, llvm-commits, #sanitizers
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D42053
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@324120 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r-- | test/sanitizer_common/TestCases/NetBSD/devname.cc | 22 | ||||
-rw-r--r-- | test/sanitizer_common/TestCases/NetBSD/devname_r.cc | 27 |
2 files changed, 49 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/NetBSD/devname.cc b/test/sanitizer_common/TestCases/NetBSD/devname.cc new file mode 100644 index 000000000..79f1e6595 --- /dev/null +++ b/test/sanitizer_common/TestCases/NetBSD/devname.cc @@ -0,0 +1,22 @@ +// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck + +#include <stdio.h> +#include <stdlib.h> +#include <sys/stat.h> + +int main(void) { + struct stat st; + char *name; + + if (stat("/dev/null", &st)) + exit(1); + + if (!(name = devname(st.st_rdev, S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK))) + exit(1); + + printf("%s\n", name); + + // CHECK: null + + return 0; +} diff --git a/test/sanitizer_common/TestCases/NetBSD/devname_r.cc b/test/sanitizer_common/TestCases/NetBSD/devname_r.cc new file mode 100644 index 000000000..2a4b1737c --- /dev/null +++ b/test/sanitizer_common/TestCases/NetBSD/devname_r.cc @@ -0,0 +1,27 @@ +// RUN: %clangxx -O0 -g %s -o %t && %run %t 2>&1 | FileCheck + +#include <sys/cdefs.h> +#include <sys/stat.h> + +#include <stdio.h> +#include <stdlib.h> + +int main(void) { + struct stat st; + char name[10]; + mode_t type; + + if (stat("/dev/null", &st)) + exit(1); + + type = S_ISCHR(st.st_mode) ? S_IFCHR : S_IFBLK; + + if (devname_r(st.st_rdev, type, name, __arraycount(name))) + exit(1); + + printf("%s\n", name); + + // CHECK: null + + return 0; +} |