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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
#! /bin/bash
export YES_COLOR=1
unset XDG_CONFIG_HOME
run_test ${lnav_test} -n \
-c ";SELECT view_name,basename(filepath),visible FROM lnav_view_files" \
-c ":write-csv-to -" \
${test_dir}/logfile_access_log.*
check_output "lnav_view_files does not work?" <<EOF
view_name,basename(filepath),visible
log,logfile_access_log.0,1
log,logfile_access_log.1,1
EOF
run_cap_test ${lnav_test} -n \
-c ";UPDATE lnav_view_files SET visible=0 WHERE endswith(filepath, 'log.0')" \
${test_dir}/logfile_access_log.*
run_test ${lnav_test} -n \
-c ";DELETE FROM lnav_view_stack" \
${test_dir}/logfile_access_log.0
check_output "deleting the view stack does not work?" <<EOF
EOF
run_cap_test ${lnav_test} -n \
-c ";UPDATE lnav_view_stack SET name = 'foo'" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_stack VALUES ('help')" \
-c ";DELETE FROM lnav_view_stack WHERE name = 'log'" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters VALUES ('log', 0, 1, 'out', 'regex', '')" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters VALUES ('log', 0, 1, 'out', 'regex', 'abc(')" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters VALUES ('bad', 0, 1, 'out', 'regex', 'abc')" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters VALUES (NULL, 0, 1, 'out', 'regex', 'abc')" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters VALUES ('log', 0 , 1, 'bad', 'regex', 'abc')" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters (view_name, pattern) VALUES ('log', 'vmk')" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters (view_name, pattern, type) VALUES ('log', 'vmk', 'in')" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters (view_name, pattern, type) VALUES ('log', 'vmk', 'in')" \
-c ";INSERT INTO lnav_view_filters (view_name, pattern, type) VALUES ('log', 'vmk', 'in')" \
-c ';SELECT * FROM lnav_view_filters' \
-c ':write-screen-to -' \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters (view_name, pattern, type) VALUES ('log', 'vmk', 'in')" \
-c ";INSERT INTO lnav_view_filters (view_name, pattern, type) VALUES ('log', 'vmk1', 'in')" \
-c ";UPDATE lnav_view_filters SET pattern = 'vmk'" \
-c ';SELECT * FROM lnav_view_filters' \
-c ':write-screen-to -' \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters (view_name, language, pattern) VALUES ('log', 'sql', '1')" \
-c ";INSERT INTO lnav_view_filters (view_name, language, pattern) VALUES ('log', 'sql', '1')" \
-c ';SELECT * FROM lnav_view_filters' \
-c ':write-screen-to -' \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ":filter-out vmk" \
-c ";DELETE FROM lnav_view_filters" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ":filter-out vmk" \
-c ";UPDATE lnav_view_filters SET pattern = 'vmkboot'" \
${test_dir}/logfile_access_log.0
run_test ${lnav_test} -n \
-c ":filter-out vmk" \
-c ";SELECT * FROM lnav_view_filter_stats" \
-c ":write-csv-to -" \
${test_dir}/logfile_access_log.0
check_output "view filter stats is not working?" <<EOF
view_name,filter_id,hits
log,1,2
EOF
run_test ${lnav_test} -n \
-c ";INSERT INTO lnav_view_filters (view_name, language, pattern) VALUES ('log', 'sql', ':sc_bytes = 134')" \
${test_dir}/logfile_access_log.0
check_output "inserted filter-out 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"
EOF
run_test ${lnav_test} -n \
-c ';DELETE FROM lnav_views' \
-c ';SELECT count(*) FROM lnav_views' \
-c ':write-csv-to -' \
${test_dir}/logfile_access_log.0
check_output "delete from lnav_views table works?" <<EOF
count(*)
8
EOF
run_test ${lnav_test} -n \
-c ";INSERT INTO lnav_views (name) VALUES ('foo')" \
-c ';SELECT count(*) FROM lnav_views' \
-c ':write-csv-to -' \
${test_dir}/logfile_access_log.0
check_output "insert into lnav_views table works?" <<EOF
count(*)
8
EOF
run_cap_test ${lnav_test} -n \
-c ";UPDATE lnav_views SET top = 1 WHERE name = 'log'" \
${test_dir}/logfile_access_log.0
run_test ${lnav_test} -n \
-c ";UPDATE lnav_views SET top = inner_height - 1 WHERE name = 'log'" \
${test_dir}/logfile_access_log.0
check_output "updating lnav_views.top using inner_height does 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"
EOF
run_cap_test ${lnav_test} -n \
-c ";UPDATE lnav_views SET top_time = 'bad-time' WHERE name = 'log'" \
${test_dir}/logfile_access_log.0
run_cap_test ${lnav_test} -n \
-c ";UPDATE lnav_views SET top_time = '2014-10-08T00:00:00' WHERE name = 'log'" \
${test_dir}/logfile_generic.0
run_cap_test ${lnav_test} -n \
-c ";UPDATE lnav_views SET search = 'warn' WHERE name = 'log'" \
-c ";SELECT search FROM lnav_views WHERE name = 'log'" \
${test_dir}/logfile_generic.0
run_cap_test ${lnav_test} -n \
-c ";UPDATE lnav_views SET search = 'warn' WHERE name = 'log'" \
-c ":goto 0" \
-c ":next-mark search" \
${test_dir}/logfile_generic.0
run_cap_test ${lnav_test} -n \
-c ";UPDATE lnav_views SET top_meta = json_object('anchor', '#build') WHERE name = 'text'" \
${top_srcdir}/README.md
|