diff options
Diffstat (limited to 'tests/ts/utmp')
-rwxr-xr-x | tests/ts/utmp/last | 93 | ||||
-rwxr-xr-x | tests/ts/utmp/last-ipv6 | 66 | ||||
-rw-r--r-- | tests/ts/utmp/subsec | 3 | ||||
-rw-r--r-- | tests/ts/utmp/txt-a | 19 | ||||
-rw-r--r-- | tests/ts/utmp/txt-a-old | 19 | ||||
-rw-r--r-- | tests/ts/utmp/txt-b | 10 | ||||
-rw-r--r-- | tests/ts/utmp/txt-b-old | 10 | ||||
-rw-r--r-- | tests/ts/utmp/txt-ipv6 | 2 | ||||
-rw-r--r-- | tests/ts/utmp/txt-ipv6-old | 2 | ||||
-rw-r--r-- | tests/ts/utmp/utmp_functions.sh | 18 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-circle | 48 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-subsecond | 32 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-tobin | 32 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-tobin-ipv6 | 32 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-totxt | 28 | ||||
-rwxr-xr-x | tests/ts/utmp/utmpdump-totxt-ipv6 | 28 | ||||
-rw-r--r-- | tests/ts/utmp/wtmp-a.BE | bin | 0 -> 7296 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-a.LE | bin | 0 -> 7296 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-b.BE | bin | 0 -> 3840 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-b.LE | bin | 0 -> 3840 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-ipv6.BE | bin | 0 -> 768 bytes | |||
-rw-r--r-- | tests/ts/utmp/wtmp-ipv6.LE | bin | 0 -> 768 bytes |
22 files changed, 442 insertions, 0 deletions
diff --git a/tests/ts/utmp/last b/tests/ts/utmp/last new file mode 100755 index 0000000..9683103 --- /dev/null +++ b/tests/ts/utmp/last @@ -0,0 +1,93 @@ +#!/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="last" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LAST" +ts_check_test_command "$TS_CMD_UTMPDUMP" +ts_check_prog "ln" + +$TS_CMD_LAST --version 2>&1 | grep -q "invalid option" \ + && ts_skip "deprecated last" + +. "$TS_SELF/utmp_functions.sh" + +WTMP_FILE=${TS_OUTDIR}/wtmp-a +rm -f $WTMP_FILE + +export LANG=C +export TZ=GMT + +if [ $SIZEOF_UTMP -eq 384 ]; then + ln -s ${TS_SELF}/wtmp-a.${BYTE_ORDER} $WTMP_FILE +else + $TS_CMD_UTMPDUMP -r ${TS_SELF}/txt-a > $WTMP_FILE 2>/dev/null \ + || ts_skip "can't create test data" +fi + +# there is no better way yet to skip a subtest +if ts_resolve_host "a.root-servers.net" >/dev/null; then +ts_init_subtest "dns" + +ts_log "~~~ dns short ~~~" +$TS_CMD_LAST -f $WTMP_FILE -d root >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ dns long ~~~" +$TS_CMD_LAST -f $WTMP_FILE -w -d root >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ dns host last ~~~" +$TS_CMD_LAST -f $WTMP_FILE -a -d root >> $TS_OUTPUT 2>/dev/null + +ts_finalize_subtest +fi + +ts_init_subtest "nodns" +ts_log "~~~ basic output ~~~" +$TS_CMD_LAST -f $WTMP_FILE >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ include system ~~~" +$TS_CMD_LAST -f $WTMP_FILE -x >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ show ip ~~~" +$TS_CMD_LAST -f $WTMP_FILE -i torvalds >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ no host ~~~" +$TS_CMD_LAST -f $WTMP_FILE -R torvalds >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ full times shortopt ~~~" +$TS_CMD_LAST -f $WTMP_FILE -F >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ full times longopt ~~~" +$TS_CMD_LAST -f $WTMP_FILE --time-format=full >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ no time ~~~" +$TS_CMD_LAST -f $WTMP_FILE --time-format=notime >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ iso-8601 time ~~~" +$TS_CMD_LAST -f $WTMP_FILE --time-format=iso -w >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ since and until ~~~" +$TS_CMD_LAST -f $WTMP_FILE -s "2013-08-28 02:20" -t "2013-08-28 08:20" >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ present ~~~" +$TS_CMD_LAST -f $WTMP_FILE -p "2013-08-28 11:20" >> $TS_OUTPUT 2>/dev/null +ts_finalize_subtest + +rm -f $WTMP_FILE + +ts_finalize diff --git a/tests/ts/utmp/last-ipv6 b/tests/ts/utmp/last-ipv6 new file mode 100755 index 0000000..d4a9645 --- /dev/null +++ b/tests/ts/utmp/last-ipv6 @@ -0,0 +1,66 @@ +#!/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="last ipv6" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +ts_check_test_command "$TS_CMD_LAST" +$TS_CMD_LAST --version 2>&1 | grep -q "invalid option" \ + && ts_skip "deprecated last" + +. "$TS_SELF/utmp_functions.sh" + +WTMP_FILE=${TS_OUTDIR}/wtmp-ipv6 +rm -f $WTMP_FILE + +export LANG=C +export TZ=GMT + +if [ $SIZEOF_UTMP -eq 384 ]; then + ln -s ${TS_SELF}/wtmp-ipv6.${BYTE_ORDER} $WTMP_FILE +else + $TS_CMD_UTMPDUMP -r ${TS_SELF}/txt-ipv6 > $WTMP_FILE 2>/dev/null \ + || ts_skip "can't create test data" +fi + +# there is no better way yet to skip a subtest +if ts_resolve_host "a.root-servers.net" >/dev/null; then +ts_init_subtest "dns" + +ts_log "~~~ dns short ~~~" +$TS_CMD_LAST -f $WTMP_FILE -d >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ dns long ~~~" +$TS_CMD_LAST -f $WTMP_FILE -d -w >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ dns host last ~~~" +$TS_CMD_LAST -f $WTMP_FILE -d -a >> $TS_OUTPUT 2>/dev/null + +ts_finalize_subtest +fi + +ts_init_subtest "nodns" +ts_log "~~~ show ip ~~~" +$TS_CMD_LAST -f $WTMP_FILE -i >> $TS_OUTPUT 2>/dev/null + +ts_log "~~~ show ip last ~~~" +$TS_CMD_LAST -f $WTMP_FILE -i -a >> $TS_OUTPUT 2>/dev/null +ts_finalize_subtest + +rm -f $WTMP_FILE + +ts_finalize diff --git a/tests/ts/utmp/subsec b/tests/ts/utmp/subsec new file mode 100644 index 0000000..0fdff05 --- /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+00:00] +[8] [00011] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [2013-08-28T20:40:50,999999+00:00] +[0] [00000] [ts/0] [nonvalid] [foo ] [zero ] [0.0.0.0 ] [2013-08-28T12:00:00,123456789+00:00] diff --git a/tests/ts/utmp/txt-a b/tests/ts/utmp/txt-a new file mode 100644 index 0000000..47b6fc2 --- /dev/null +++ b/tests/ts/utmp/txt-a @@ -0,0 +1,19 @@ +[9] [00009] [ts/9] [accounting] [foo ] [nine ] [0.0.0.0 ] [2013-08-28T03:00:00,000000+00:00] +[8] [00008] [ts/8] [dead_process] [foo ] [eight ] [0.0.0.0 ] [2013-08-28T04:00:00,000000+00:00] +[7] [00007] [ts/7] [user_process] [foo ] [seven ] [0.0.0.0 ] [2013-08-28T05:00:00,000000+00:00] +[6] [00006] [ts/6] [login ] [foo ] [six ] [0.0.0.0 ] [2013-08-28T06:00:00,000000+00:00] +[5] [00005] [ts/5] [init ] [foo ] [five ] [0.0.0.0 ] [2013-08-28T07:00:00,000000+00:00] +[4] [00004] [ts/4] [oldtime ] [foo ] [four ] [0.0.0.0 ] [2013-08-28T08:00:00,000000+00:00] +[3] [00003] [ts/3] [newtime ] [foo ] [three ] [0.0.0.0 ] [2013-08-28T09:00:00,000000+00:00] +[2] [00002] [ts/2] [sysboot ] [foo ] [two ] [0.0.0.0 ] [2013-08-28T10:00:00,000000+00:00] +[1] [00001] [ts/1] [runlevel] [foo ] [one ] [0.0.0.0 ] [2013-08-28T11:00:00,000000+00:00] +[0] [00000] [ts/0] [nonvalid] [foo ] [zero ] [0.0.0.0 ] [2013-08-28T12:00:00,000000+00:00] +[7] [00010] [ipv4] [IPv4 ] [root ] [dns-server ] [198.41.0.4 ] [2013-08-28T13:00:00,000000+00:00] +[8] [00011] [ipv4] [IPv4 ] [root ] [dns-server ] [198.41.0.4 ] [2013-08-28T14:00:00,000000+00:00] +[1] [00012] [~~ ] [shutdown] [~ ] [system-name ] [0.0.0.0 ] [2013-08-28T15:00:00,000000+00:00] +[2] [00012] [~~ ] [reboot ] [~ ] [system-name ] [0.0.0.0 ] [2013-08-28T16:00:00,000000+00:00] +[1] [00012] [~~ ] [shutdown] [~ ] [system-name ] [0.0.0.0 ] [2013-08-28T17:00:00,000000+00:00] +[2] [00012] [~~ ] [reboot ] [~ ] [system-name ] [0.0.0.0 ] [2013-08-28T18:00:00,000000+00:00] +[7] [00013] [ts/1] [torvalds] [linux ] [hobby ] [128.214.205.14 ] [1991-08-26T00:57:08,000000+00:00] +[7] [00014] [long] [rick ] [long ] [never-gonna-logout ] [0.0.0.0 ] [1970-01-01T00:00:00,000000+00:00] +[8] [00014] [long] [rick ] [long ] [never-gonna-logout ] [0.0.0.0 ] [2038-01-19T03:14:07,000000+00:00] diff --git a/tests/ts/utmp/txt-a-old b/tests/ts/utmp/txt-a-old new file mode 100644 index 0000000..bc91d19 --- /dev/null +++ b/tests/ts/utmp/txt-a-old @@ -0,0 +1,19 @@ +[9] [00009] [ts/9] [accounting] [foo ] [nine ] [0.0.0.0 ] [Wed Aug 28 03:00:00 2013 GMT] +[8] [00008] [ts/8] [dead_process] [foo ] [eight ] [0.0.0.0 ] [Wed Aug 28 04:00:00 2013 GMT] +[7] [00007] [ts/7] [user_process] [foo ] [seven ] [0.0.0.0 ] [Wed Aug 28 05:00:00 2013 GMT] +[6] [00006] [ts/6] [login ] [foo ] [six ] [0.0.0.0 ] [Wed Aug 28 06:00:00 2013 GMT] +[5] [00005] [ts/5] [init ] [foo ] [five ] [0.0.0.0 ] [Wed Aug 28 07:00:00 2013 GMT] +[4] [00004] [ts/4] [oldtime ] [foo ] [four ] [0.0.0.0 ] [Wed Aug 28 08:00:00 2013 GMT] +[3] [00003] [ts/3] [newtime ] [foo ] [three ] [0.0.0.0 ] [Wed Aug 28 09:00:00 2013 GMT] +[2] [00002] [ts/2] [sysboot ] [foo ] [two ] [0.0.0.0 ] [Wed Aug 28 10:00:00 2013 GMT] +[1] [00001] [ts/1] [runlevel] [foo ] [one ] [0.0.0.0 ] [Wed Aug 28 11:00:00 2013 GMT] +[0] [00000] [ts/0] [nonvalid] [foo ] [zero ] [0.0.0.0 ] [Wed Aug 28 12:00:00 2013 GMT] +[7] [00010] [ipv4] [IPv4 ] [root ] [dns-server ] [198.41.0.4 ] [Wed Aug 28 13:00:00 2013 GMT] +[8] [00011] [ipv4] [IPv4 ] [root ] [dns-server ] [198.41.0.4 ] [Wed Aug 28 14:00:00 2013 GMT] +[1] [00012] [~~ ] [shutdown] [~ ] [system-name ] [0.0.0.0 ] [Wed Aug 28 15:00:00 2013 GMT] +[2] [00012] [~~ ] [reboot ] [~ ] [system-name ] [0.0.0.0 ] [Wed Aug 28 16:00:00 2013 GMT] +[1] [00012] [~~ ] [shutdown] [~ ] [system-name ] [0.0.0.0 ] [Wed Aug 28 17:00:00 2013 GMT] +[2] [00012] [~~ ] [reboot ] [~ ] [system-name ] [0.0.0.0 ] [Wed Aug 28 18:00:00 2013 GMT] +[7] [00013] [ts/1] [torvalds] [linux ] [hobby ] [128.214.205.14 ] [Mon Aug 26 00:57:08 1991 GMT] +[7] [00014] [long] [rick ] [long ] [never-gonna-logout ] [0.0.0.0 ] [ ] +[8] [00014] [long] [rick ] [long ] [never-gonna-logout ] [0.0.0.0 ] [Tue Jan 19 03:14:07 2038 GMT] diff --git a/tests/ts/utmp/txt-b b/tests/ts/utmp/txt-b new file mode 100644 index 0000000..f929273 --- /dev/null +++ b/tests/ts/utmp/txt-b @@ -0,0 +1,10 @@ +[7] [17058] [ts/1] [kerolasa] [pts/1 ] [:0.0 ] [0.0.0.0 ] [2013-01-16T23:44:09,000000+00:00] +[7] [22098] [ts/2] [kerolasa] [pts/2 ] [:0.0 ] [0.0.0.0 ] [2013-01-16T23:49:17,000000+00:00] +[7] [24915] [ts/3] [kerolasa] [pts/3 ] [:0.0 ] [0.0.0.0 ] [2013-01-17T12:23:33,000000+00:00] +[8] [24915] [ts/3] [kerolasa] [pts/3 ] [ ] [0.0.0.0 ] [2013-01-17T12:24:49,000000+00:00] +[7] [30629] [ts/3] [kerolasa] [pts/3 ] [:0.0 ] [0.0.0.0 ] [2013-01-17T13:12:39,000000+00:00] +[8] [30629] [ts/3] [kerolasa] [pts/3 ] [ ] [0.0.0.0 ] [2013-01-17T13:42:19,000000+00:00] +[8] [22098] [ts/2] [kerolasa] [pts/2 ] [ ] [0.0.0.0 ] [2013-01-17T13:42:48,000000+00:00] +[8] [17058] [ts/1] [kerolasa] [pts/1 ] [ ] [0.0.0.0 ] [2013-01-17T13:42:48,000000+00:00] +[7] [31545] [ts/1] [kerolasa] [pts/1 ] [:0.0 ] [0.0.0.0 ] [2013-01-17T20:17:21,000000+00:00] +[7] [28496] [ts/2] [kerolasa] [pts/2 ] [:0.0 ] [0.0.0.0 ] [2013-01-17T21:09:39,000000+00:00] diff --git a/tests/ts/utmp/txt-b-old b/tests/ts/utmp/txt-b-old new file mode 100644 index 0000000..02fb22d --- /dev/null +++ b/tests/ts/utmp/txt-b-old @@ -0,0 +1,10 @@ +[7] [17058] [ts/1] [kerolasa] [pts/1 ] [:0.0 ] [0.0.0.0 ] [Wed Jan 16 23:44:09 2013 GMT] +[7] [22098] [ts/2] [kerolasa] [pts/2 ] [:0.0 ] [0.0.0.0 ] [Wed Jan 16 23:49:17 2013 GMT] +[7] [24915] [ts/3] [kerolasa] [pts/3 ] [:0.0 ] [0.0.0.0 ] [Thu Jan 17 12:23:33 2013 GMT] +[8] [24915] [ts/3] [kerolasa] [pts/3 ] [ ] [0.0.0.0 ] [Thu Jan 17 12:24:49 2013 GMT] +[7] [30629] [ts/3] [kerolasa] [pts/3 ] [:0.0 ] [0.0.0.0 ] [Thu Jan 17 13:12:39 2013 GMT] +[8] [30629] [ts/3] [kerolasa] [pts/3 ] [ ] [0.0.0.0 ] [Thu Jan 17 13:42:19 2013 GMT] +[8] [22098] [ts/2] [kerolasa] [pts/2 ] [ ] [0.0.0.0 ] [Thu Jan 17 13:42:48 2013 GMT] +[8] [17058] [ts/1] [kerolasa] [pts/1 ] [ ] [0.0.0.0 ] [Thu Jan 17 13:42:48 2013 GMT] +[7] [31545] [ts/1] [kerolasa] [pts/1 ] [:0.0 ] [0.0.0.0 ] [Thu Jan 17 20:17:21 2013 GMT] +[7] [28496] [ts/2] [kerolasa] [pts/2 ] [:0.0 ] [0.0.0.0 ] [Thu Jan 17 21:09:39 2013 GMT] diff --git a/tests/ts/utmp/txt-ipv6 b/tests/ts/utmp/txt-ipv6 new file mode 100644 index 0000000..cceb411 --- /dev/null +++ b/tests/ts/utmp/txt-ipv6 @@ -0,0 +1,2 @@ +[7] [00010] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [2013-08-28T20:30:40,000000+00:00] +[8] [00011] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [2013-08-28T20:40:50,000000+00:00] diff --git a/tests/ts/utmp/txt-ipv6-old b/tests/ts/utmp/txt-ipv6-old new file mode 100644 index 0000000..5cce150 --- /dev/null +++ b/tests/ts/utmp/txt-ipv6-old @@ -0,0 +1,2 @@ +[7] [00010] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [Wed Aug 28 20:30:40 2013 GMT] +[8] [00011] [ipv6] [IPv6 ] [root ] [dns-server ] [2001:503:ba3e::2:30] [Wed Aug 28 20:40:50 2013 GMT] diff --git a/tests/ts/utmp/utmp_functions.sh b/tests/ts/utmp/utmp_functions.sh new file mode 100644 index 0000000..74a100c --- /dev/null +++ b/tests/ts/utmp/utmp_functions.sh @@ -0,0 +1,18 @@ +ts_check_test_command "$TS_CMD_UTMPDUMP" +ts_check_test_command "$TS_HELPER_SYSINFO" + +function utmp_struct_size { + local size + # probably "utmpdump -r" could be improved regarding white spaces ... + local txt="[0] [00000] [ ] [ ] [ ] [ ] [0.0.0.0 ] [ ]" + + size=$(echo "$txt" | "$TS_CMD_UTMPDUMP" -r 2>/dev/null | wc -c \ + && exit ${PIPESTATUS[1]}) + ret=$? + [ $ret -eq 0 ] || size="0" + echo "$size" + return $ret +} + +BYTE_ORDER=$($TS_HELPER_SYSINFO byte-order) || ts_failed "byte-order failed" +SIZEOF_UTMP=$(utmp_struct_size) || ts_failed "utmp_struct_size failed" diff --git a/tests/ts/utmp/utmpdump-circle b/tests/ts/utmp/utmpdump-circle new file mode 100755 index 0000000..0065f70 --- /dev/null +++ b/tests/ts/utmp/utmpdump-circle @@ -0,0 +1,48 @@ +#!/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="circle" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +# this test is arch independent, no need for utmp_functions.sh +ts_check_test_command "$TS_CMD_UTMPDUMP" + +export LANG=C +export TZ=Asia/Tokyo +OUT_BIN1=${TS_OUTDIR}/${TS_TESTNAME}.bin1 +OUT_BIN2=${TS_OUTDIR}/${TS_TESTNAME}.bin2 +OUT_TXT=${TS_OUTDIR}/${TS_TESTNAME}.txt + +# Files with -old extension are using timestamp format before utmpdump +# started to use iso-8601 format. This check is testing nothing is lost +# when conversions performing following conversions. +# +# old text format -> binary -> new text format -> binary + +echo "no output expected" > $TS_OUTPUT +for f in txt-a txt-b txt-ipv6; do + $TS_CMD_UTMPDUMP -r $TS_SELF/$f-old > $OUT_BIN1 2>/dev/null && + $TS_CMD_UTMPDUMP $OUT_BIN1 > $OUT_TXT 2>/dev/null && + diff -u $TS_SELF/$f $OUT_TXT && + $TS_CMD_UTMPDUMP -r $OUT_TXT > $OUT_BIN2 2>/dev/null && + diff -q $OUT_BIN1 $OUT_BIN2 || + echo "circle failed for $f" +done >> $TS_OUTPUT 2>&1 + +rm -f "$OUT_BIN1" "$OUT_BIN2" "$OUT_TXT" + +ts_finalize diff --git a/tests/ts/utmp/utmpdump-subsecond b/tests/ts/utmp/utmpdump-subsecond new file mode 100755 index 0000000..f9ee11e --- /dev/null +++ b/tests/ts/utmp/utmpdump-subsecond @@ -0,0 +1,32 @@ +#!/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 + +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 >> $TS_OUTPUT 2>/dev/null + +rm -f "$OUT_BIN" + +ts_finalize diff --git a/tests/ts/utmp/utmpdump-tobin b/tests/ts/utmp/utmpdump-tobin new file mode 100755 index 0000000..8b089e6 --- /dev/null +++ b/tests/ts/utmp/utmpdump-tobin @@ -0,0 +1,32 @@ +#!/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="to binary" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +. "$TS_SELF/utmp_functions.sh" +[ $SIZEOF_UTMP -eq 384 ] || ts_skip "utmp struct size $SIZEOF_UTMP" + +export LANG=C +export TZ=Asia/Tokyo +OUTFILE=${TS_OUTDIR}/${TS_TESTNAME}.file +$TS_CMD_UTMPDUMP -r $TS_SELF/txt-b >| $OUTFILE 2>/dev/null +if diff -q $TS_SELF/wtmp-b.$BYTE_ORDER $OUTFILE; then + echo "no diff" +fi > $TS_OUTPUT 2>&1 + +ts_finalize diff --git a/tests/ts/utmp/utmpdump-tobin-ipv6 b/tests/ts/utmp/utmpdump-tobin-ipv6 new file mode 100755 index 0000000..cd08139 --- /dev/null +++ b/tests/ts/utmp/utmpdump-tobin-ipv6 @@ -0,0 +1,32 @@ +#!/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="IPv6 to binary" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +. "$TS_SELF/utmp_functions.sh" +[ $SIZEOF_UTMP -eq 384 ] || ts_skip "utmp struct size $SIZEOF_UTMP" + +export LANG=C +export TZ=Asia/Tokyo +OUTFILE=${TS_OUTDIR}/${TS_TESTNAME}.file +$TS_CMD_UTMPDUMP -r $TS_SELF/txt-ipv6 >| $OUTFILE 2>/dev/null +if diff -q $TS_SELF/wtmp-ipv6.$BYTE_ORDER $OUTFILE; then + echo "no diff" +fi > $TS_OUTPUT 2>&1 + +ts_finalize diff --git a/tests/ts/utmp/utmpdump-totxt b/tests/ts/utmp/utmpdump-totxt new file mode 100755 index 0000000..099533c --- /dev/null +++ b/tests/ts/utmp/utmpdump-totxt @@ -0,0 +1,28 @@ +#!/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="to text" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +. "$TS_SELF/utmp_functions.sh" +[ $SIZEOF_UTMP -eq 384 ] || ts_skip "utmp struct size $SIZEOF_UTMP" + +export LANG=C +export TZ=Asia/Tokyo +$TS_CMD_UTMPDUMP $TS_SELF/wtmp-b.$BYTE_ORDER >| $TS_OUTPUT 2>/dev/null + +ts_finalize diff --git a/tests/ts/utmp/utmpdump-totxt-ipv6 b/tests/ts/utmp/utmpdump-totxt-ipv6 new file mode 100755 index 0000000..bc9704e --- /dev/null +++ b/tests/ts/utmp/utmpdump-totxt-ipv6 @@ -0,0 +1,28 @@ +#!/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="IPv6 to text" + +. $TS_TOPDIR/functions.sh +ts_init "$*" + +. "$TS_SELF/utmp_functions.sh" +[ $SIZEOF_UTMP -eq 384 ] || ts_skip "utmp struct size $SIZEOF_UTMP" + +export LANG=C +export TZ=Asia/Tokyo +$TS_CMD_UTMPDUMP $TS_SELF/wtmp-ipv6.$BYTE_ORDER >| $TS_OUTPUT 2>/dev/null + +ts_finalize diff --git a/tests/ts/utmp/wtmp-a.BE b/tests/ts/utmp/wtmp-a.BE Binary files differnew file mode 100644 index 0000000..5015f8e --- /dev/null +++ b/tests/ts/utmp/wtmp-a.BE diff --git a/tests/ts/utmp/wtmp-a.LE b/tests/ts/utmp/wtmp-a.LE Binary files differnew file mode 100644 index 0000000..f66bb20 --- /dev/null +++ b/tests/ts/utmp/wtmp-a.LE diff --git a/tests/ts/utmp/wtmp-b.BE b/tests/ts/utmp/wtmp-b.BE Binary files differnew file mode 100644 index 0000000..fb09a0c --- /dev/null +++ b/tests/ts/utmp/wtmp-b.BE diff --git a/tests/ts/utmp/wtmp-b.LE b/tests/ts/utmp/wtmp-b.LE Binary files differnew file mode 100644 index 0000000..45d35bb --- /dev/null +++ b/tests/ts/utmp/wtmp-b.LE diff --git a/tests/ts/utmp/wtmp-ipv6.BE b/tests/ts/utmp/wtmp-ipv6.BE Binary files differnew file mode 100644 index 0000000..8cf7d39 --- /dev/null +++ b/tests/ts/utmp/wtmp-ipv6.BE diff --git a/tests/ts/utmp/wtmp-ipv6.LE b/tests/ts/utmp/wtmp-ipv6.LE Binary files differnew file mode 100644 index 0000000..342553b --- /dev/null +++ b/tests/ts/utmp/wtmp-ipv6.LE |