[v3,3/3] lib/tst_test.c: Convert TFAIL to TWARN in test cleanup
diff mbox series

Message ID 1544690160-13900-3-git-send-email-yangx.jy@cn.fujitsu.com
State Accepted
Headers show
Series
  • [v3,1/3] lib: Introduce tst_strttype()
Related show

Commit Message

Xiao Yang Dec. 13, 2018, 8:36 a.m. UTC
1) Both TBROK and TFAIL should be converted to TWARN in test cleanup.
2) Add a hint for the conversion.
2) Update test-writing-guidelines.

Note:
From test-writing-guidelines, Converting TBROK to TWARN seems
intentional design, so i try to convert TFAIL as well.

Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
 doc/test-writing-guidelines.txt | 2 +-
 lib/tst_test.c                  | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

Comments

Cyril Hrubis Jan. 7, 2019, 1:34 p.m. UTC | #1
Hi!
> 1) Both TBROK and TFAIL should be converted to TWARN in test cleanup.

Do we actually produce TFAIL somewhere in the test cleanups?

Actually producing TPASS or TFAIL in test cleanup sounds wrong to me.

> 2) Add a hint for the conversion.

I do not think that this very useful. Jan what do you think?
Jan Stancek Jan. 7, 2019, 2:28 p.m. UTC | #2
----- Original Message -----
> Hi!
> > 1) Both TBROK and TFAIL should be converted to TWARN in test cleanup.
> 
> Do we actually produce TFAIL somewhere in the test cleanups?
> 
> Actually producing TPASS or TFAIL in test cleanup sounds wrong to me.
> 
> > 2) Add a hint for the conversion.
> 
> I do not think that this very useful. Jan what do you think?

I'd rather not add more conversions.

Actually if we introduce results->broken counter as 2/3 is proposing,
then maybe we can drop current conversion too?

Regards,
Jan

Patch
diff mbox series

diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index 4b40760..3e0fa1a 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -393,7 +393,7 @@  IMPORTANT: 'SAFE_MACROS()' used in cleanup *do not* exit the test. Failure
 	   intentional as we want to execute as much 'cleanup()' as possible.
 
 WARNING: Calling tst_brk() in test 'cleanup()' does not exit the test as well
-         and 'TBROK' is converted to 'TWARN'.
+         and 'TBROK/TFAIL' is converted to 'TWARN'.
 
 NOTE: Creation and removal of the test temporary directory is handled in
       the test library and the directory is removed recursively. Therefore
diff --git a/lib/tst_test.c b/lib/tst_test.c
index e46ab8e..c5826d0 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -279,7 +279,9 @@  static void (*tst_brk_handler)(const char *file, const int lineno, int ttype,
 static void tst_cvres(const char *file, const int lineno, int ttype,
 		      const char *fmt, va_list va)
 {
-	if (TTYPE_RESULT(ttype) == TBROK) {
+	if (TTYPE_RESULT(ttype) == TBROK || TTYPE_RESULT(ttype) == TFAIL) {
+		tst_res(TINFO, "Convert ttype %s to TWARN in test cleanup",
+			tst_strttype(ttype));
 		ttype &= ~TTYPE_MASK;
 		ttype |= TWARN;
 	}