syscalls/semctl09: Skip libc test if SEM_STAT_ANY not defined
PATCH 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.
--- configure.ac | 1 + testcases/kernel/syscalls/ipc/semctl/semctl09.c | 5 +++++ 2 files changed, 6 insertions(+)
configure.ac +1 -0
@@ -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 +5 -0
@@ -186,6 +186,11 @@ static void setup(void) nobody_uid = ltpuser->pw_uid; root_uid =0 ; +#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 (); }
Signature · 1 line
2.30.2
PATCH 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!
...
Quoted 1 line
+#if !HAVE_DECL_SEM_STAT_ANY
nit: I'd prefer
#ifndef HAVE_DECL_SEM_STAT_ANY
testcases/kernel/syscalls/ipc/semctl/semctl09.c static void setup(void) · line 192
Quoted 3 lines
testcases/kernel/syscalls/ipc/semctl/semctl09.c +3
-0+if (tst_variant ==1 ) +tst_brk (TCONF ,"libc does not support semctl(SEM_STAT_ANY)" ); +#endif
Although I understand why you want to quit only tests with root (only these fail), it's a bit confusing to test with user nobody and then quit the same testing with root.
Kind regards,
Petr
PATCH 1/1 syscalls/semctl09: Skip libc test if SEM_STAT_ANY not defined
Hi Petr
Quoted 4 lines
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.
Quoted 8 lines
Reviewed-by Petr Vorel <[email protected]>Thanks!
...
Quoted 1 line
+#if !HAVE_DECL_SEM_STAT_ANY
nit: I'd prefer
#ifndefHAVE_DECL_SEM_STAT_ANY
+1
Quoted 6 lines
testcases/kernel/syscalls/ipc/semctl/semctl09.c static void setup(void) · line 192
Quoted 3 lines
testcases/kernel/syscalls/ipc/semctl/semctl09.c +3
-0+if (tst_variant ==1 ) +tst_brk (TCONF ,"libc does not support semctl(SEM_STAT_ANY)" ); +#endif Although I understand why you want to quit only tests with root (only these fail), it's a bit confusing to test with user nobody and then quit the same testing with root.
I don't get this.? Martin only wants to skip libc test when undefined and it doesn't matter which user we use.
Quoted 3 lines
Kind regards,
Petr
PATCH 1/1 syscalls/semctl09: Skip libc test if SEM_STAT_ANY not defined
Hi Xu,
Quoted 9 lines
Quoted 6 lines
testcases/kernel/syscalls/ipc/semctl/semctl09.c static void setup(void) · line 192
Quoted 3 lines
testcases/kernel/syscalls/ipc/semctl/semctl09.c +3
-0+if (tst_variant ==1 ) +tst_brk (TCONF ,"libc does not support semctl(SEM_STAT_ANY)" ); +#endif Although I understand why you want to quit only tests with root (only these fail), it's a bit confusing to test with user nobody and then quit the same testing with root.
I don't get this.? Martin only wants to skip libc test when undefined and it doesn't matter which user we use.
if (tst_variant == 1)
tst_brk(TCONF, "libc does not support semctl(SEM_STAT_ANY)");
means:
# /semctl09 tst_test.c:1289: TINFO: Timeout per run is 0h 05m 00s semctl09.c:76: TINFO: Test SYS_semctl syscall semctl09.c:141: TINFO: Test SEM_STAT_ANY with nobody user semctl09.c:163: TPASS: SEM_INFO returned valid index 19 to semid 19 semctl09.c:173: TPASS: Counted used = 1 semctl09.c:121: TPASS: semset_cnt = 1 semctl09.c:128: TPASS: sen_cnt = 2 semctl09.c:141: TINFO: Test SEM_STAT_ANY with root user semctl09.c:163: TPASS: SEM_INFO returned valid index 19 to semid 19 semctl09.c:173: TPASS: Counted used = 1 semctl09.c:121: TPASS: semset_cnt = 1 semctl09.c:128: TPASS: sen_cnt = 2 tst_test.c:1289: TINFO: Timeout per run is 0h 05m 00s semctl09.c:191: TCONF: libc does not support semctl(SEM_STAT_ANY)
i.e. run first test with user nobody and skip the second. It's a bit confusing to test anything with SEM_STAT_ANY and then state
TCONF: libc does not support semctl(SEM_STAT_ANY) :)
Kind regards,
Petr
PATCH 1/1 syscalls/semctl09: Skip libc test if SEM_STAT_ANY not defined
Hi Petr
Quoted 33 lines
Hi Xu,
Quoted 9 lines
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+ if (tst_variant == 1) + tst_brk(TCONF, "libc does not support semctl(SEM_STAT_ANY)"); +#endifAlthough I understand why you want to quit only tests with root (only these fail), it's a bit confusing to test with user nobody and then quit the same testing with root.
I don't get this. Martin only wants to skip libc test when undefined and it doesn't matter which user we use.
if (
tst_variant== 1)tst_brk(TCONF, "libc does not support semctl(SEM_STAT_ANY)");means:
# /semctl09 tst_test.c:1289: TINFO: Timeout per run is 0h 05m 00s semctl09.c:76: TINFO: Test SYS_semctl syscall semctl09.c:141: TINFO: Test SEM_STAT_ANY with nobody user semctl09.c:163: TPASS: SEM_INFO returned valid index 19 to semid 19 semctl09.c:173: TPASS: Counted used = 1 semctl09.c:121: TPASS: semset_cnt = 1 semctl09.c:128: TPASS: sen_cnt = 2 semctl09.c:141: TINFO: Test SEM_STAT_ANY with root user semctl09.c:163: TPASS: SEM_INFO returned valid index 19 to semid 19 semctl09.c:173: TPASS: Counted used = 1 semctl09.c:121: TPASS: semset_cnt = 1 semctl09.c:128: TPASS: sen_cnt = 2 tst_test.c:1289: TINFO: Timeout per run is 0h 05m 00s semctl09.c:191: TCONF: libc does not support semctl(SEM_STAT_ANY)
Quoted 3 lines
i.e. run first test with user nobody and skip the second. It's a bit confusing to test anything with
SEM_STAT_ANYand then state
TCONF: libc does not supportsemctl(SEM_STAT_ANY):)
Thanks. I got it.
I guess we can move this check into test_info as below:
testcases/kernel/syscalls/ipc/semctl/semctl09.c +2 -0
@@ -77,6 +77,9 @@ static void test_info(void)break ;case 1 :tst_res (TINFO ,"Test libc semctl()" ); +#ifndef HAVE_DECL_SEM_STAT_ANY + tst_brk(TCONF, "libc does not support
semctl(SEM_STAT_ANY)");
+#endif
break;
Then output as below:
# ./semctl09 tst_test.c:1291: TINFO: Timeout per run is 0h 05m 00s semctl09.c:76: TINFO: Test SYS_semctl syscall semctl09.c:144: TINFO: Test SEM_STAT_ANY with nobody user semctl09.c:167: TPASS: SEM_INFO returned valid index 34 to semid 34 semctl09.c:176: TPASS: Counted used = 1 semctl09.c:124: TPASS: semset_cnt = 1 semctl09.c:131: TPASS: sen_cnt = 2 semctl09.c:144: TINFO: Test SEM_STAT_ANY with root user semctl09.c:167: TPASS: SEM_INFO returned valid index 34 to semid 34 semctl09.c:176: TPASS: Counted used = 1 semctl09.c:124: TPASS: semset_cnt = 1 semctl09.c:131: TPASS: sen_cnt = 2 tst_test.c:1291: TINFO: Timeout per run is 0h 05m 00s semctl09.c:79: TINFO: Test libc semctl() semctl09.c:81: TCONF: libc does not support semctl(SEM_STAT_ANY)
Quoted 4 lines
Kind regards,
Petr
PATCH 1/1 syscalls/semctl09: Skip libc test if SEM_STAT_ANY not defined
In reply to Petr VorelQuoted 5 lines · Petr Vorel
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.
Quoted 8 lines
Reviewed-by Petr Vorel <[email protected]>Thanks!
...
Quoted 1 line
+#if !HAVE_DECL_SEM_STAT_ANY
nit: I'd prefer
#ifndefHAVE_DECL_SEM_STAT_ANY
That will not work. AC_CHECK_DECLS() will always define HAVE_DECL_SEM_STAT_ANY, either with the value of 0 (macro not defined) or 1 (defined).
Quoted 6 lines
testcases/kernel/syscalls/ipc/semctl/semctl09.c static void setup(void) · line 192
Quoted 3 lines
testcases/kernel/syscalls/ipc/semctl/semctl09.c +3
-0+if (tst_variant ==1 ) +tst_brk (TCONF ,"libc does not support semctl(SEM_STAT_ANY)" ); +#endif Although I understand why you want to quit only tests with root (only these fail), it's a bit confusing to test with user nobody and then quit the same testing with root.
tst_variant has nothing to do with UID.tst_variant == 0 => run the test using tst_syscall(__NR_semctl) tst_variant == 1 => run the test again using libc semctl()
But if you want to make the test output a little more clear, I could move the test_info() call at the end of setup() a few lines up before the new #if.
Signature · 7 lines
Martin Doucha [email protected] QA Engineer for Software Maintenance SUSE LINUX, s.r.o. CORSO IIa Krizikova 148/34 186 00 Prague 8 Czech Republic
PATCH 1/1 syscalls/semctl09: Skip libc test if SEM_STAT_ANY not defined
Hi Martin,
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
+#if !HAVE_DECL_SEM_STAT_ANY
nit: I'd prefer
#ifndefHAVE_DECL_SEM_STAT_ANYThat will not work.
AC_CHECK_DECLS()will always defineHAVE_DECL_SEM_STAT_ANY, either with the value of 0 (macro not defined) or 1 (defined).
Correct, I'm sorry, thanks for catching my error.
Quoted 10 lines
Quoted 6 lines
testcases/kernel/syscalls/ipc/semctl/semctl09.c static void setup(void) · line 192
Quoted 3 lines
testcases/kernel/syscalls/ipc/semctl/semctl09.c +3
-0+if (tst_variant ==1 ) +tst_brk (TCONF ,"libc does not support semctl(SEM_STAT_ANY)" ); +#endif Although I understand why you want to quit only tests with root (only these fail), it's a bit confusing to test with user nobody and then quit the same testing with root.
tst_varianthas nothing to do with UID.tst_variant== 0 => run the test usingtst_syscall(__NR_semctl)tst_variant== 1 => run the test again using libcsemctl()
Again, correct, sorry for wrong report.
Quoted 3 lines
But if you want to make the test output a little more clear, I could move the
test_info()call at the end ofsetup()a few lines up before the new #if.
+1
Kind regards,
Petr