| 1 | #!/bin/bash |
| 2 | |
| 3 | # This file is part of util-linux. |
| 4 | # |
| 5 | # This file is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License as published by |
| 7 | # the Free Software Foundation; either version 2 of the License, or |
| 8 | # (at your option) any later version. |
| 9 | # |
| 10 | # This file is distributed in the hope that it will be useful, |
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | # GNU General Public License for more details. |
| 14 | |
| 15 | TS_TOPDIR="${0%/*}/../.." |
| 16 | TS_DESC="circle" |
| 17 | |
| 18 | . "$TS_TOPDIR"/functions.sh |
| 19 | ts_init "$*" |
| 20 | |
| 21 | # this test is arch independent, no need for utmp_functions.sh |
| 22 | ts_check_test_command "$TS_CMD_UTMPDUMP" |
| 23 | |
| 24 | export LANG=C |
| 25 | export TZ=Asia/Tokyo |
| 26 | OUT_BIN1=${TS_OUTDIR}/${TS_TESTNAME}.bin1 |
| 27 | OUT_BIN2=${TS_OUTDIR}/${TS_TESTNAME}.bin2 |
| 28 | OUT_TXT=${TS_OUTDIR}/${TS_TESTNAME}.txt |
| 29 | |
| 30 | # Files with -old extension are using timestamp format before utmpdump |
| 31 | # started to use iso-8601 format. This check is testing nothing is lost |
| 32 | # when conversions performing following conversions. |
| 33 | # |
| 34 | # old text format -> binary -> new text format -> binary |
| 35 | |
| 36 | echo "no output expected" > $TS_OUTPUT |
| 37 | for f in txt-a txt-b txt-ipv6; do |
| 38 | $TS_CMD_UTMPDUMP -r $TS_SELF/$f-old > $OUT_BIN1 2>/dev/null && |
| 39 | $TS_CMD_UTMPDUMP $OUT_BIN1 > $OUT_TXT 2>/dev/null && |
| 40 | diff -u $TS_SELF/$f $OUT_TXT && |
| 41 | $TS_CMD_UTMPDUMP -r $OUT_TXT > $OUT_BIN2 2>/dev/null && |
| 42 | diff -q $OUT_BIN1 $OUT_BIN2 || |
| 43 | echo "circle failed for $f" |
| 44 | done >> $TS_OUTPUT 2>> $TS_ERRLOG |
| 45 | |
| 46 | rm -f "$OUT_BIN1" "$OUT_BIN2" "$OUT_TXT" |
| 47 | |
| 48 | ts_finalize |