aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/audit/auparse/test/Makefile.am
blob: 197935084699baf8aed1671381e11dc907a0b359 (plain)
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
# Makefile.am -- 
# Copyright 2006-08,2014-15 Red Hat Inc., Durham, North Carolina.
# All Rights Reserved.
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version.
# 
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.
# 
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
# 
# Authors:
#   Steve Grubb <sgrubb@redhat.com>
#

CONFIG_CLEAN_FILES = *.loT *.rej *.orig *.cur
AUTOMAKE_OPTIONS = no-dependencies
check_PROGRAMS = auparse_test 
dist_check_SCRIPTS = auparse_test.py
EXTRA_DIST = auparse_test.ref auparse_test.ref.py test.log test2.log

AM_CPPFLAGS = -I${top_srcdir}/auparse -I${top_srcdir}/lib

auparse_test_SOURCES = auparse_test.c
auparse_test_LDFLAGS = -static
auparse_test_LDADD = ${top_builddir}/auparse/libauparse.la \
	${top_builddir}/lib/libaudit.la

drop_srcdir = sed 's,$(srcdir)/test,test,'

check: auparse_test
	test "$(top_srcdir)" = "$(top_builddir)" || \
			cp $(top_srcdir)/auparse/test/test*.log .
	LC_ALL=C \
	./auparse_test > auparse_test.cur
	diff -u $(top_srcdir)/auparse/test/auparse_test.ref auparse_test.cur
if HAVE_PYTHON
	cp ${top_builddir}/bindings/swig/python/.libs/_audit.so ${top_builddir}/bindings/swig/python
	PYTHONPATH=${top_builddir}/bindings/python/python2/.libs/:${top_builddir}/bindings/swig/python:${top_builddir}/bindings/swig/python/.libs \
	LD_LIBRARY_PATH=${top_builddir}/auparse/.libs \
		srcdir=$(srcdir) $(srcdir)/auparse_test.py \
		| $(drop_srcdir) > auparse_test.cur
	diff -u $(top_srcdir)/auparse/test/auparse_test.ref.py auparse_test.cur
endif
	echo -e "===================\nAuparse Test Passes\n==================="

diffcheck: auparse_test
	./auparse_test > auparse_test.cur
	diff -u $(srcdir)/auparse_test.ref auparse_test.cur

memcheck: auparse_test
	valgrind --leak-check=yes --show-reachable=yes ./auparse_test 

pycheck: auparse_test.py
if HAVE_PYTHON
	PYTHONPATH=${top_builddir}/bindings/python/python2/.libs/:${top_builddir}/bindings/swig/python:${top_builddir}/bindings/swig/python/.libs \
	LD_LIBRARY_PATH=${top_builddir}/auparse/.libs \
		srcdir=$(srcdir) $(srcdir)/auparse_test.py
endif

pydiffcheck: auparse_test.py 
if HAVE_PYTHON
	PYTHONPATH=${top_builddir}/bindings/python/python2/.libs/:${top_builddir}/bindings/swig/python:${top_builddir}/bindings/swig/python/.libs \
	LD_LIBRARY_PATH=${top_builddir}/auparse/.libs \
		srcdir=$(srcdir) $(srcdir)/auparse_test.py \
		| $(drop_srcdir) > auparse_test.cur
	diff $(srcdir)/auparse_test.ref auparse_test.cur
endif

pymemcheck: auparse_test.py
if HAVE_PYTHON
	PYTHONPATH=${top_builddir}/bindings/python/python2/.libs/:${top_builddir}/bindings/swig/python:${top_builddir}/bindings/swig/python/.libs \
	LD_LIBRARY_PATH=${top_builddir}/auparse/.libs srcdir=$(srcdir) valgrind --leak-check=yes --show-reachable=yes python $(srcdir)/auparse_test.py

${top_builddir}/bindings/python/build/*/auparse.so: ${top_srcdir}/bindings/python/auparse_python.c
	cd ${top_builddir}/bindings/python && make
endif

clean-generic:
	$(RM) *.cur
if HAVE_PYTHON
	$(RM) ${top_builddir}/bindings/swig/python/_audit.so
endif
	test "$(top_srcdir)" = "$(top_builddir)" || $(RM) test*.log