* [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests
@ 2015-03-22 23:05 Sami Kerola
2015-03-22 23:05 ` [PATCH 1/5] dmesg: fix shadow declaration Sami Kerola
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Sami Kerola @ 2015-03-22 23:05 UTC (permalink / raw)
To: util-linux; +Cc: Sami Kerola
Hello,
I noticed a variable shadowing warning, that lead to paying again
attention to dmesg. While recent logger lessons are still fresh in mind
the obvious thing to do with the dmesg was to add more tests, and that's
what this pull is about.
----------------------------------------------------------------
The following changes since commit bb3df8218b4f8f145e345ab59828a9b3d6d70c4b:
tests: some more mount error handling (2015-03-19 17:12:15 +0100)
are available in the git repository at:
git://github.com/kerolasa/lelux-utiliteetit.git test_dmesg
for you to fetch changes up to 29c7d18d92b393c0f87be09bdfee03c93a09e61b:
tests: check dmesg message coloring (2015-03-22 22:56:27 +0000)
----------------------------------------------------------------
Sami Kerola (5):
dmesg: fix shadow declaration
tests: add dmesg multiline message check
tests: add test_dmesg that has fixed boot time
tests: check timestamp formats
tests: check dmesg message coloring
sys-utils/Makemodule.am | 4 ++
sys-utils/dmesg.c | 16 +++---
tests/commands.sh | 2 +-
tests/expected/dmesg/colors | 105 +++++++++++++++++++++++++++++++++++++++
tests/expected/dmesg/indentation | 35 +++++++++++++
tests/ts/dmesg/colors | 25 ++++++++++
tests/ts/dmesg/console-levels | 4 +-
tests/ts/dmesg/decode | 4 +-
tests/ts/dmesg/delta | 4 +-
tests/ts/dmesg/facilities | 4 +-
tests/ts/dmesg/indentation | 37 ++++++++++++++
tests/ts/dmesg/newlines | 5 ++
12 files changed, 228 insertions(+), 17 deletions(-)
create mode 100644 tests/expected/dmesg/colors
create mode 100644 tests/expected/dmesg/indentation
create mode 100755 tests/ts/dmesg/colors
create mode 100755 tests/ts/dmesg/indentation
create mode 100644 tests/ts/dmesg/newlines
--
2.3.3
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/5] dmesg: fix shadow declaration
2015-03-22 23:05 [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Sami Kerola
@ 2015-03-22 23:05 ` Sami Kerola
2015-03-22 23:05 ` [PATCH 2/5] tests: add dmesg multiline message check Sami Kerola
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Sami Kerola @ 2015-03-22 23:05 UTC (permalink / raw)
To: util-linux; +Cc: Sami Kerola
sys-utils/dmesg.c:650:9: warning: declaration of 's' shadows a previous local [-Wshadow]
sys-utils/dmesg.c:619:12: warning: shadowed declaration is here [-Wshadow]
And since the code had to be touched deprecate loop printing one character
at a time, in favour of printf and instruction to repeat spaces the number
required.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/dmesg.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index 5a6ee41..b56199f 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -614,7 +614,6 @@ static int fwrite_hex(const char *buf, size_t size, FILE *out)
static void safe_fwrite(const char *buf, size_t size, int indent, FILE *out)
{
size_t i;
- int in;
#ifdef HAVE_WIDECHAR
mbstate_t s;
memset(&s, 0, sizeof (s));
@@ -647,13 +646,9 @@ static void safe_fwrite(const char *buf, size_t size, int indent, FILE *out)
if (hex)
rc = fwrite_hex(p, len, out);
else if (*p == '\n' && *(p + 1) && indent) {
- char s = ' ';
- rc = fwrite(p, 1, len, out) != len;
- in = indent;
- do {
- if (!rc) rc = fwrite(&s, 1, 1, out) != 1;
- in--;
- } while (in && !rc);
+ rc = fwrite(p, 1, len, out) != len;
+ if (fprintf(out, "%*s", indent, "") != indent)
+ rc |= 1;
}
else
rc = fwrite(p, 1, len, out) != len;
--
2.3.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/5] tests: add dmesg multiline message check
2015-03-22 23:05 [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Sami Kerola
2015-03-22 23:05 ` [PATCH 1/5] dmesg: fix shadow declaration Sami Kerola
@ 2015-03-22 23:05 ` Sami Kerola
2015-03-22 23:05 ` [PATCH 3/5] tests: add test_dmesg that has fixed boot time Sami Kerola
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Sami Kerola @ 2015-03-22 23:05 UTC (permalink / raw)
To: util-linux; +Cc: Sami Kerola
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
tests/expected/dmesg/indentation | 20 ++++++++++++++++++++
tests/ts/dmesg/indentation | 31 +++++++++++++++++++++++++++++++
tests/ts/dmesg/newlines | 5 +++++
3 files changed, 56 insertions(+)
create mode 100644 tests/expected/dmesg/indentation
create mode 100755 tests/ts/dmesg/indentation
create mode 100644 tests/ts/dmesg/newlines
diff --git a/tests/expected/dmesg/indentation b/tests/expected/dmesg/indentation
new file mode 100644
index 0000000..e32d87f
--- /dev/null
+++ b/tests/expected/dmesg/indentation
@@ -0,0 +1,20 @@
+[ 1.000000] new
+ line
+[ 2.000000] two
+ new
+ lines
+user :crit : [ 1.000000] new
+ line
+mail :warn : [ 2.000000] two
+ new
+ lines
+[< 0.000000>] new
+ line
+[< 1.000000>] two
+ new
+ lines
+new
+line
+two
+new
+lines
diff --git a/tests/ts/dmesg/indentation b/tests/ts/dmesg/indentation
new file mode 100755
index 0000000..7419888
--- /dev/null
+++ b/tests/ts/dmesg/indentation
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="indentation"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_CMD_DMESG"
+
+$TS_CMD_DMESG -F $TS_SELF/newlines > $TS_OUTPUT 2>&1
+
+$TS_CMD_DMESG -F $TS_SELF/newlines -x >> $TS_OUTPUT 2>&1
+
+$TS_CMD_DMESG --time-format=delta --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
+
+$TS_CMD_DMESG --time-format=notime --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
+
+ts_finalize
diff --git a/tests/ts/dmesg/newlines b/tests/ts/dmesg/newlines
new file mode 100644
index 0000000..6b298c6
--- /dev/null
+++ b/tests/ts/dmesg/newlines
@@ -0,0 +1,5 @@
+<10>[ 1.000000] new
+line
+<20>[ 2.000000] two
+new
+lines
--
2.3.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/5] tests: add test_dmesg that has fixed boot time
2015-03-22 23:05 [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Sami Kerola
2015-03-22 23:05 ` [PATCH 1/5] dmesg: fix shadow declaration Sami Kerola
2015-03-22 23:05 ` [PATCH 2/5] tests: add dmesg multiline message check Sami Kerola
@ 2015-03-22 23:05 ` Sami Kerola
2015-03-22 23:05 ` [PATCH 4/5] tests: check timestamp formats Sami Kerola
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Sami Kerola @ 2015-03-22 23:05 UTC (permalink / raw)
To: util-linux; +Cc: Sami Kerola
This allows testing time stamp formats.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
sys-utils/Makemodule.am | 4 ++++
sys-utils/dmesg.c | 5 +++++
tests/commands.sh | 2 +-
tests/ts/dmesg/console-levels | 4 ++--
tests/ts/dmesg/decode | 4 ++--
tests/ts/dmesg/delta | 4 ++--
tests/ts/dmesg/facilities | 4 ++--
tests/ts/dmesg/indentation | 10 +++++-----
8 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am
index c1d587a..3177e7c 100644
--- a/sys-utils/Makemodule.am
+++ b/sys-utils/Makemodule.am
@@ -75,6 +75,10 @@ dist_man_MANS += sys-utils/dmesg.1
dmesg_SOURCES = sys-utils/dmesg.c lib/monotonic.c
dmesg_LDADD = $(LDADD) libcommon.la libtcolors.la $(REALTIME_LIBS)
dmesg_CFLAGS = $(AM_CFLAGS)
+check_PROGRAMS += test_dmesg
+test_dmesg_SOURCES = $(dmesg_SOURCES)
+test_dmesg_LDADD = $(dmesg_LDADD)
+test_dmesg_CFLAGS = -DTEST_DMESG $(dmesg_CFLAGS)
endif
if BUILD_CTRLALTDEL
diff --git a/sys-utils/dmesg.c b/sys-utils/dmesg.c
index b56199f..a17cc70 100644
--- a/sys-utils/dmesg.c
+++ b/sys-utils/dmesg.c
@@ -1378,8 +1378,13 @@ int main(int argc, char *argv[])
is_timefmt(&ctl, CTIME) ||
is_timefmt(&ctl, ISO8601)) {
+#ifdef TEST_DMESG
+ ctl.boot_time.tv_sec = 1234567890;
+ ctl.boot_time.tv_usec = 123456;
+#else
if (get_boot_time(&ctl.boot_time) != 0)
ctl.time_fmt = DMESG_TIMEFTM_NONE;
+#endif
}
if (delta)
diff --git a/tests/commands.sh b/tests/commands.sh
index 420feb9..e3ac433 100644
--- a/tests/commands.sh
+++ b/tests/commands.sh
@@ -4,6 +4,7 @@ TS_TESTUSER=${TS_TESTUSER:-"nobody"}
# helpers
TS_HELPER_BYTESWAP="$top_builddir/test_byteswap"
TS_HELPER_CPUSET="$top_builddir/test_cpuset"
+TS_HELPER_DMESG="$top_builddir/test_dmesg"
TS_HELPER_ISLOCAL="$top_builddir/test_islocal"
TS_HELPER_ISMOUNTED="$top_builddir/test_ismounted"
TS_HELPER_LIBMOUNT_CONTEXT="$top_builddir/test_mount_context"
@@ -36,7 +37,6 @@ TS_CMD_CAL=${TS_CMD_CAL-"$top_builddir/cal"}
TS_CMD_COLRM=${TS_CMD_COLRM:-"$top_builddir/colrm"}
TS_CMD_COL=${TS_CMD_COL:-"$top_builddir/col"}
TS_CMD_COLUMN=${TS_CMD_COLUMN:-"$top_builddir/column"}
-TS_CMD_DMESG=${TS_CMD_DMESG-"$top_builddir/dmesg"}
TS_CMD_EJECT=${TS_CMD_EJECT-"$top_builddir/eject"}
TS_CMD_FALLOCATE=${TS_CMD_FALLOCATE-"$top_builddir/fallocate"}
TS_CMD_FDISK=${TS_CMD_FDISK-"$top_builddir/fdisk"}
diff --git a/tests/ts/dmesg/console-levels b/tests/ts/dmesg/console-levels
index 14c69c9..9abd5b2 100755
--- a/tests/ts/dmesg/console-levels
+++ b/tests/ts/dmesg/console-levels
@@ -18,10 +18,10 @@ TS_DESC="levels"
. $TS_TOPDIR/functions.sh
ts_init "$*"
-ts_check_test_command "$TS_CMD_DMESG"
+ts_check_test_command "$TS_HELPER_DMESG"
for I in {-1..8}; do
- $TS_CMD_DMESG -F $TS_SELF/input -l $I >> $TS_OUTPUT 2>/dev/null
+ $TS_HELPER_DMESG -F $TS_SELF/input -l $I >> $TS_OUTPUT 2>/dev/null
done
ts_finalize
diff --git a/tests/ts/dmesg/decode b/tests/ts/dmesg/decode
index 63f3c5c..4725208 100755
--- a/tests/ts/dmesg/decode
+++ b/tests/ts/dmesg/decode
@@ -18,8 +18,8 @@ TS_DESC="decode"
. $TS_TOPDIR/functions.sh
ts_init "$*"
-ts_check_test_command "$TS_CMD_DMESG"
+ts_check_test_command "$TS_HELPER_DMESG"
-$TS_CMD_DMESG -x -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -x -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null
ts_finalize
diff --git a/tests/ts/dmesg/delta b/tests/ts/dmesg/delta
index da48042..4b55bf6 100755
--- a/tests/ts/dmesg/delta
+++ b/tests/ts/dmesg/delta
@@ -18,8 +18,8 @@ TS_DESC="delta"
. $TS_TOPDIR/functions.sh
ts_init "$*"
-ts_check_test_command "$TS_CMD_DMESG"
+ts_check_test_command "$TS_HELPER_DMESG"
-$TS_CMD_DMESG -d -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null
+$TS_HELPER_DMESG -d -F $TS_SELF/input >> $TS_OUTPUT 2>/dev/null
ts_finalize
diff --git a/tests/ts/dmesg/facilities b/tests/ts/dmesg/facilities
index 7066ae5..bc44c25 100755
--- a/tests/ts/dmesg/facilities
+++ b/tests/ts/dmesg/facilities
@@ -18,10 +18,10 @@ TS_DESC="facilities"
. $TS_TOPDIR/functions.sh
ts_init "$*"
-ts_check_test_command "$TS_CMD_DMESG"
+ts_check_test_command "$TS_HELPER_DMESG"
for I in {-1..12}; do
- $TS_CMD_DMESG -F $TS_SELF/input -f $I >> $TS_OUTPUT 2>/dev/null
+ $TS_HELPER_DMESG -F $TS_SELF/input -f $I >> $TS_OUTPUT 2>/dev/null
done
ts_finalize
diff --git a/tests/ts/dmesg/indentation b/tests/ts/dmesg/indentation
index 7419888..624dd9b 100755
--- a/tests/ts/dmesg/indentation
+++ b/tests/ts/dmesg/indentation
@@ -18,14 +18,14 @@ TS_DESC="indentation"
. $TS_TOPDIR/functions.sh
ts_init "$*"
-ts_check_test_command "$TS_CMD_DMESG"
+ts_check_test_command "$TS_HELPER_DMESG"
-$TS_CMD_DMESG -F $TS_SELF/newlines > $TS_OUTPUT 2>&1
+$TS_HELPER_DMESG -F $TS_SELF/newlines > $TS_OUTPUT 2>&1
-$TS_CMD_DMESG -F $TS_SELF/newlines -x >> $TS_OUTPUT 2>&1
+$TS_HELPER_DMESG -F $TS_SELF/newlines -x >> $TS_OUTPUT 2>&1
-$TS_CMD_DMESG --time-format=delta --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
+$TS_HELPER_DMESG --time-format=delta --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
-$TS_CMD_DMESG --time-format=notime --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
+$TS_HELPER_DMESG --time-format=notime --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
ts_finalize
--
2.3.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/5] tests: check timestamp formats
2015-03-22 23:05 [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Sami Kerola
` (2 preceding siblings ...)
2015-03-22 23:05 ` [PATCH 3/5] tests: add test_dmesg that has fixed boot time Sami Kerola
@ 2015-03-22 23:05 ` Sami Kerola
2015-03-22 23:05 ` [PATCH 5/5] tests: check dmesg message coloring Sami Kerola
2015-03-23 10:44 ` [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Karel Zak
5 siblings, 0 replies; 7+ messages in thread
From: Sami Kerola @ 2015-03-22 23:05 UTC (permalink / raw)
To: util-linux; +Cc: Sami Kerola
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
tests/expected/dmesg/indentation | 15 +++++++++++++++
tests/ts/dmesg/indentation | 6 ++++++
2 files changed, 21 insertions(+)
diff --git a/tests/expected/dmesg/indentation b/tests/expected/dmesg/indentation
index e32d87f..0d0b6e4 100644
--- a/tests/expected/dmesg/indentation
+++ b/tests/expected/dmesg/indentation
@@ -18,3 +18,18 @@ line
two
new
lines
+[Feb13 23:31] new
+ line
+[ +1.000000] two
+ new
+ lines
+[Fri Feb 13 23:31:31 2009] new
+ line
+[Fri Feb 13 23:31:32 2009] two
+ new
+ lines
+2009-02-13T23:31:31,000000+0000 new
+ line
+2009-02-13T23:31:32,000000+0000 two
+ new
+ lines
diff --git a/tests/ts/dmesg/indentation b/tests/ts/dmesg/indentation
index 624dd9b..11a9e56 100755
--- a/tests/ts/dmesg/indentation
+++ b/tests/ts/dmesg/indentation
@@ -28,4 +28,10 @@ $TS_HELPER_DMESG --time-format=delta --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
$TS_HELPER_DMESG --time-format=notime --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
+$TS_HELPER_DMESG --time-format=reltime --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
+
+$TS_HELPER_DMESG --time-format=ctime --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
+
+$TS_HELPER_DMESG --time-format=iso --file $TS_SELF/newlines >> $TS_OUTPUT 2>&1
+
ts_finalize
--
2.3.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 5/5] tests: check dmesg message coloring
2015-03-22 23:05 [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Sami Kerola
` (3 preceding siblings ...)
2015-03-22 23:05 ` [PATCH 4/5] tests: check timestamp formats Sami Kerola
@ 2015-03-22 23:05 ` Sami Kerola
2015-03-23 10:44 ` [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Karel Zak
5 siblings, 0 replies; 7+ messages in thread
From: Sami Kerola @ 2015-03-22 23:05 UTC (permalink / raw)
To: util-linux; +Cc: Sami Kerola
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
tests/expected/dmesg/colors | 105 ++++++++++++++++++++++++++++++++++++++++++++
tests/ts/dmesg/colors | 25 +++++++++++
2 files changed, 130 insertions(+)
create mode 100644 tests/expected/dmesg/colors
create mode 100755 tests/ts/dmesg/colors
diff --git a/tests/expected/dmesg/colors b/tests/expected/dmesg/colors
new file mode 100644
index 0000000..40aca73
--- /dev/null
+++ b/tests/expected/dmesg/colors
@@ -0,0 +1,105 @@
+kern :emerg : ^[[32m[ 0.000000] ^[[0mexample[0]
+kern :alert : ^[[32m[ 1.000000] ^[[0m^[[7m^[[31mexample[1]^[[0m
+kern :crit : ^[[32m[ 8.000000] ^[[0m^[[1m^[[31mexample[2]^[[0m
+kern :err : ^[[32m[ 27.000000] ^[[0m^[[31mexample[3]^[[0m
+kern :warn : ^[[32m[ 64.000000] ^[[0m^[[1mexample[4]^[[0m
+kern :notice: ^[[32m[ 125.000000] ^[[0mexample[5]
+kern :info : ^[[32m[ 216.000000] ^[[0mexample[6]
+kern :debug : ^[[32m[ 343.000000] ^[[0mexample[7]
+user :emerg : ^[[32m[ 512.000000] ^[[0mexample[8]
+user :alert : ^[[32m[ 729.000000] ^[[0m^[[7m^[[31mexample[9]^[[0m
+user :crit : ^[[32m[ 1000.000000] ^[[0m^[[1m^[[31mexample[10]^[[0m
+user :err : ^[[32m[ 1331.000000] ^[[0m^[[31mexample[11]^[[0m
+user :warn : ^[[32m[ 1728.000000] ^[[0m^[[1mexample[12]^[[0m
+user :notice: ^[[32m[ 2197.000000] ^[[0mexample[13]
+user :info : ^[[32m[ 2744.000000] ^[[0mexample[14]
+user :debug : ^[[32m[ 3375.000000] ^[[0mexample[15]
+mail :emerg : ^[[32m[ 4096.000000] ^[[0mexample[16]
+mail :alert : ^[[32m[ 4913.000000] ^[[0m^[[7m^[[31mexample[17]^[[0m
+mail :crit : ^[[32m[ 5832.000000] ^[[0m^[[1m^[[31mexample[18]^[[0m
+mail :err : ^[[32m[ 6859.000000] ^[[0m^[[31mexample[19]^[[0m
+mail :warn : ^[[32m[ 8000.000000] ^[[0m^[[1mexample[20]^[[0m
+mail :notice: ^[[32m[ 9261.000000] ^[[0mexample[21]
+mail :info : ^[[32m[10648.000000] ^[[0mexample[22]
+mail :debug : ^[[32m[12167.000000] ^[[0mexample[23]
+daemon:emerg : ^[[32m[13824.000000] ^[[0mexample[24]
+daemon:alert : ^[[32m[15625.000000] ^[[0m^[[7m^[[31mexample[25]^[[0m
+daemon:crit : ^[[32m[17576.000000] ^[[0m^[[1m^[[31mexample[26]^[[0m
+daemon:err : ^[[32m[19683.000000] ^[[0m^[[31mexample[27]^[[0m
+daemon:warn : ^[[32m[21952.000000] ^[[0m^[[1mexample[28]^[[0m
+daemon:notice: ^[[32m[24389.000000] ^[[0mexample[29]
+daemon:info : ^[[32m[27000.000000] ^[[0mexample[30]
+daemon:debug : ^[[32m[29791.000000] ^[[0mexample[31]
+auth :emerg : ^[[32m[32768.000000] ^[[0mexample[32]
+auth :alert : ^[[32m[35937.000000] ^[[0m^[[7m^[[31mexample[33]^[[0m
+auth :crit : ^[[32m[39304.000000] ^[[0m^[[1m^[[31mexample[34]^[[0m
+auth :err : ^[[32m[42875.000000] ^[[0m^[[31mexample[35]^[[0m
+auth :warn : ^[[32m[46656.000000] ^[[0m^[[1mexample[36]^[[0m
+auth :notice: ^[[32m[50653.000000] ^[[0mexample[37]
+auth :info : ^[[32m[54872.000000] ^[[0mexample[38]
+auth :debug : ^[[32m[59319.000000] ^[[0mexample[39]
+syslog:emerg : ^[[32m[64000.000000] ^[[0mexample[40]
+syslog:alert : ^[[32m[68921.000000] ^[[0m^[[7m^[[31mexample[41]^[[0m
+syslog:crit : ^[[32m[74088.000000] ^[[0m^[[1m^[[31mexample[42]^[[0m
+syslog:err : ^[[32m[79507.000000] ^[[0m^[[31mexample[43]^[[0m
+syslog:warn : ^[[32m[85184.000000] ^[[0m^[[1mexample[44]^[[0m
+syslog:notice: ^[[32m[91125.000000] ^[[0mexample[45]
+syslog:info : ^[[32m[97336.000000] ^[[0mexample[46]
+syslog:debug : ^[[32m[103823.000000] ^[[0mexample[47]
+lpr :emerg : ^[[32m[110592.000000] ^[[0mexample[48]
+lpr :alert : ^[[32m[117649.000000] ^[[0m^[[7m^[[31mexample[49]^[[0m
+lpr :crit : ^[[32m[125000.000000] ^[[0m^[[1m^[[31mexample[50]^[[0m
+lpr :err : ^[[32m[132651.000000] ^[[0m^[[31mexample[51]^[[0m
+lpr :warn : ^[[32m[140608.000000] ^[[0m^[[1mexample[52]^[[0m
+lpr :notice: ^[[32m[148877.000000] ^[[0mexample[53]
+lpr :info : ^[[32m[157464.000000] ^[[0mexample[54]
+lpr :debug : ^[[32m[166375.000000] ^[[0mexample[55]
+news :emerg : ^[[32m[175616.000000] ^[[0mexample[56]
+news :alert : ^[[32m[185193.000000] ^[[0m^[[7m^[[31mexample[57]^[[0m
+news :crit : ^[[32m[195112.000000] ^[[0m^[[1m^[[31mexample[58]^[[0m
+news :err : ^[[32m[205379.000000] ^[[0m^[[31mexample[59]^[[0m
+news :warn : ^[[32m[216000.000000] ^[[0m^[[1mexample[60]^[[0m
+news :notice: ^[[32m[226981.000000] ^[[0mexample[61]
+news :info : ^[[32m[238328.000000] ^[[0mexample[62]
+news :debug : ^[[32m[250047.000000] ^[[0mexample[63]
+uucp :emerg : ^[[32m[262144.000000] ^[[0mexample[64]
+uucp :alert : ^[[32m[274625.000000] ^[[0m^[[7m^[[31mexample[65]^[[0m
+uucp :crit : ^[[32m[287496.000000] ^[[0m^[[1m^[[31mexample[66]^[[0m
+uucp :err : ^[[32m[300763.000000] ^[[0m^[[31mexample[67]^[[0m
+uucp :warn : ^[[32m[314432.000000] ^[[0m^[[1mexample[68]^[[0m
+uucp :notice: ^[[32m[328509.000000] ^[[0mexample[69]
+uucp :info : ^[[32m[343000.000000] ^[[0mexample[70]
+uucp :debug : ^[[32m[357911.000000] ^[[0mexample[71]
+cron :emerg : ^[[32m[373248.000000] ^[[0mexample[72]
+cron :alert : ^[[32m[389017.000000] ^[[0m^[[7m^[[31mexample[73]^[[0m
+cron :crit : ^[[32m[405224.000000] ^[[0m^[[1m^[[31mexample[74]^[[0m
+cron :err : ^[[32m[421875.000000] ^[[0m^[[31mexample[75]^[[0m
+cron :warn : ^[[32m[438976.000000] ^[[0m^[[1mexample[76]^[[0m
+cron :notice: ^[[32m[456533.000000] ^[[0mexample[77]
+cron :info : ^[[32m[474552.000000] ^[[0mexample[78]
+cron :debug : ^[[32m[493039.000000] ^[[0mexample[79]
+authpriv:emerg : ^[[32m[512000.000000] ^[[0mexample[80]
+authpriv:alert : ^[[32m[531441.000000] ^[[0m^[[7m^[[31mexample[81]^[[0m
+authpriv:crit : ^[[32m[551368.000000] ^[[0m^[[1m^[[31mexample[82]^[[0m
+authpriv:err : ^[[32m[571787.000000] ^[[0m^[[31mexample[83]^[[0m
+authpriv:warn : ^[[32m[592704.000000] ^[[0m^[[1mexample[84]^[[0m
+authpriv:notice: ^[[32m[614125.000000] ^[[0mexample[85]
+authpriv:info : ^[[32m[636056.000000] ^[[0mexample[86]
+authpriv:debug : ^[[32m[658503.000000] ^[[0mexample[87]
+ftp :emerg : ^[[32m[681472.000000] ^[[0mexample[88]
+ftp :alert : ^[[32m[704969.000000] ^[[0m^[[7m^[[31mexample[89]^[[0m
+ftp :crit : ^[[32m[729000.000000] ^[[0m^[[1m^[[31mexample[90]^[[0m
+ftp :err : ^[[32m[753571.000000] ^[[0m^[[31mexample[91]^[[0m
+ftp :warn : ^[[32m[778688.000000] ^[[0m^[[1mexample[92]^[[0m
+ftp :notice: ^[[32m[804357.000000] ^[[0mexample[93]
+ftp :info : ^[[32m[830584.000000] ^[[0mexample[94]
+ftp :debug : ^[[32m[857375.000000] ^[[0mexample[95]
+^[[32m[884736.000000] ^[[0mexample[96]
+^[[32m[912673.000000] ^[[0m^[[7m^[[31mexample[97]^[[0m
+^[[32m[941192.000000] ^[[0m^[[1m^[[31mexample[98]^[[0m
+^[[32m[970299.000000] ^[[0m^[[31mexample[99]^[[0m
+^[[32m[1000000.000000] ^[[0m^[[1mexample[100]^[[0m
+^[[32m[1030301.000000] ^[[0mexample[101]
+^[[32m[1061208.000000] ^[[0mexample[102]
+^[[32m[1092727.000000] ^[[0mexample[103]
+^[[32m[1124864.000000] ^[[0mexample[104]
diff --git a/tests/ts/dmesg/colors b/tests/ts/dmesg/colors
new file mode 100755
index 0000000..2dfc937
--- /dev/null
+++ b/tests/ts/dmesg/colors
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+# This file is part of util-linux.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This file is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+TS_TOPDIR="${0%/*}/../.."
+TS_DESC="colors"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+ts_check_test_command "$TS_HELPER_DMESG"
+
+$TS_HELPER_DMESG --color=always -F $TS_SELF/input -x >> $TS_OUTPUT 2>/dev/null
+
+ts_finalize
--
2.3.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests
2015-03-22 23:05 [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Sami Kerola
` (4 preceding siblings ...)
2015-03-22 23:05 ` [PATCH 5/5] tests: check dmesg message coloring Sami Kerola
@ 2015-03-23 10:44 ` Karel Zak
5 siblings, 0 replies; 7+ messages in thread
From: Karel Zak @ 2015-03-23 10:44 UTC (permalink / raw)
To: Sami Kerola; +Cc: util-linux
On Sun, Mar 22, 2015 at 11:05:25PM +0000, Sami Kerola wrote:
> Sami Kerola (5):
> dmesg: fix shadow declaration
> tests: add dmesg multiline message check
> tests: add test_dmesg that has fixed boot time
> tests: check timestamp formats
> tests: check dmesg message coloring
Applied, thanks. I have changed the test program to use
DMESG_TEST_BOOTIME env. variable rather than hardcode anything to the
code. It's also necessary to use TZ=GMT to make the tests portable.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-03-23 10:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-22 23:05 [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Sami Kerola
2015-03-22 23:05 ` [PATCH 1/5] dmesg: fix shadow declaration Sami Kerola
2015-03-22 23:05 ` [PATCH 2/5] tests: add dmesg multiline message check Sami Kerola
2015-03-22 23:05 ` [PATCH 3/5] tests: add test_dmesg that has fixed boot time Sami Kerola
2015-03-22 23:05 ` [PATCH 4/5] tests: check timestamp formats Sami Kerola
2015-03-22 23:05 ` [PATCH 5/5] tests: check dmesg message coloring Sami Kerola
2015-03-23 10:44 ` [PATCH 0/5] pull: one dmesg compiler warning fix and bunch of tests Karel Zak
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.