From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master

tests: disable named semaphore testing when running on OSv with ld.so

Even though OSv implements named semaphores it does so without
/dev/shm pseudo filesystem.

When running the tst-semaphore.c test on OSv with Linux dynamic
linker, the glibc implementation of it ends up trying to create
files under /dev/shm which fail:

0x0000400001a6b040 /lib64/ld-linux  0         0.303028066 syscall_openat       
-1 <= -100 "/dev/shm/sem.name" 0400002 0
0x0000400001a6b040 /lib64/ld-linux  0         0.303452134 syscall_getrandom    
-1 <= 0x200000200558 8 1
0x0000400001a6b040 /lib64/ld-linux  0         0.303455735 syscall_fstatat      
-1 <= -100 "/dev/shm/sem.Y244sc" 0x0000200000200450 0400
0x0000400001a6b040 /lib64/ld-linux  0         0.303458186 syscall_openat       
-1 <= -100 "/dev/shm/sem.Y244sc" 0302 511

For now, we disable the named semaphore testing of the unit test
when built to be part of tests-with-linux-ld.

Signed-off-by: Waldemar Kozaczuk <[email protected]>

---
diff --git a/modules/tests-with-linux-ld/Makefile 
b/modules/tests-with-linux-ld/Makefile
--- a/modules/tests-with-linux-ld/Makefile
+++ b/modules/tests-with-linux-ld/Makefile
@@ -58,6 +58,7 @@ $(out)/tests-with-linux-ld/tst-fallocate.o: COMMON:=-D__OSV__ 
$(COMMON)
 $(out)/tests-with-linux-ld/tst-fread.o: COMMON:=-D__OSV__ $(COMMON)
 $(out)/tests-with-linux-ld/tst-net_if_test.o: COMMON:=-D__OSV__ $(COMMON)
 $(out)/tests-with-linux-ld/tst-pipe.o: COMMON:=-D__OSV__ $(COMMON)
+$(out)/tests-with-linux-ld/tst-semaphore.o: 
COMMON:=-D__DISABLE_NAMED_SEMAPHORES__ $(COMMON)
 $(out)/tests-with-linux-ld/tst-uio.o: COMMON:=-D__OSV__ $(COMMON)
 
 #
diff --git a/tests/tst-semaphore.c b/tests/tst-semaphore.c
--- a/tests/tst-semaphore.c
+++ b/tests/tst-semaphore.c
@@ -56,7 +56,8 @@ int main(void) {
     assert(sem_destroy(&sem_sync) == 0);
     assert(sem_destroy(&sem_done) == 0);
 
-    ///Named sempahore test
+#ifndef __DISABLE_NAMED_SEMAPHORES__
+    ///Named semaphore test
 
     //Create and open two handles to a named semaphore
     sem_t *named_sem1 = sem_open("name", O_CREAT, 0777, 1);
@@ -96,6 +97,7 @@ int main(void) {
     //Close handles
     assert(sem_close(named_sem1) == 0);
     assert(sem_close(named_sem2) == 0);
+#endif
 
     return 0;
 }

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/00000000000067a4f5060c84e491%40google.com.

Reply via email to