2 # Copyright (c) 2018 Aniket Pandey
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
7 # 1. Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer.
9 # 2. Redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution.
13 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 atf_test_case praudit_delim_comma
30 praudit_delim_comma_head()
32 atf_set "descr" "Verify that comma delimiter is present with -d ',' cmd"
35 praudit_delim_comma_body()
37 atf_check -o file:$(atf_get_srcdir)/del_comma \
38 praudit -d "," $(atf_get_srcdir)/trail
42 atf_test_case praudit_delim_underscore
43 praudit_delim_underscore_head()
45 atf_set "descr" "Verify that underscore delimiter is present with -d _"
48 praudit_delim_underscore_body()
50 atf_check -o file:$(atf_get_srcdir)/del_underscore \
51 praudit -d "_" $(atf_get_srcdir)/trail
55 atf_test_case praudit_no_args
56 praudit_no_args_head()
58 atf_set "descr" "Verify that praudit outputs default form without " \
62 praudit_no_args_body()
64 atf_check -o file:$(atf_get_srcdir)/no_args \
65 praudit $(atf_get_srcdir)/trail
69 atf_test_case praudit_numeric_form
70 praudit_numeric_form_head()
72 atf_set "descr" "Verify that praudit outputs the numeric form " \
76 praudit_numeric_form_body()
78 atf_check -o file:$(atf_get_srcdir)/numeric_form \
79 praudit -n $(atf_get_srcdir)/trail
83 atf_test_case praudit_raw_form
84 praudit_raw_form_head()
86 atf_set "descr" "Verify that praudit outputs the raw form with -r flag"
89 praudit_raw_form_body()
91 atf_check -o file:$(atf_get_srcdir)/raw_form \
92 praudit -r $(atf_get_srcdir)/trail
96 atf_test_case praudit_same_line
97 praudit_same_line_head()
99 atf_set "descr" "Verify that praudit outputs the trail in the same " \
103 praudit_same_line_body()
105 atf_check -o file:$(atf_get_srcdir)/same_line \
106 praudit -l $(atf_get_srcdir)/trail
110 atf_test_case praudit_short_form
111 praudit_short_form_head()
113 atf_set "descr" "Verify that praudit outputs the short form " \
117 praudit_short_form_body()
119 atf_check -o file:$(atf_get_srcdir)/short_form \
120 praudit -s $(atf_get_srcdir)/trail
124 atf_test_case praudit_xml_form
125 praudit_xml_form_head()
127 atf_set "descr" "Verify that praudit outputs the XML file with -x flag"
130 praudit_xml_form_body()
132 atf_check -o file:$(atf_get_srcdir)/xml_form \
133 praudit -x $(atf_get_srcdir)/trail
137 atf_test_case praudit_sync_to_next_record
138 praudit_sync_to_next_record_head()
140 atf_set "descr" "Verify that praudit(1) outputs the last few audit " \
141 "records when the initial part of the trail is " \
145 praudit_sync_to_next_record_body()
147 # The 'corrupted' binary file contains some redundant
148 # binary symbols before the actual audit record.
149 # Since 'praudit -p' syncs to the next legitimate record,
150 # it would skip the corrupted part and print the desired
151 # audit record to STDOUT.
152 atf_check -o file:$(atf_get_srcdir)/no_args \
153 praudit -p $(atf_get_srcdir)/corrupted
157 atf_test_case praudit_raw_short_exclusive
158 praudit_raw_short_exclusive_head()
160 atf_set "descr" "Verify that praudit outputs usage message on stderr " \
161 "when both raw and short options are specified"
164 praudit_raw_short_exclusive_body()
166 atf_check -s exit:1 -e match:"usage: praudit" \
167 praudit -rs $(atf_get_srcdir)/trail
171 atf_init_test_cases()
173 atf_add_test_case praudit_delim_comma
174 atf_add_test_case praudit_delim_underscore
175 atf_add_test_case praudit_no_args
176 atf_add_test_case praudit_numeric_form
177 atf_add_test_case praudit_raw_form
178 atf_add_test_case praudit_same_line
179 atf_add_test_case praudit_short_form
180 atf_add_test_case praudit_xml_form
181 atf_add_test_case praudit_sync_to_next_record
182 atf_add_test_case praudit_raw_short_exclusive