Skip to contentSkip to conversation

lib/tst_test.c: Take account of tst_brk(TCONF)/tst_brk(TFAIL) in summary output

PATCH New Xiao Yang 2 participants 6 messages May 18, 2020 – May 27, 2020 Library code

lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 lib/tst_test.c: Take account of tst_brk(TCONF)/tst_brk(TFAIL) in summary output

Current summary output doesn't take account of tst_brk(TCONF/TFAIL),
for example:
-----------------------------------------------------
[root@RHEL8U2GA_Intel64 pidfd_send_signal]# ./pidfd_send_signal01
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s ../../../../include/lapi/pidfd_send_signal.h:16: CONF: syscall(424) __NR_pidfd_send_signal not supported

Summary:

passed   0
failed   0
skipped  0

warnings 0
-----------------------------------------------------

---
 lib/tst_test.c | 1 +
 1 file changed, 1 insertion(+)
lib/tst_test.c +1 -0
index 0e58060e0..b28521a67 100644
@@ -316,6 +316,7 @@ void tst_vbrk_(const char *file, const int lineno, int ttype,
                const char *fmt, va_list va)
 {
 	print_result(file, lineno, ttype, fmt, va);
+	update_results(TTYPE_RESULT(ttype));
 
 	/*
 	 * The getpid implementation in some C library versions may cause cloned
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 lib/tst_test.c: Take account of tst_brk(TCONF)/tst_brk(TFAIL) in summary output

Hi!

Quoted 8 lines
 lib/tst_test.c | 1 +
 1 file changed, 1 insertion(+)
lib/tst_test.c +0 -0
index 0e58060e0..b28521a67 100644

lib/tst_test.c void tst_vbrk_(const char *file, const int lineno, int ttype, · line 322

Quoted 7 lines
lib/tst_test.c +1 -0
@@ -316,6 +316,7 @@ void tst_vbrk_(const char *file, const int lineno, int ttype,
                const char *fmt, va_list va)
 {
 	print_result(file, lineno, ttype, fmt, va);
+	update_results(TTYPE_RESULT(ttype));
 
 	/*
 	 * The getpid implementation in some C library versions may cause cloned

Good catch, but I guess that we should also remove the update_result() call from the run_tcases_per_fs() after this.

And it also makes sense to call the function as a first thing in the tst_res_/tst_brk_ function, which simplifies the code flow.

So I guess that we want something like this (not tested):

lib/tst_test.c +5 -6
index 0e58060e0..9d0ef672d 100644
@@ -278,8 +278,6 @@ void tst_vres_(const char *file, const int lineno, int ttype,
                const char *fmt, va_list va)
 {
        print_result(file, lineno, ttype, fmt, va);
-
-       update_results(TTYPE_RESULT(ttype));
 }
 
 void tst_vbrk_(const char *file, const int lineno, int ttype,
@@ -297,7 +295,6 @@ static void tst_cvres(const char *file, const int lineno, int ttype,
        }
 
        print_result(file, lineno, ttype, fmt, va);
-       update_results(TTYPE_RESULT(ttype));
 }
 
 static void do_test_cleanup(void)
@@ -337,6 +334,8 @@ void tst_res_(const char *file, const int lineno, int ttype,
 {
        va_list va;
 
+       update_results(TTYPE_RESULT(ttype));
+
        va_start(va, fmt);
        tst_vres_(file, lineno, ttype, fmt, va);
        va_end(va);
@@ -347,6 +346,8 @@ void tst_brk_(const char *file, const int lineno, int ttype,
 {
        va_list va;
 
+       update_results(TTYPE_RESULT(ttype));
+
        va_start(va, fmt);
        tst_brk_handler(file, lineno, ttype, fmt, va);
        va_end(va);
@@ -1316,10 +1317,8 @@ static int run_tcases_per_fs(void)
                        mntpoint_mounted = 0;
                }
 
-               if (ret == TCONF) {
-                       update_results(ret);
+               if (ret == TCONF)
                        continue;
-               }
 
                if (ret == 0)
                        continue;
Signature · 2 lines
Cyril Hrubis
[email protected]
author
#2 lore raw

PATCH 1/1 lib/tst_test.c: Take account of tst_brk(TCONF)/tst_brk(TFAIL) in summary output

Quoted 14 lines · Cyril Hrubis

Hi!

Quoted 13 lines
  lib/tst_test.c | 1 +
  1 file changed, 1 insertion(+)
lib/tst_test.c +1 -0
index 0e58060e0..b28521a67 100644
@@ -316,6 +316,7 @@ void tst_vbrk_(const char *file, const int lineno, int ttype,
                 const char *fmt, va_list va)
  {
  	print_result(file, lineno, ttype, fmt, va);
+	update_results(TTYPE_RESULT(ttype));
 
Quoted 5 lines

lib/tst_test.c void tst_vbrk_(const char *file, const int lineno, int ttype, · line 322

Quoted 2 lines
lib/tst_test.c +0 -0
  	/*
  	 * The getpid implementation in some C library versions may cause cloned

Good catch, but I guess that we should also remove the update_result() call from the run_tcases_per_fs() after this.

Hi Cyril,

Agreed. I missed redundant update_result() in run_tcases_per_fs() after this change.

Quoted 3 lines

And it also makes sense to call the function as a first thing in the tst_res_/tst_brk_ function, which simplifies the code flow.

It is actually simpler but it changes the original logic of tst_cvres() called by tst_brk(TBROK) in cleanup().
Before change, tst_cvres() changes TBROK to TWARN and then saves TWARN into summary output:
----------------------------------
e.g. Add some debug code in preadv01:
[root@Fedora-30 preadv]# ./preadv01
tst_buffers.c:55: INFO: Test is using guarded buffers tst_test.c:1244: INFO: Timeout per run is 0h 05m 00s preadv01.c:80: PASS: Preadv(2) read 64 bytes successfully with content 'a' expectedly
preadv01.c:80: PASS: Preadv(2) read 64 bytes successfully with content 'a' expectedly
preadv01.c:80: PASS: Preadv(2) read 32 bytes successfully with content 'b' expectedly
preadv01.c:99: WARN: test

Summary:

passed   3
failed   0
skipped  0

warnings 1
----------------------------------
After change, tst_cvres() changes TBROK to TWARN but doesn't save TWARN into summary output:
----------------------------------
e.g. Add some debug code in preadv01:
[root@Fedora-30 preadv]# ./preadv01
tst_buffers.c:55: INFO: Test is using guarded buffers tst_test.c:1245: INFO: Timeout per run is 0h 05m 00s preadv01.c:80: PASS: Preadv(2) read 64 bytes successfully with content 'a' expectedly
preadv01.c:80: PASS: Preadv(2) read 64 bytes successfully with content 'a' expectedly
preadv01.c:80: PASS: Preadv(2) read 32 bytes successfully with content 'b' expectedly
preadv01.c:99: WARN: test

Summary:

passed   3
failed   0
skipped  0

warnings 0
----------------------------------

I perfer to add a update_results() in tst_vbrk_(), do you think so?

Best Regards,
Xiao Yang

Quoted 56 lines

So I guess that we want something like this (not tested):

lib/tst_test.c +5 -6
index 0e58060e0..9d0ef672d 100644
@@ -278,8 +278,6 @@ void tst_vres_(const char *file, const int lineno, int ttype,
                 const char *fmt, va_list va)
  {
         print_result(file, lineno, ttype, fmt, va);
-
-       update_results(TTYPE_RESULT(ttype));
  }
 
  void tst_vbrk_(const char *file, const int lineno, int ttype,
@@ -297,7 +295,6 @@ static void tst_cvres(const char *file, const int lineno, int ttype,
         }
 
         print_result(file, lineno, ttype, fmt, va);
-       update_results(TTYPE_RESULT(ttype));
  }
 
  static void do_test_cleanup(void)
@@ -337,6 +334,8 @@ void tst_res_(const char *file, const int lineno, int ttype,
  {
         va_list va;
 
+       update_results(TTYPE_RESULT(ttype));
+
         va_start(va, fmt);
         tst_vres_(file, lineno, ttype, fmt, va);
         va_end(va);
@@ -347,6 +346,8 @@ void tst_brk_(const char *file, const int lineno, int ttype,
  {
         va_list va;
 
+       update_results(TTYPE_RESULT(ttype));
+
         va_start(va, fmt);
         tst_brk_handler(file, lineno, ttype, fmt, va);
         va_end(va);
@@ -1316,10 +1317,8 @@ static int run_tcases_per_fs(void)
                         mntpoint_mounted = 0;
                 }
 
-               if (ret == TCONF) {
-                       update_results(ret);
+               if (ret == TCONF)
                         continue;
-               }
 
                 if (ret == 0)
                         continue;
author
#3 lore raw

PATCH v2 1/1 lib/tst_test.c: Take account of tst_brk(TCONF/TFAIL) in summary output

Current summary output doesn't take account of tst_brk(TCONF/TFAIL),
for example:
-----------------------------------------------------
[root@Fedora-30 pidfd_send_signal]# ./pidfd_send_signal01
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s ../../../../include/lapi/pidfd_send_signal.h:16: CONF: syscall(424) __NR_pidfd_send_signal not supported

Summary:

passed   0
failed   0
skipped  0

warnings 0
----------------------------------------------------

1) Add update_result() in tst_vbrk_() to fix the issue.
2) Remove redundant update_result() in run_tcases_per_fs() after the fix.

---
 lib/tst_test.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
lib/tst_test.c +2 -3
index 0e58060e0..e93c88ba5 100644
@@ -316,6 +316,7 @@ void tst_vbrk_(const char *file, const int lineno, int ttype,
                const char *fmt, va_list va)
 {
 	print_result(file, lineno, ttype, fmt, va);
+	update_results(TTYPE_RESULT(ttype));
 
 	/*
 	 * The getpid implementation in some C library versions may cause cloned
@@ -1316,10 +1317,8 @@ static int run_tcases_per_fs(void)
 			mntpoint_mounted = 0;
 		}
 
-		if (ret == TCONF) {
-			update_results(ret);
+		if (ret == TCONF)
 			continue;
-		}
 
 		if (ret == 0)
 			continue;
Signature · 1 line
2.21.0
author
#4 lore raw

PATCH v2 1/1 lib/tst_test.c: Take account of tst_brk(TCONF/TFAIL) in summary output

Hi,

I want to push it tomorrow if nobody has any objection.

Thanks,
Xiao Yang

Quoted 46 lines · Xiao Yang

Current summary output doesn't take account of tst_brk(TCONF/TFAIL),
for example:
-----------------------------------------------------
[root@Fedora-30 pidfd_send_signal]# ./pidfd_send_signal01
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s ../../../../include/lapi/pidfd_send_signal.h:16: CONF: syscall(424) __NR_pidfd_send_signal not supported

Summary:

passed   0
failed   0
skipped  0

warnings 0
----------------------------------------------------

1) Add update_result() in tst_vbrk_() to fix the issue.
2) Remove redundant update_result() in run_tcases_per_fs() after the fix.

---
  lib/tst_test.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
lib/tst_test.c +2 -3
index 0e58060e0..e93c88ba5 100644
@@ -316,6 +316,7 @@ void tst_vbrk_(const char *file, const int lineno, int ttype,
                 const char *fmt, va_list va)
  {
  	print_result(file, lineno, ttype, fmt, va);
+	update_results(TTYPE_RESULT(ttype));
 
  	/*
  	 * The getpid implementation in some C library versions may cause cloned
@@ -1316,10 +1317,8 @@ static int run_tcases_per_fs(void)
  			mntpoint_mounted = 0;
  		}
 
-		if (ret == TCONF) {
-			update_results(ret);
+		if (ret == TCONF)
  			continue;
-		}
 
  		if (ret == 0)
  			continue;
author
#5 lore raw

PATCH v2 1/1 lib/tst_test.c: Take account of tst_brk(TCONF/TFAIL) in summary output

Hi,

Pushed.

Best Regards,
Xiao Yang

Quoted 56 lines · Xiao Yang

Hi,

I want to push it tomorrow if nobody has any objection.

Thanks,
Xiao Yang

Quoted 36 lines · Xiao Yang

Current summary output doesn't take account of tst_brk(TCONF/TFAIL),
for example:
-----------------------------------------------------
[root@Fedora-30 pidfd_send_signal]# ./pidfd_send_signal01
tst_test.c:1246: INFO: Timeout per run is 0h 05m 00s ../../../../include/lapi/pidfd_send_signal.h:16: CONF: syscall(424) __NR_pidfd_send_signal not supported

Summary:

passed   0
failed   0
skipped  0

warnings 0
----------------------------------------------------

1) Add update_result() in tst_vbrk_() to fix the issue.
2) Remove redundant update_result() in run_tcases_per_fs() after the fix.

---
   lib/tst_test.c | 5 ++---
   1 file changed, 2 insertions(+), 3 deletions(-)
lib/tst_test.c +1 -0
index 0e58060e0..e93c88ba5 100644
@@ -316,6 +316,7 @@ void tst_vbrk_(const char *file, const int lineno, int ttype,
                  const char *fmt, va_list va)
   {
   	print_result(file, lineno, ttype, fmt, va);
+	update_results(TTYPE_RESULT(ttype));
 
   	/*
   	 * The getpid implementation in some C library versions may cause cloned
@@ -1316,10 +1317,8 @@ static int run_tcases_per_fs(void)
   			mntpoint_mounted = 0;

lib/tst_test.c static int run_tcases_per_fs(void) · line 1324

Quoted 10 lines
lib/tst_test.c +1 -3
   		}
 
-		if (ret == TCONF) {
-			update_results(ret);
+		if (ret == TCONF)
   			continue;
-		}
 
   		if (ret == 0)
   			continue;

.