summaryrefslogtreecommitdiffstats
path: root/tests/ts/utmp
diff options
context:
space:
mode:
authorSami Kerola2016-05-15 11:55:54 +0200
committerSami Kerola2016-06-27 20:57:29 +0200
commitb5ef1507df78a4e7e08a1fdc94595528a4c1561c (patch)
tree44ed9afb1e37af9ff02a010e4902ae0c8812397f /tests/ts/utmp
parenttests: challenge utmpdump localization go-around (diff)
downloadkernel-qcow2-util-linux-b5ef1507df78a4e7e08a1fdc94595528a4c1561c.tar.gz
kernel-qcow2-util-linux-b5ef1507df78a4e7e08a1fdc94595528a4c1561c.tar.xz
kernel-qcow2-util-linux-b5ef1507df78a4e7e08a1fdc94595528a4c1561c.zip
tests: utmpdump add subsecond accuracy test
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'tests/ts/utmp')
-rw-r--r--tests/ts/utmp/subsec3
-rwxr-xr-xtests/ts/utmp/utmpdump-subsecond34
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/ts/utmp/subsec b/tests/ts/utmp/subsec
new file mode 100644
index 000000000..4881e7cad
--- /dev/null
+++ b/tests/ts/utmp/subsec
@@ -0,0 +1,3 @@
+[7] [00010] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [2013-08-28T20:30:40,123456+0000]
+[8] [00011] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [2013-08-28T20:40:50,999999+0000]
+[0] [00000] [ts/0] [nonvalid] [foo ] [zero ] [0.0.0.0 ] [2013-08-28T12:00:00,123456789+0000]
diff --git a/tests/ts/utmp/utmpdump-subsecond b/tests/ts/utmp/utmpdump-subsecond
new file mode 100755
index 000000000..f753a6d76
--- /dev/null
+++ b/tests/ts/utmp/utmpdump-subsecond
@@ -0,0 +1,34 @@
+#!/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="subsecond"
+
+. $TS_TOPDIR/functions.sh
+ts_init "$*"
+
+# this test is arch independent, no need for utmp_functions.sh
+ts_check_test_command "$TS_CMD_UTMPDUMP"
+
+OUT_BIN=${TS_OUTDIR}/${TS_TESTNAME}.bin
+OUT_TXT=${TS_OUTDIR}/${TS_TESTNAME}.txt
+
+echo "last 9 is expected to disappear in conversion" > $TS_OUTPUT
+$TS_CMD_UTMPDUMP -r $TS_SELF/subsec > $OUT_BIN 2>/dev/null
+$TS_CMD_UTMPDUMP $OUT_BIN > $OUT_TXT 2>/dev/null
+diff $TS_SELF/subsec $OUT_TXT >> $TS_OUTPUT 2>&1
+
+rm -f "$OUT_BIN" "$OUT_TXT"
+
+ts_finalize