File: test_cli.sh

package info (click to toggle)
lnav 0.13.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 60,084 kB
  • sloc: cpp: 215,599; ansic: 59,220; sh: 4,650; makefile: 3,578; python: 1,197; sql: 315; xml: 264; javascript: 18
file content (86 lines) | stat: -rw-r--r-- 2,265 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#! /bin/bash

export TZ="UTC"
export YES_COLOR=1

run_cap_test ${lnav_test} -h

run_cap_test ${lnav_test} badfilename

run_cap_test ${lnav_test} -n -c 'foo'

run_cap_test ${lnav_test} -d /tmp/lnav.err -n <<EOF
Hello, World!
Goodbye, World!
EOF

mkdir -p nested/sub1/sub2
echo "2021-07-03T21:49:29 Test" > nested/sub1/sub2/test.log

run_cap_test ${lnav_test} -nr nested

printf "a\ba _\ba a\b_" | run_cap_test env TEST_COMMENT="overstrike bold" \
    ${lnav_test} -n

{
  echo "This is the start of a file with long lines"
  ${lnav_test} -nN \
    -c ";select replicate('abcd', 2 * 1024 * 1024)" -c ':write-raw-to -'
  echo "abcd"
  echo "Goodbye"
} > textfile_long_lines.0

grep abcd textfile_long_lines.0 | run_cap_test \
    ${lnav_test} -n -d /tmp/lnav.err \
    -c ';SELECT filepath, lines FROM lnav_file'

export HOME="./piper-config"
rm -rf ./piper-config
mkdir -p $HOME/.lnav

${lnav_test} -Nn -c ':config /tuning/piper/max-size 128'

cat ${test_dir}/logfile_haproxy.0 | run_cap_test \
    env TEST_COMMENT="stdin rotation" ${lnav_test} -n

export HOME="./mgmt-config"
rm -rf ./mgmt-config
mkdir -p $HOME/.lnav
run_cap_test ${lnav_test} -m -I ${test_dir} config get

run_cap_test ${lnav_test} -m -I ${test_dir} config blame

export TMPDIR="piper-tmp"
rm -rf ./piper-tmp
mkdir piper-tmp
run_cap_test ${lnav_test} -n -e 'echo hi'

run_cap_test ${lnav_test} -m piper list

PIPER_URL=$(env NO_COLOR=1 ${lnav_test} -m -q piper list | tail -1 | sed -r -e 's;.*(piper://[^ ]+).*;\1;g')

run_cap_test ${lnav_test} -n $PIPER_URL

run_cap_test ${lnav_test} -n $PIPER_URL \
    -c ";SELECT filepath, descriptor, mimetype, jget(content, '/ctime') as ctime, jget(content, '/cwd') as cwd FROM lnav_file_metadata" \
    -c ':write-json-to -'

run_cap_test ${lnav_test} -m \
    format access_log test non-existent

run_cap_test ${lnav_test} -m \
    format access_log test /tmp

run_cap_test ${lnav_test} -m \
    format access_log test ${test_dir}/logfile_access_log.0

run_cap_test ${lnav_test} -m \
    format access_log test ${test_dir}/logfile_syslog.0

run_cap_test ${lnav_test} -m \
    -I ${test_dir} \
    format test_log test ${test_dir}/logfile_json.json

run_cap_test ${lnav_test} -m \
    -I ${test_dir} \
    format test_log test ${test_dir}/logfile_syslog.0