[compiler-rt] bf6000d - [sanitizer] Fix the test on Solaris
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 12 16:10:32 PDT 2021
Author: Vitaly Buka
Date: 2021-08-12T16:10:23-07:00
New Revision: bf6000dc98df82d9b493e0b5d247538f51d6b9ac
URL: https://github.com/llvm/llvm-project/commit/bf6000dc98df82d9b493e0b5d247538f51d6b9ac
DIFF: https://github.com/llvm/llvm-project/commit/bf6000dc98df82d9b493e0b5d247538f51d6b9ac.diff
LOG: [sanitizer] Fix the test on Solaris
On Solaris sem_open on the same name returns the same pointer, and
then sem_close fails the call.
Added:
Modified:
compiler-rt/test/sanitizer_common/TestCases/Posix/sem_open.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/sem_open.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/sem_open.cpp
index b805fb152427d..9c03d5abb3cdb 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/sem_open.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/sem_open.cpp
@@ -11,16 +11,10 @@
int main() {
char name[1024];
- sprintf(name, "/sem_open_test_%d", getpid());
-
- sem_t *s1 = sem_open(name, O_CREAT, 0644, 123);
- assert(s1 != SEM_FAILED);
-
- sem_t *s2 = sem_open(name, O_CREAT, 0644, 123);
- assert(s2 != SEM_FAILED);
-
- assert(sem_close(s1) == 0);
- assert(sem_close(s2) == 0);
+ sprintf(name, "/sem_open_test_%zu", (size_t)getpid());
+ sem_t *s = sem_open(name, O_CREAT, 0644, 123);
+ assert(s != SEM_FAILED);
+ assert(sem_close(s) == 0);
assert(sem_unlink(name) == 0);
}
More information about the llvm-commits
mailing list