Skip to contentSkip to conversation

syslog: Add TPASS log

PATCH In review Ma Feng via ltp 3 participants 4 messages Feb 22, 2022 – Apr 6, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 syslog: Add TPASS log

Add TPASS log to facilitate the analysis of cases.

---
 testcases/kernel/syscalls/syslog/syslog01 | 7 +++++--
 testcases/kernel/syscalls/syslog/syslog03 | 3 +++
 testcases/kernel/syscalls/syslog/syslog04 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog05 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog06 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog07 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog09 | 4 ++++
 testcases/kernel/syscalls/syslog/syslog10 | 6 +++++-
 8 files changed, 33 insertions(+), 7 deletions(-)
testcases/kernel/syscalls/syslog/syslog01 +5 -2
index 2f3aea0bb..f99c44914 100755
@@ -88,8 +88,11 @@ syslog_case1()
 
 		newvalue1=`grep -c "syslogtst: mail info test" $MAILLOG`
 		if [ "x$(( $newvalue1 - $oldvalue1 ))" != "x1" ]; then
-			status_flag=1
-		fi
+                        tst_resm TFAIL "mail info test: messages are not logged to $MAILLOG"
+                        status_flag=1
+                else
+                        tst_resm TPASS "mail info test: messages are logged to $MAILLOG"
+                fi
 	else
 		status_flag=1
 	fi
testcases/kernel/syscalls/syslog/syslog03 +3 -0
index 31b7fd66d..8e8b887eb 100755
@@ -75,7 +75,10 @@ syslog_case3()
 
 	newvalue4=`grep -c "SYSLOG_CASE3" /var/log/messages`
 	if [ "x$(( $newvalue4 - $oldvalue4 ))" != x1 ]; then
+        tst_resm TFAIL "dameon info test: ident string is not prepended to the message"
 		status_flag=1
+        else
+                tst_resm TPASS "dameon info test: ident string is prepended to the message"
 	fi
 }
 
testcases/kernel/syscalls/syslog/syslog04 +4 -1
index d1739d32a..a551ea003 100755
@@ -71,7 +71,10 @@ syslog_case4()
 
 	found=`grep -c "\[$log_pid\]: syslogtst: user info test." /var/log/messages`
 	if [ $found -ne 1 ]; then
-		status_flag=1
+		tst_resm TFAIL "user info test: pid is not logged with /var/log/messages"
+                status_flag=1
+        else
+                tst_resm TPASS "user info test: pid is logged with /var/log/messages"
 	fi
 }
 
testcases/kernel/syscalls/syslog/syslog05 +4 -1
index 40dd1fa1a..2350765a7 100755
@@ -80,7 +80,10 @@ syslog_case5()
 	newvalue=`grep -c "syslogtst: info to console test." /var/log/messages`
 
 	if [ "x$(( $newvalue - $oldvalue ))" != "x1" ]; then
-		status_flag=1
+		tst_resm TFAIL "info to console test: syslog is not written to the console"
+                status_flag=1
+        else
+                tst_resm TPASS "info to console test: syslog is written to the console"
 	fi
 }
 
testcases/kernel/syscalls/syslog/syslog06 +4 -1
index 7050fd264..bcdda4737 100755
@@ -59,7 +59,10 @@ syslog_case6()
 	restart_syslog_daemon
 
 	if ! syslogtst 6 2>/dev/null; then
-		status_flag=1
+		tst_resm TFAIL "openlog fd test: open has returned unexpected fd"
+                status_flag=1
+        else
+                tst_resm TPASS "openlog fd test: open has returned expected fd"
 	fi
 }
 
testcases/kernel/syscalls/syslog/syslog07 +4 -1
index a24c3e207..cc5f9cdf8 100755
@@ -119,7 +119,10 @@ syslog_case7()
 	if [ $emerg -ne 1 -o $alert -ne 1 -o $crit -ne 1 -o $err -ne 1 -o \
 	     $warning -ne 1 -o $notice -ne 1 -o $info -ne 1 -o \
 	     $info -ne 1 ]; then
-		status_flag=1
+		tst_resm TFAIL "syslogtst: not all level logs logged"
+                status_flag=1
+        else
+                tst_resm TPASS "syslogtst: all level logs logged"
 	fi
 }
 
testcases/kernel/syscalls/syslog/syslog09 +4 -0
index 9cfafa840..2a67faaa4 100755
@@ -83,12 +83,16 @@ syslog_case9()
 		tst_resm TFAIL "Expected message was not logged...."
 		status_flag=1
 		return
+        else
+                tst_resm TPASS "Expected message was logged..."
 	fi
 
 	diff2=$(( $donot_allow2 - $donot_allow1 ))
 	if [ $diff2 -ne 0 ]; then
 		tst_resm TFAIL "Unexpected message was logged..."
 		status_flag=1
+        else
+                tst_resm TPASS "Unexpected message was not logged..."
 	fi
 }
 
testcases/kernel/syscalls/syslog/syslog10 +5 -1
index 573ab755e..97f7c54cc 100755
@@ -85,12 +85,16 @@ syslog_case10()
 		tst_resm TFAIL "Expected message was not logged...."
 		status_flag=1
 		return
-	fi
+        else
+                tst_resm TPASS "Expected message was logged..."
+        fi
 
 	diff2=$(( $donot_allow2 - $donot_allow1 ))
 	if [ $diff2 -ne 0 ]; then
 		tst_resm TFAIL "Unexpected message was logged..."
 		status_flag=1
+        else
+                tst_resm TPASS "Unexpected message was not logged..."
 	fi
 
 }
Signature · 5 lines
2.22.0


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
Reviewed-by on v1 1/1
#1 lore raw

Hi Ma, Li, Cyril,

Quoted 1 line

Add TPASS log to facilitate the analysis of cases.

nit: in some tests you added both TPASS/TFAIL.

Quoted 17 lines
---
 testcases/kernel/syscalls/syslog/syslog01 | 7 +++++--
 testcases/kernel/syscalls/syslog/syslog03 | 3 +++
 testcases/kernel/syscalls/syslog/syslog04 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog05 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog06 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog07 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog09 | 4 ++++
 testcases/kernel/syscalls/syslog/syslog10 | 6 +++++-
 8 files changed, 33 insertions(+), 7 deletions(-)
testcases/kernel/syscalls/syslog/syslog01 +0 -0
index 2f3aea0bb..f99c44914 100755

testcases/kernel/syscalls/syslog/syslog01 syslog_case1() · line 95

Quoted 10 lines
testcases/kernel/syscalls/syslog/syslog01 +5 -2
@@ -88,8 +88,11 @@ syslog_case1()
 
 		newvalue1=`grep -c "syslogtst: mail info test" $MAILLOG`
 		if [ "x$(( $newvalue1 - $oldvalue1 ))" != "x1" ]; then
-			status_flag=1
-		fi
+                        tst_resm TFAIL "mail info test: messages are not logged to $MAILLOG"
+                        status_flag=1
+                else
+                        tst_resm TPASS "mail info test: messages are logged to $MAILLOG"
+                fi

I'm going to merge this fix, thus I'll fix wrong indentation myself before merge (it's in more tests). But please next time pay attention to the whitespace.

...

testcases/kernel/syscalls/syslog/syslog10 syslog_case10() · line 90

Quoted 11 lines

index 573ab755e..97f7c54cc 100755

testcases/kernel/syscalls/syslog/syslog10 +3 -1
@@ -85,12 +85,16 @@ syslog_case10()
 		tst_resm TFAIL "Expected message was not logged...."
 		status_flag=1
 		return
-	fi
+        else
+                tst_resm TPASS "Expected message was logged..."
+        fi

Here I'm going to remove useless '...' in newly added TPASS and the original TFAIL (and in other tests).

@Cyril, Li: do we want to still keep syslog0[1-9] and syslog10 which tests syslogd? I suppose so, but I'm asking because they are not using even legacy shell API (test.sh) and use several other legacy libraries (syslog-lib.sh, cmdlib.sh, daemonlib.sh).

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw
Quoted 54 lines · Petr Vorel

Hi Ma, Li, Cyril,

Quoted 1 line

Add TPASS log to facilitate the analysis of cases.

nit: in some tests you added both TPASS/TFAIL.

Quoted 17 lines
---
 testcases/kernel/syscalls/syslog/syslog01 | 7 +++++--
 testcases/kernel/syscalls/syslog/syslog03 | 3 +++
 testcases/kernel/syscalls/syslog/syslog04 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog05 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog06 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog07 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog09 | 4 ++++
 testcases/kernel/syscalls/syslog/syslog10 | 6 +++++-
 8 files changed, 33 insertions(+), 7 deletions(-)
testcases/kernel/syscalls/syslog/syslog01 +0 -0
index 2f3aea0bb..f99c44914 100755

testcases/kernel/syscalls/syslog/syslog01 syslog_case1() · line 95

Quoted 10 lines
testcases/kernel/syscalls/syslog/syslog01 +5 -2
@@ -88,8 +88,11 @@ syslog_case1()
 
              newvalue1=`grep -c "syslogtst: mail info test" $MAILLOG`
              if [ "x$(( $newvalue1 - $oldvalue1 ))" != "x1" ]; then
-                     status_flag=1
-             fi
+                        tst_resm TFAIL "mail info test: messages are not logged to $MAILLOG"
+                        status_flag=1
+                else
+                        tst_resm TPASS "mail info test: messages are logged to $MAILLOG"
+                fi

I'm going to merge this fix, thus I'll fix wrong indentation myself before merge (it's in more tests). But please next time pay attention to the whitespace.

...

testcases/kernel/syscalls/syslog/syslog10 syslog_case10() · line 90

Quoted 11 lines

index 573ab755e..97f7c54cc 100755

testcases/kernel/syscalls/syslog/syslog10 +3 -1
@@ -85,12 +85,16 @@ syslog_case10()
              tst_resm TFAIL "Expected message was not logged...."
              status_flag=1
              return
-     fi
+        else
+                tst_resm TPASS "Expected message was logged..."
+        fi

Here I'm going to remove useless '...' in newly added TPASS and the original TFAIL (and in other tests).

Quoted 5 lines

@Cyril, Li: do we want to still keep syslog0[1-9] and syslog10 which tests syslogd? I suppose so, but I'm asking because they are not using even legacy shell API (test.sh) and use several other legacy libraries (syslog-lib.sh, cmdlib.sh, daemonlib.sh).

I wouldn't miss these tests, they always had sporadic failures that were related to
configuration (rsyslog config, journald rate-limiting, etc.) and lot of sleep to restart
daemon dozens of times. One sanity test calling syslog() would probably do.

We already cover kernel functionality with kmsg01 and on recent distros syslog() (or write to /dev/log) is write to /run/systemd/journal/dev-log anyway.

Quoted 7 lines

Kind regards,
Petr

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#3 lore raw

Hi Jan,

Quoted 61 lines · Petr Vorel
Quoted 54 lines

Hi Ma, Li, Cyril,

Quoted 1 line

Add TPASS log to facilitate the analysis of cases.

nit: in some tests you added both TPASS/TFAIL.

Quoted 17 lines
---
 testcases/kernel/syscalls/syslog/syslog01 | 7 +++++--
 testcases/kernel/syscalls/syslog/syslog03 | 3 +++
 testcases/kernel/syscalls/syslog/syslog04 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog05 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog06 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog07 | 5 ++++-
 testcases/kernel/syscalls/syslog/syslog09 | 4 ++++
 testcases/kernel/syscalls/syslog/syslog10 | 6 +++++-
 8 files changed, 33 insertions(+), 7 deletions(-)
testcases/kernel/syscalls/syslog/syslog01 +0 -0
index 2f3aea0bb..f99c44914 100755

testcases/kernel/syscalls/syslog/syslog01 syslog_case1() · line 95

Quoted 10 lines
testcases/kernel/syscalls/syslog/syslog01 +5 -2
@@ -88,8 +88,11 @@ syslog_case1()
 
              newvalue1=`grep -c "syslogtst: mail info test" $MAILLOG`
              if [ "x$(( $newvalue1 - $oldvalue1 ))" != "x1" ]; then
-                     status_flag=1
-             fi
+                        tst_resm TFAIL "mail info test: messages are not logged to $MAILLOG"
+                        status_flag=1
+                else
+                        tst_resm TPASS "mail info test: messages are logged to $MAILLOG"
+                fi

I'm going to merge this fix, thus I'll fix wrong indentation myself before merge (it's in more tests). But please next time pay attention to the whitespace.

...

testcases/kernel/syscalls/syslog/syslog10 syslog_case10() · line 90

Quoted 11 lines

index 573ab755e..97f7c54cc 100755

testcases/kernel/syscalls/syslog/syslog10 +3 -1
@@ -85,12 +85,16 @@ syslog_case10()
              tst_resm TFAIL "Expected message was not logged...."
              status_flag=1
              return
-     fi
+        else
+                tst_resm TPASS "Expected message was logged..."
+        fi

Here I'm going to remove useless '...' in newly added TPASS and the original TFAIL (and in other tests).

Quoted 5 lines

@Cyril, Li: do we want to still keep syslog0[1-9] and syslog10 which tests syslogd? I suppose so, but I'm asking because they are not using even legacy shell API (test.sh) and use several other legacy libraries (syslog-lib.sh, cmdlib.sh, daemonlib.sh).

Quoted 8 lines

I wouldn't miss these tests, they always had sporadic failures that were related to
configuration (rsyslog config, journald rate-limiting, etc.) and lot of sleep to restart
daemon dozens of times. One sanity test calling syslog() would probably do.

We already cover kernel functionality with kmsg01 and on recent distros syslog() (or write to /dev/log) is write to /run/systemd/journal/dev-log anyway.

Thanks for confirmation. I'd keep syslog11.c and syslog12.c, which test syslog (syscall - __NR_syslog; IMHO there is no test for (g)libc/POSIX syslog()) and delete all shell tests.

Kind regards,
Petr

Quoted 5 lines
Quoted 5 lines

Kind regards,
Petr

--
Mailing list info: https://lists.linux.it/listinfo/ltp

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp