#! /bin/bash run_test ${lnav_test} -n \ -c ":goto 1" \ -c ":mark" \ -c ":hide-unmarked-lines" \ -c ":goto 0" \ ${test_dir}/logfile_access_log.0 check_output "hide-unmarked-lines does not work?" < command-option:1 | :unix-time = help: Synopsis :unix-time seconds - Convert epoch time to a human-readable form EOF run_test ${lnav_test} -n \ -c ":unix-time abc" \ "${test_dir}/logfile_access_log.*" check_error_output ":unix-time works without arg?" < command-option:1 | :unix-time abc = help: Synopsis :unix-time seconds - Convert epoch time to a human-readable form EOF run_test env TZ=UTC ${lnav_test} -n \ -c ":unix-time 1612072409" \ "${test_dir}/logfile_access_log.*" check_output ":unix-time does not convert time correctly?" < command-option:1 | :write-to = help: Synopsis :write-to path - Overwrite the given file with any marked lines in the current view EOF run_test ${lnav_test} -n -d /tmp/lnav.err \ -c ";SELECT 1 AS c1, 'Hello ' || char(10) || 'World!' AS c2" \ -c ":write-csv-to -" \ "${test_dir}/logfile_access_log.*" check_output "writing CSV does not work" < command-option:1 | :filter-expr timeslice(:log_time_msecs, 'bad') is not null = help: Synopsis :filter-expr expr - Set the filter expression EOF run_test ${lnav_test} -n -d /tmp/lnav.err \ -c ":filter-expr :log_text LIKE '%How are%'" \ "${test_dir}/logfile_multiline.0" check_output "filter-expr for multiline not working" < 2000" \ "${test_dir}/logfile_access_log.*" check_output "filter-expr not working" < command-option:1 | :filter-expr :sc_bytes # ff = help: Synopsis :filter-expr expr - Set the filter expression EOF run_test ${lnav_test} -n -d /tmp/lnav.err \ -c ":goto 0" \ -c ":close" \ -c ":goto 0" \ "${test_dir}/logfile_access_log.*" check_output "close not sticking" < command-option:1 | :hide-fields foobar = help: Synopsis :hide-fields field-name1 [... field-nameN] - Hide log message fields by replacing them with an ellipsis EOF run_test ${lnav_test} -n \ -c ":hide-fields cs_uri_stem" \ ${test_dir}/logfile_access_log.0 check_output "hide-fields with uri" < command-option:1 | :config /bad/option = help: Synopsis :config option [value] - Read or write a configuration option EOF check_output "config bad option" < command-option:1 | |nonexistent.lnav EOF run_test ${lnav_test} -n \ -c ":adjust-log-time 2010-01-01T00:00:00" \ ${test_dir}/logfile_access_log.0 check_output "adjust-log-time is not working" <(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 11 unplug = 0 Sep 13 03:46:03 Tim-Stacks-iMac kernel[0]: vm_compressor_flush - starting Sep 13 03:46:03 Tim-Stacks-iMac kernel[0]: AppleBCM5701Ethernet [en0]: 0 0 memWrInd fBJP_Wakeup_Timer Sep 13 03:13:16 Tim-Stacks-iMac kernel[0]: AppleThunderboltNHIType2::waitForOk2Go2Sx - retries = 60000 Sep 13 03:46:03 Tim-Stacks-iMac kernel[0]: hibernate_page_list_setall(preflight 0) start 0xffffff838f1fc000, 0xffffff838f2bc000 EOF run_test ${lnav_test} -n \ -c ":goto 0" \ -c ":goto 3:45" \ ${test_dir}/logfile_syslog_with_mixed_times.0 check_output "goto 3:45 is not working?" <(0x0)::listenerCallback - Thunderbolt HPD packet for route = 0x0 port = 11 unplug = 0 Sep 13 03:46:03 Tim-Stacks-iMac kernel[0]: vm_compressor_flush - starting Sep 13 03:46:03 Tim-Stacks-iMac kernel[0]: AppleBCM5701Ethernet [en0]: 0 0 memWrInd fBJP_Wakeup_Timer Sep 13 03:13:16 Tim-Stacks-iMac kernel[0]: AppleThunderboltNHIType2::waitForOk2Go2Sx - retries = 60000 Sep 13 03:46:03 Tim-Stacks-iMac kernel[0]: hibernate_page_list_setall(preflight 0) start 0xffffff838f1fc000, 0xffffff838f2bc000 EOF run_test ${lnav_test} -n \ -c ":goto invalid" \ ${test_dir}/logfile_access_log.0 check_error_output "goto invalid is working" < command-option:1 | :goto invalid = help: Synopsis :goto line#|N%|date - Go to the given location in the top view EOF check_output "goto invalid is not working" < command-option:2 | :next-mark foobar = help: Synopsis :next-mark type1 [... typeN] - Move to the next bookmark of the given type in the current view EOF check_output "invalid mark-type is working" <> logfile_append.0" \ -c ":rebuild" \ logfile_append.0 check_output "filter-out append is not working" < command-option:32 | :filter-out 32 = help: Synopsis :filter-out pattern - Remove lines that match the given regular expression in the current view EOF run_test ${lnav_test} -n \ -c ":close" \ ${test_dir}/logfile_access_log.0 check_output "close is not working" < command-option:2 | :close = help: Synopsis :close - Close the top file in the view EOF check_output "double close is working" < command-option:1 | :open = help: Synopsis :open path1 [... pathN] - Open the given file(s) in lnav. Opening files on machines accessible via SSH can be done using the syntax: [user@]host:/path/to/logs EOF run_test ${lnav_test} -n \ -c ":close" \ -c ":open ${test_dir}/logfile_multiline.0" \ ${test_dir}/logfile_access_log.0 check_output "open is not working" < command-option:2 | :open /non-existent = help: Synopsis :open path1 [... pathN] - Open the given file(s) in lnav. Opening files on machines accessible via SSH can be done using the syntax: [user@]host:/path/to/logs EOF check_output "open non-existent is not working" < command-option:2 | :write-json-to - = help: Synopsis :write-json-to path - Write SQL results to the given file in JSON format EOF unset LNAVSECURE run_test ${lnav_test} -n \ -c ";update generic_log set log_mark=1" \ -c ":pipe-to sed -e 's/World!/Bork!/g' -e 's/2009//g'" \ ${test_dir}/logfile_multiline.0 check_output "pipe-to is not working" < en-US ipInfo 198.51.100.253 true true nic1 0.0.0.0 True 22 dhcp 198.51.100.110 nic1 fe80::214:f609:19f7:6bf1 True nic1 False False other preferred 64 fe80::250:56ff:feaa:5abf up 00:50:56:aa:5a:bf nic1 EOF run_test ${lnav_test} -n \ -c ":goto 0" \ -c ":switch-to-view pretty" \ ${test_dir}/logfile_pretty.0 check_output "pretty-printer is not working" < url="https://tools.google.com/service/update2" runningFetchers=0 tickets=1 activeTickets=1 rollCallTickets=1 body= > Apr 7 07:31:56 Tim-Stacks-iMac.local VirtualBox[36403]: WARNING: The Gestalt selector gestaltSystemVersion is returning 10.9.2 instead of 10.10.2. Use NSProcessInfo's operatingSystemVersion property to get correct system version number. Call location: Apr 7 07:31:56 Tim-Stacks-iMac.local VirtualBox[36403]: 0 CarbonCore 0x00007fff8a9b3d9b ___Gestalt_SystemVersion_block_invoke + 113 Apr 7 07:31:56 Tim-Stacks-iMac.local VirtualBox[36403]: 1 libdispatch.dylib 0x00007fff8bc84c13 _dispatch_client_callout + 8 Apr 7 07:32:56 Tim-Stacks-iMac.local logger[234]: Bad data { abc, 123, 456 ) }] EOF run_test ${lnav_test} -n \ -c ":set-min-log-level error" \ ${test_dir}/logfile_access_log.0 check_output "set-min-log-level is not working" < command-option:1 | :clear-highlight foobar = help: Synopsis :clear-highlight pattern - Remove a previously set highlight regular expression EOF run_test ${lnav_test} -n \ -c ":zoom-to 4-hour" \ ${test_dir}/textfile_json_indented.0 check_output "histogram is not working?" <> logfile_rollover.1.live" \ -c ":rebuild" \ -c ":switch-to-view histogram" \ -c ":goto 0" \ logfile_rollover.1.live check_output "rollover is not working with histogram" < command-option:1 | :mark-expr = help: Synopsis :mark-expr expr - Set the bookmark expression EOF run_test ${lnav_test} -n \ -c ":mark-expr :log_procname lik" \ ${test_dir}/logfile_syslog.0 check_error_output ":mark-expr works with a bad expression?" < command-option:1 | :mark-expr :log_procname lik = help: Synopsis :mark-expr expr - Set the bookmark expression EOF run_test ${lnav_test} -n \ -c ":mark-expr :cs_uri_stem LIKE '%vmk%'" \ -c ":write-to -" \ ${test_dir}/logfile_access_log.0 check_output "mark-expr is not working?" < command-option:1 | :zoom-to bad = help: Synopsis :zoom-to zoom-level - Zoom the histogram view to the given level EOF run_test ${lnav_test} -n \ -f ${test_dir}/multiline.lnav \ ${test_dir}/logfile_access_log.0 check_output "multiline commands do not work?" <