Skip to contentSkip to conversation

syscalls/semctl09: Skip libc test if SEM_STAT_ANY not defined

PATCH New Martin Doucha 2 participants 2 messages Mar 19, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 syscalls/semctl09: Skip libc test if SEM_STAT_ANY not defined

The libc test variant should run only if system headers define SEM_STAT_ANY. Skip it if we're falling back to the LAPI definition.

---

Changes since v2:
- move test_info() call before #if to make test output more clear

 configure.ac                                    | 1 +
 testcases/kernel/syscalls/ipc/semctl/semctl09.c | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)
configure.ac +1 -0
index 37bafb93d..136d82d09 100644
@@ -38,6 +38,7 @@ AC_PREFIX_DEFAULT(/opt/ltp)
 AC_CHECK_DECLS([IFLA_NET_NS_PID],,,[#include <linux/if_link.h>])
 AC_CHECK_DECLS([MADV_MERGEABLE],,,[#include <sys/mman.h>])
 AC_CHECK_DECLS([PR_CAPBSET_DROP, PR_CAPBSET_READ],,,[#include <sys/prctl.h>])
+AC_CHECK_DECLS([SEM_STAT_ANY],,,[#include <sys/sem.h>])
 
 AC_CHECK_HEADERS_ONCE([ \
     asm/ldt.h \
testcases/kernel/syscalls/ipc/semctl/semctl09.c +6 -1
index a933cff0e..5a81f778c 100644
@@ -185,9 +185,14 @@ static void setup(void)
 
 	nobody_uid = ltpuser->pw_uid;
 	root_uid = 0;
+	test_info();
+
+#if !HAVE_DECL_SEM_STAT_ANY
+	if (tst_variant == 1)
+		tst_brk(TCONF, "libc does not support semctl(SEM_STAT_ANY)");
+#endif
 
 	sem_id = SAFE_SEMGET(IPC_PRIVATE, 2, IPC_CREAT | 0600);
-	test_info();
 }
 
 static void cleanup(void)
Signature · 1 line
2.30.2
#1 lore raw

PATCH v2 1/1 syscalls/semctl09: Skip libc test if SEM_STAT_ANY not defined

Hi Martin,

Quoted 2 lines

The libc test variant should run only if system headers define SEM_STAT_ANY. Skip it if we're falling back to the LAPI definition.

Thanks a lot, merged (with also Xu Reviewed-by tag).

Kind regards,
Petr