1 | |
---|
2 | # |
---|
3 | # tests directory for libabac |
---|
4 | # |
---|
5 | # default, executable/lib are accessed from build directory but |
---|
6 | # in case where rpm/debian binary packages were used, only access |
---|
7 | # to install directory is available.. |
---|
8 | # In that case, the call, |
---|
9 | # make tests_with_install |
---|
10 | # will force the testing to be run with install directory |
---|
11 | # |
---|
12 | |
---|
13 | include abac.mk |
---|
14 | |
---|
15 | MY_SH_ENV = env $(ABAC_BUILD_CREDDY_VAL) $(ABAC_BUILD_PROVER_VAL) |
---|
16 | MY_PY_ENV = env $(ABAC_BUILD_PROVER_VAL) $(ABAC_BUILD_PYTHON_VAL) |
---|
17 | MY_PL_ENV = env $(ABAC_BUILD_PERL_VAL) |
---|
18 | |
---|
19 | DIRECTORY = example_scripts python_tests scaling_tests \ |
---|
20 | creddy_tests creddy_prover_tests attr_tests |
---|
21 | |
---|
22 | SUBDIRS = $(DIRECTORY) |
---|
23 | |
---|
24 | .PHONY: tests tests_with_install clean clean-local check_sh_env check_py_env |
---|
25 | all: tests |
---|
26 | |
---|
27 | tests: |
---|
28 | @for i in $(DIRECTORY); do \ |
---|
29 | here=`pwd`; \ |
---|
30 | export RUN_WITH_BUILD=1; \ |
---|
31 | export TESTDIR=$(abs_top_builddir)/tests; \ |
---|
32 | export MY_ENV="$(MY_BUILD_ENV)"; \ |
---|
33 | export MY_LDFLAGS_VAL="$(ABAC_BUILD_LDFLAGS_VAL)"; \ |
---|
34 | export MY_INCLUDES_VAL="$(ABAC_BUILD_INCLUDES_VAL)"; \ |
---|
35 | cd $$i; \ |
---|
36 | make -s runcheck | tee -a $$here/result; \ |
---|
37 | cd $$here; \ |
---|
38 | done |
---|
39 | |
---|
40 | tests_with_install: |
---|
41 | @touch result |
---|
42 | @for i in $(DIRECTORY); do \ |
---|
43 | export TESTDIR=$(abs_top_builddir)/tests; \ |
---|
44 | export MY_ENV="$(MY_INSTALL_ENV)"; \ |
---|
45 | export MY_LDFLAGS_VAL="$(ABAC_INSTALL_LDFLAGS_VAL)"; \ |
---|
46 | export MY_INCLUDES_VAL="$(ABAC_INSTALL_INCLUDES_VAL)"; \ |
---|
47 | here=`pwd`; \ |
---|
48 | cd $$i; \ |
---|
49 | make -s runcheck | tee -a $$here/result; \ |
---|
50 | cd $$here; \ |
---|
51 | done |
---|
52 | |
---|
53 | |
---|
54 | check_sh_env: |
---|
55 | @rc=`$(MY_SH_ENV) ./test_util.sh`; \ |
---|
56 | if [ $$? -eq 0 ]; then \ |
---|
57 | echo "sh_env, okay"; \ |
---|
58 | else \ |
---|
59 | echo "sh_env, not okay"; \ |
---|
60 | echo "perhap you did not configure&build libabac's c api??"; \ |
---|
61 | fi |
---|
62 | |
---|
63 | check_py_env: |
---|
64 | @rc=`$(MY_PY_ENV) ./test_util.py`; \ |
---|
65 | if [ $$? -eq 0 ]; then \ |
---|
66 | echo "py_env, okay"; \ |
---|
67 | else \ |
---|
68 | echo "py_env, not okay"; \ |
---|
69 | echo "perhap you did not configure&build libabac's swig/python api??"; \ |
---|
70 | fi |
---|
71 | |
---|
72 | check_pl_env: |
---|
73 | @rc=`$(MY_PL_ENV) ./test_util.pl`; \ |
---|
74 | if [ $$? -eq 0 ]; then \ |
---|
75 | echo "pl_env, okay"; \ |
---|
76 | else \ |
---|
77 | echo "pl_env, not okay"; \ |
---|
78 | echo "perhap you did not configure&build libabac's swig/perl api??"; \ |
---|
79 | fi |
---|
80 | |
---|
81 | |
---|
82 | clean: |
---|
83 | @export TESTDIR=$(abs_top_builddir)/tests; \ |
---|
84 | for i in $(DIRECTORY); do \ |
---|
85 | here=`pwd`; \ |
---|
86 | cd $$i; \ |
---|
87 | make -s clean; \ |
---|
88 | cd $$here; \ |
---|
89 | done |
---|
90 | rm -rf result |
---|
91 | rm -rf test_util.pyc |
---|
92 | |
---|
93 | clean-local: |
---|
94 | rm -rf result |
---|
95 | rm -rf test_util.pyc |
---|