File: process.test

package info (click to toggle)
zeekctl 2.2.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,544 kB
  • sloc: python: 5,639; sh: 1,374; makefile: 71; awk: 24
file content (49 lines) | stat: -rw-r--r-- 1,854 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
# Test that the process command can run zeek on the specified trace file,
# with or without extra Zeek options or Zeek scripts.
#
# @TEST-EXEC: bash %INPUT
# @TEST-EXEC: TEST_DIFF_CANONIFIER=$SCRIPTS/diff-remove-abspath btest-diff out

. zeekctl-test-setup

touch $ZEEKCTL_INSTALL_PREFIX/share/zeek/site/test123.zeek
touch $ZEEKCTL_INSTALL_PREFIX/share/zeek/site/test456.zeek
touch $ZEEKCTL_INSTALL_PREFIX/share/zeek/site/test789.zeek

zeekctl install

test ! -e $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testing

#####################
# run without any extra zeek options
zeekctl process $TRACES/dns-session.trace > orig-out

# silence deprecation warning that will eventually be resolved in zeek scripts
grep -v rotate_file_by_name orig-out > out

# verify that tmp work directory was created
test -d $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testing

#####################
# run with extra zeek options (but no extra zeek scripts)
zeekctl process $TRACES/dns-session.trace -p test

# verify that specified zeek options are at the start of the Zeek command-line
grep "^-p test " $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testing/.cmdline

#####################
# run with extra zeek scripts (but no zeek options)
zeekctl process $TRACES/dns-session.trace -- test123.zeek test456.zeek

# verify that specified zeek scripts are at the end of the Zeek command-line
grep "test123.zeek test456.zeek$" $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testing/.cmdline

#####################
# run with extra zeek options and scripts
zeekctl process $TRACES/dns-session.trace -p opt2 -- test789.zeek

# verify that specified zeek options are at the start of the Zeek command-line
grep "^-p opt2 " $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testing/.cmdline

# verify that specified zeek scripts are at the end of the Zeek command-line
grep "test789.zeek$" $ZEEKCTL_INSTALL_PREFIX/spool/tmp/testing/.cmdline