Page MenuHomeFreeBSD

D15751.id43574.diff
No OneTemporary

D15751.id43574.diff

Index: etc/mtree/BSD.tests.dist
===================================================================
--- etc/mtree/BSD.tests.dist
+++ etc/mtree/BSD.tests.dist
@@ -1028,6 +1028,8 @@
..
nmtree
..
+ praudit
+ ..
pw
..
rpcbind
Index: usr.sbin/praudit/Makefile
===================================================================
--- usr.sbin/praudit/Makefile
+++ usr.sbin/praudit/Makefile
@@ -14,4 +14,7 @@
LIBADD= bsm
+HAS_TESTS=
+SUBDIR.${MK_TESTS}+= tests
+
.include <bsd.prog.mk>
Index: usr.sbin/praudit/tests/Makefile
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+PACKAGE= tests
+
+TESTSDIR= ${TESTSBASE}/usr.sbin/praudit
+
+ATF_TESTS_SH= praudit_test
+
+${PACKAGE}FILES+= \
+ input/trail \
+ input/del_comma \
+ input/del_underscore \
+ input/no_args \
+ input/numeric_form \
+ input/raw_form \
+ input/same_line \
+ input/short_form \
+ input/xml_form \
+
+.include <bsd.test.mk>
Index: usr.sbin/praudit/tests/input/del_comma
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/input/del_comma
@@ -0,0 +1,4 @@
+header,56,11,audit startup,0,Sun Jun 10 16:46:47 2018, + 241 msec
+text,auditd::Audit startup
+return,success,0
+trailer,56
Index: usr.sbin/praudit/tests/input/del_underscore
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/input/del_underscore
@@ -0,0 +1,4 @@
+header_56_11_audit startup_0_Sun Jun 10 16:46:47 2018_ + 241 msec
+text_auditd::Audit startup
+return_success_0
+trailer_56
Index: usr.sbin/praudit/tests/input/no_args
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/input/no_args
@@ -0,0 +1,4 @@
+header,56,11,audit startup,0,Sun Jun 10 16:46:47 2018, + 241 msec
+text,auditd::Audit startup
+return,success,0
+trailer,56
Index: usr.sbin/praudit/tests/input/numeric_form
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/input/numeric_form
@@ -0,0 +1,4 @@
+header,56,11,audit startup,0,Sun Jun 10 16:46:47 2018, + 241 msec
+text,auditd::Audit startup
+return,success,0
+trailer,56
Index: usr.sbin/praudit/tests/input/raw_form
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/input/raw_form
@@ -0,0 +1,4 @@
+20,56,11,45000,0,1528649207,241
+40,auditd::Audit startup
+39,0,0
+19,56
Index: usr.sbin/praudit/tests/input/same_line
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/input/same_line
@@ -0,0 +1 @@
+header,56,11,audit startup,0,Sun Jun 10 16:46:47 2018, + 241 msec,text,auditd::Audit startup,return,success,0,trailer,56,
Index: usr.sbin/praudit/tests/input/short_form
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/input/short_form
@@ -0,0 +1,4 @@
+header,56,11,AUE_audit_startup,0,Sun Jun 10 16:46:47 2018, + 241 msec
+text,auditd::Audit startup
+return,success,0
+trailer,56
Index: usr.sbin/praudit/tests/input/xml_form
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/input/xml_form
@@ -0,0 +1,9 @@
+<?xml version='1.0' ?>
+<audit>
+<record version="11" event="audit startup" modifier="0" time="Sun Jun 10 16:46:47 2018" msec=" + 241 msec" >
+<text>auditd::Audit startup</text>
+<return errval="success" retval="0" />
+</record>
+<?xml version='1.0' ?>
+<audit>
+</audit>
Index: usr.sbin/praudit/tests/praudit_test.sh
===================================================================
--- /dev/null
+++ usr.sbin/praudit/tests/praudit_test.sh
@@ -0,0 +1,68 @@
+#
+# Copyright (c) 2018 Aniket Pandey
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# $FreeBSD$
+#
+
+
+atf_test_case praudit
+praudit_body()
+{
+ # Check that comma delimiter is present with -d "," cmd
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/del_comma \
+ praudit -d "," $(atf_get_srcdir)/trail
+
+ # Check that underscore delimiter is present with -d "_" cmd
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/del_underscore \
+ praudit -d "_" $(atf_get_srcdir)/trail
+
+ # Check that praudit outputs default form without arguments
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/no_args \
+ praudit $(atf_get_srcdir)/trail
+
+ # Check that praudit outputs the numeric form with "-n" flag
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/numeric_form \
+ praudit -n $(atf_get_srcdir)/trail
+
+ # Check that praudit outputs the raw form with "-r" flag
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/raw_form \
+ praudit -r $(atf_get_srcdir)/trail
+
+ # Check that praudit outputs the trail in same line with "-l" flag
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/same_line \
+ praudit -l $(atf_get_srcdir)/trail
+
+ # Check that praudit outputs the short form with "-s" flag
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/short_form \
+ praudit -s $(atf_get_srcdir)/trail
+
+ # Check that praudit outputs the XML file with "-x" flag
+ atf_check -s exit:1 -o file:$(atf_get_srcdir)/xml_form \
+ praudit -x $(atf_get_srcdir)/trail
+}
+
+atf_init_test_cases()
+{
+ atf_add_test_case praudit
+}

File Metadata

Mime Type
text/plain
Expires
Wed, Oct 22, 4:06 PM (2 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24059979
Default Alt Text
D15751.id43574.diff (6 KB)

Event Timeline