diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:44:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 17:44:55 +0000 |
commit | 5068d34c08f951a7ea6257d305a1627b09a95817 (patch) | |
tree | 08213e2be853396a3b07ce15dbe222644dcd9a89 /test/test_meta.sh | |
parent | Initial commit. (diff) | |
download | lnav-5068d34c08f951a7ea6257d305a1627b09a95817.tar.xz lnav-5068d34c08f951a7ea6257d305a1627b09a95817.zip |
Adding upstream version 0.11.1.upstream/0.11.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_meta.sh')
-rw-r--r-- | test/test_meta.sh | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/test/test_meta.sh b/test/test_meta.sh new file mode 100644 index 0000000..caab4f9 --- /dev/null +++ b/test/test_meta.sh @@ -0,0 +1,110 @@ +#! /bin/bash + +export YES_COLOR=1 + +export HOME="./meta-sessions" +export XDG_CONFIG_HOME="./meta-sessions/.config" +rm -rf "./meta-sessions" +mkdir -p $HOME/.config + +# add comment/tag +run_cap_test ${lnav_test} -n -dln.dbg \ + -c ":comment Hello, World!" \ + -c ":tag foo" \ + -c ":save-session" \ + -c ":write-screen-to -" \ + ${test_dir}/logfile_access_log.0 + +ls -lha meta-sessions +find meta-sessions +# cat ln.dbg +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 + +# tag was saved and :write-to displays the comments/tags +run_cap_test ${lnav_test} -n \ + -c ":load-session" \ + -c ";UPDATE access_log SET log_mark = 1" \ + -c ":write-to -" \ + ${test_dir}/logfile_access_log.0 + +run_cap_test ${lnav_test} -n \ + -c ":load-session" \ + -c ":untag #foo" \ + ${test_dir}/logfile_access_log.0 + +run_cap_test ${lnav_test} -n \ + -c ":load-session" \ + -c ":clear-comment" \ + ${test_dir}/logfile_access_log.0 + +# search for a tag +run_cap_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 + +# query meta columns +run_cap_test ${lnav_test} -n \ + -c ":load-session" \ + -c ";SELECT log_line, log_comment, log_tags FROM access_log" \ + ${test_dir}/logfile_access_log.0 + +run_cap_test ${lnav_test} -n \ + -c ";UPDATE access_log SET log_tags = json_array('#foo', '#foo') WHERE log_line = 1" \ + -c ":save-session" \ + ${test_dir}/logfile_access_log.0 + +run_cap_test ${lnav_test} -n \ + -c ";UPDATE access_log SET log_comment = 'Goodbye, World!' WHERE log_line = 1" \ + ${test_dir}/logfile_access_log.0 + +run_cap_test ${lnav_test} -n \ + -c ";UPDATE access_log SET log_tags = 1 WHERE log_line = 1" \ + ${test_dir}/logfile_access_log.0 + +run_cap_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 + +run_cap_test ${lnav_test} -n \ + -c ":load-session" \ + -c ";SELECT log_tags FROM access_log WHERE log_line = 1" \ + ${test_dir}/logfile_access_log.0 + +run_cap_test ${lnav_test} -n \ + -c ":tag foo" \ + -c ":delete-tags #foo" \ + ${test_dir}/logfile_access_log.0 + +run_cap_test ${lnav_test} -n \ + -c ":tag foo" \ + -c ";UPDATE access_log SET log_tags = null" \ + ${test_dir}/logfile_access_log.0 + +run_cap_test ${lnav_test} -n \ + -c ":comment foo" \ + -c ";UPDATE access_log SET log_comment = null" \ + ${test_dir}/logfile_access_log.0 + +run_cap_test ${lnav_test} -d /tmp/lnav.err -n \ + -I ${test_dir} \ + ${test_dir}/logfile_xml_msg.0 + +run_cap_test ${lnav_test} -n -f- \ + ${test_dir}/logfile_access_log.0 <<'EOF' +:comment Hello, **World**! + +This is `markdown` now! +EOF |