diff options
Diffstat (limited to '')
-rw-r--r-- | test/test_logfile.sh | 75 |
1 files changed, 53 insertions, 22 deletions
diff --git a/test/test_logfile.sh b/test/test_logfile.sh index 86e26c9..0fe2908 100644 --- a/test/test_logfile.sh +++ b/test/test_logfile.sh @@ -1,5 +1,6 @@ #! /bin/bash +export TZ=UTC echo ${top_srcdir} echo ${top_builddir} @@ -9,6 +10,9 @@ printf '#Date:\t20\x800-2-02\n0\n' | run_cap_test \ printf '000\n000\n#Fields: 0\n0\n#Fields: 0\n0' | run_cap_test \ env TEST_COMMENT="invalid w3c log" ${lnav_test} -n +printf '#Date:\t3/9/3/0\x85 2\n0\n' | run_cap_test \ + env TEST_COMMENT="invalid w3c timestamp" ${lnav_test} -n + cat > rollover_in.0 <<EOF 2600/2 0 00:00:00 0: 00:2 0 00:00:00 0: @@ -37,17 +41,18 @@ run_cap_test ${lnav_test} -n \ -c ';SELECT * FROM logline' \ ${test_dir}/logfile_block.1 -run_test ${lnav_test} -d /tmp/lnav.err -n -w logfile_stdin.0.log \ - -c ':shexec sleep 1 && touch -t 200711030923 logfile_stdin.0.log' <<EOF -2013-06-06T19:13:20.123 Hi -EOF +if test x"${TSHARK_CMD}" != x""; then + run_test env TZ=UTC ${lnav_test} -n ${test_dir}/dhcp.pcapng -check_output "piping to stdin is not working?" <<EOF -2013-06-06T19:13:20.123 Hi + check_output "pcap file is not recognized" <<EOF +2004-12-05T19:16:24.317 0.0.0.0 → 255.255.255.255 DHCP 314 DHCP Discover - Transaction ID 0x3d1d +2004-12-05T19:16:24.317 192.168.0.1 → 192.168.0.10 DHCP 342 DHCP Offer - Transaction ID 0x3d1d +2004-12-05T19:16:24.387 0.0.0.0 → 255.255.255.255 DHCP 314 DHCP Request - Transaction ID 0x3d1e +2004-12-05T19:16:24.387 192.168.0.1 → 192.168.0.10 DHCP 342 DHCP ACK - Transaction ID 0x3d1e EOF -if test x"${TSHARK_CMD}" != x""; then - run_test env TZ=UTC ${lnav_test} -n ${test_dir}/dhcp.pcapng + # make sure piped binary data is left alone + run_test cat ${test_dir}/dhcp.pcapng | env TZ=UTC ${lnav_test} -n check_output "pcap file is not recognized" <<EOF 2004-12-05T19:16:24.317 0.0.0.0 → 255.255.255.255 DHCP 314 DHCP Discover - Transaction ID 0x3d1d @@ -59,7 +64,8 @@ EOF run_test ${lnav_test} -n ${test_dir}/dhcp-trunc.pcapng check_error_output "truncated pcap file is not recognized" <<EOF -error: unable to open file: {test_dir}/dhcp-trunc.pcapng -- tshark: The file "{test_dir}/dhcp-trunc.pcapng" appears to have been cut short in the middle of a packet. +✘ error: unable to open file: {test_dir}/dhcp-trunc.pcapng + reason: tshark: The file "{test_dir}/dhcp-trunc.pcapng" appears to have been cut short in the middle of a packet. EOF fi @@ -377,8 +383,6 @@ TCF 2014-04-06 11:01:11.475557: 0: <--- R 2 ["P1"] <eom> EOF -# The TCSH format converts to local time, so we need to specify a TZ -export TZ="UTC" run_test ./drive_logfile -t -f tcsh_history ${srcdir}/logfile_tcsh_history.0 check_output "TCSH timestamp interpreted incorrectly?" <<EOF @@ -396,6 +400,10 @@ Jul 20 22:59:29 2009 -- 000 Jul 20 22:59:29 2009 -- 000 EOF +run_cap_test env TZ=America/Los_Angeles ./drive_logfile -t -f access_log ${srcdir}/logfile_access_log.0 + +run_cap_test env TZ=America/Los_Angeles ${lnav_test} -n ${srcdir}/logfile_access_log.0 + run_test ./drive_logfile -t -f generic_log ${srcdir}/logfile_tai64n.0 check_output "tai64n timestamps interpreted incorrectly?" <<EOF @@ -543,6 +551,12 @@ error 0x0 error 0x0 EOF +run_cap_test ./drive_logfile -t -f generic_log ${test_dir}/logfile_with_zones.0 + +run_cap_test env TZ=America/Los_Angeles ./drive_logfile -t -f generic_log ${test_dir}/logfile_with_zones.0 + +run_cap_test env TZ=America/New_York ./drive_logfile -t -f generic_log ${test_dir}/logfile_with_zones.0 + touch -t 200711030923 ${srcdir}/logfile_glog.0 run_test ./drive_logfile -t -f glog_log ${srcdir}/logfile_glog.0 @@ -588,15 +602,6 @@ info 0x0 error 0x0 EOF -run_test ${lnav_test} -d /tmp/lnav.err -nt -w logfile_stdin.log <<EOF -Hi -EOF - -check_output "piping to stdin is not working?" <<EOF -2013-06-06T19:13:20.123 Hi -2013-06-06T19:13:20.123 ---- END-OF-STDIN ---- -EOF - run_test ${lnav_test} -C ${test_dir}/logfile_bad_access_log.0 sed -ibak -e "s|/.*/logfile_bad_access_log.0|logfile_bad_access_log.0|g" `test_err_filename` @@ -635,8 +640,8 @@ EOF run_test ${lnav_test} -n -I ${test_dir} ${srcdir}/logfile_epoch.0 check_output "rewriting machine-oriented timestamp didn't work?" <<EOF -2015-04-10 02:58:07.123000 Hello, World! -2015-04-10 02:58:07.456000 Goodbye, World! +2015-04-10 02:58:07.123 Hello, World! +2015-04-10 02:58:07.456 Goodbye, World! EOF run_test ${lnav_test} -n -I ${test_dir} ${srcdir}/logfile_crlf.0 @@ -705,3 +710,29 @@ run_cap_test ${lnav_test} -n \ run_cap_test ${lnav_test} -n \ -c ':filter-in Air Mob' \ ${test_dir}/logfile_ansi.1 + +export HOME="./file-tz" +rm -rf "./file-tz" +mkdir -p $HOME + +touch -t 200711030000 ${srcdir}/logfile_syslog.0 + +run_cap_test ${lnav_test} -n \ + -c ':set-file-timezone America/Los_Angeles' \ + ${test_dir}/logfile_syslog.0 + +# make sure the file options were saved and restored +run_cap_test ${lnav_test} -n \ + ${test_dir}/logfile_syslog.0 + +run_cap_test ${lnav_test} -n \ + -c ";SELECT options_path, options FROM lnav_file" \ + ${test_dir}/logfile_syslog.0 + +run_cap_test ${lnav_test} -n \ + -c ':set-file-timezone America/New_York' \ + ${test_dir}/logfile_syslog.0 + +run_cap_test ${lnav_test} -n \ + -c ':set-file-timezone bad' \ + ${test_dir}/logfile_syslog.0 |