2018-05-17 17:06:50 +03:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
lnav_test="${top_builddir}/src/lnav-test"
|
|
|
|
|
|
|
|
export HOME="./meta-sessions"
|
2021-08-29 17:35:55 +03:00
|
|
|
export XDG_CONFIG_HOME="./meta-sessions/.config"
|
2018-05-17 17:06:50 +03:00
|
|
|
rm -rf "./meta-sessions"
|
2019-08-01 17:14:47 +03:00
|
|
|
mkdir -p $HOME/.config
|
2018-05-17 17:06:50 +03:00
|
|
|
|
2021-08-29 16:31:45 +03:00
|
|
|
run_test ${lnav_test} -n -dln.dbg \
|
2018-05-17 17:06:50 +03:00
|
|
|
-c ":comment Hello, World!" \
|
|
|
|
-c ":tag foo" \
|
|
|
|
-c ":save-session" \
|
2019-01-29 18:30:37 +03:00
|
|
|
-c ":write-screen-to -" \
|
2018-05-17 17:06:50 +03:00
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output ":tag did not work?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
|
2018-11-22 04:00:28 +03:00
|
|
|
// Hello, World!
|
|
|
|
-- #foo
|
2018-05-17 17:06:50 +03:00
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
EOF
|
|
|
|
|
2021-08-29 08:50:52 +03:00
|
|
|
ls -lha meta-sessions
|
|
|
|
find meta-sessions
|
2022-04-13 02:07:13 +03:00
|
|
|
# cat ln.dbg
|
2019-08-01 17:14:47 +03:00
|
|
|
if test ! -d meta-sessions/.config/lnav; then
|
|
|
|
echo "error: configuration not stored in .config/lnav?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if test -d meta-sessions/.lnav; then
|
|
|
|
echo "error: configuration stored in .lnav?"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2018-05-17 17:06:50 +03:00
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ":load-session" \
|
2018-11-22 04:00:28 +03:00
|
|
|
-c ";UPDATE access_log SET log_mark = 1" \
|
|
|
|
-c ":write-to -" \
|
2018-05-17 17:06:50 +03:00
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "tag was not saved in session?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
|
2018-11-22 04:00:28 +03:00
|
|
|
// Hello, World!
|
|
|
|
-- #foo
|
2018-05-17 17:06:50 +03:00
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ":load-session" \
|
|
|
|
-c ":untag #foo" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output ":untag did not work?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
|
|
|
|
+ Hello, World!
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ":load-session" \
|
|
|
|
-c ":clear-comment" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output ":clear-comment did not work?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
|
|
|
|
+ #foo
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ":goto 2" \
|
|
|
|
-c "/foo" \
|
|
|
|
-c ":tag #foo" \
|
|
|
|
-c ":goto 0" \
|
|
|
|
-c ":next-mark search" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "searching for a tag did not work?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
+ #foo
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ":load-session" \
|
|
|
|
-c ";SELECT log_line, log_comment, log_tags FROM access_log" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "metadata columns are not working?" <<EOF
|
|
|
|
log_line log_comment log_tags
|
|
|
|
0 Hello, World! ["#foo"]
|
|
|
|
1 <NULL> <NULL>
|
|
|
|
2 <NULL> <NULL>
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
2019-02-02 00:31:28 +03:00
|
|
|
-c ";UPDATE access_log SET log_tags = json_array('#foo', '#foo') WHERE log_line = 1" \
|
|
|
|
-c ":save-session" \
|
2018-05-17 17:06:50 +03:00
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "updating log_tags is not working?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
|
|
|
|
+ #foo
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ";UPDATE access_log SET log_comment = 'Hello, World!' WHERE log_line = 1" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "updating log_comment is not working?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
|
|
|
|
+ Hello, World!
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ";UPDATE access_log SET log_tags = 1 WHERE log_line = 1" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_error_output "updating log_tags is not working?" <<EOF
|
2022-04-13 02:07:13 +03:00
|
|
|
✘ error: invalid value for “log_tags” column of table “access_log”
|
|
|
|
reason: unexpected JSON value
|
|
|
|
| --> access_log.log_tags:1
|
|
|
|
| | 1
|
|
|
|
| = help: expecting an array of tag values
|
|
|
|
--> command-option:1
|
|
|
|
| ;UPDATE access_log SET log_tags = 1 WHERE log_line = 1
|
2018-05-17 17:06:50 +03:00
|
|
|
EOF
|
|
|
|
|
2019-02-02 00:31:28 +03:00
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ";UPDATE access_log SET log_tags = json_array('foo') WHERE log_line = 1" \
|
|
|
|
-c ":save-session" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_error_output "updating log_tags is not working?" <<EOF
|
2022-04-13 02:07:13 +03:00
|
|
|
✘ error: invalid value for “log_tags” column of table “access_log”
|
|
|
|
reason: “foo” is not a valid value for option “/#”
|
|
|
|
| reason: value does not match pattern: ^#[^\s]+\$
|
|
|
|
| --> access_log.log_tags:1
|
|
|
|
| | ["foo"]
|
|
|
|
| = help: Property Synopsis
|
|
|
|
| /# tag
|
|
|
|
| Description
|
|
|
|
| A tag for the log line
|
|
|
|
--> command-option:1
|
|
|
|
| ;UPDATE access_log SET log_tags = json_array('foo') WHERE log_line = 1
|
2019-02-02 00:31:28 +03:00
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ":load-session" \
|
|
|
|
-c ";SELECT log_tags FROM access_log WHERE log_line = 1" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "log_tags was updated?" <<EOF
|
|
|
|
log_tags
|
|
|
|
["#foo"]
|
|
|
|
EOF
|
|
|
|
|
2021-02-01 08:59:48 +03:00
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ":tag foo" \
|
|
|
|
-c ":delete-tags #foo" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output ":delete-tags does not work?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
EOF
|
|
|
|
|
2018-05-17 17:06:50 +03:00
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ":tag foo" \
|
|
|
|
-c ";UPDATE access_log SET log_tags = null" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "clearing log_tags is not working?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
EOF
|
|
|
|
|
|
|
|
run_test ${lnav_test} -n \
|
|
|
|
-c ":comment foo" \
|
|
|
|
-c ";UPDATE access_log SET log_comment = null" \
|
|
|
|
${test_dir}/logfile_access_log.0
|
|
|
|
|
|
|
|
check_output "clearing log_tags is not working?" <<EOF
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:26 +0000] "GET /vmw/cgi/tramp HTTP/1.0" 200 134 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkboot.gz HTTP/1.0" 404 46210 "-" "gPXE/0.9.7"
|
|
|
|
192.168.202.254 - - [20/Jul/2009:22:59:29 +0000] "GET /vmw/vSphere/default/vmkernel.gz HTTP/1.0" 200 78929 "-" "gPXE/0.9.7"
|
|
|
|
EOF
|