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 | # special note: for Cento5 machines that is tightly coupled with |
---|
13 | # python 2.4, need to sed out the invocation python to python2.6 |
---|
14 | # (the required version) with |
---|
15 | # find . -type f -print | xargs sed -i 's/env python$/env python2.6/' |
---|
16 | |
---|
17 | include abac.mk |
---|
18 | |
---|
19 | MY_SH_ENV = env $(ABAC_BUILD_CREDDY_VAL) $(ABAC_BUILD_PROVER_VAL) |
---|
20 | MY_PY_ENV = env $(ABAC_BUILD_PROVER_VAL) $(ABAC_BUILD_PYTHON_VAL) |
---|
21 | MY_PL_ENV = env $(ABAC_BUILD_PERL_VAL) |
---|
22 | |
---|
23 | DIRECTORY = example_scripts python_tests scaling_tests \ |
---|
24 | creddy_tests creddy_prover_tests attr_tests |
---|
25 | |
---|
26 | SUBDIRS = $(DIRECTORY) |
---|
27 | |
---|
28 | .PHONY: tests tests_with_install clean clean-local check_sh_env check_py_env |
---|
29 | all: tests |
---|
30 | |
---|
31 | tests: |
---|
32 | @for i in $(DIRECTORY); do \ |
---|
33 | here=`pwd`; \ |
---|
34 | export RUN_WITH_BUILD=1; \ |
---|
35 | export TESTDIR=$(abs_top_builddir)/tests; \ |
---|
36 | export MY_ENV="$(MY_BUILD_ENV)"; \ |
---|
37 | export MY_LDFLAGS_VAL="$(ABAC_BUILD_LDFLAGS_VAL)"; \ |
---|
38 | export MY_INCLUDES_VAL="$(ABAC_BUILD_INCLUDES_VAL)"; \ |
---|
39 | cd $$i; \ |
---|
40 | make -i -s runcheck | tee -a $$here/result; \ |
---|
41 | cd $$here; \ |
---|
42 | done |
---|
43 | |
---|
44 | tests_with_install: |
---|
45 | @touch result |
---|
46 | @for i in $(DIRECTORY); do \ |
---|
47 | export TESTDIR=$(abs_top_builddir)/tests; \ |
---|
48 | export MY_ENV="$(MY_INSTALL_ENV)"; \ |
---|
49 | export MY_LDFLAGS_VAL="$(ABAC_INSTALL_LDFLAGS_VAL)"; \ |
---|
50 | export MY_INCLUDES_VAL="$(ABAC_INSTALL_INCLUDES_VAL)"; \ |
---|
51 | here=`pwd`; \ |
---|
52 | cd $$i; \ |
---|
53 | make -i -s runcheck | tee -a $$here/result; \ |
---|
54 | cd $$here; \ |
---|
55 | done |
---|
56 | |
---|
57 | |
---|
58 | check_sh_env: |
---|
59 | @rc=`$(MY_SH_ENV) ./test_util.sh`; \ |
---|
60 | if [ $$? -eq 0 ]; then \ |
---|
61 | echo "sh_env, okay"; \ |
---|
62 | else \ |
---|
63 | echo "sh_env, not okay"; \ |
---|
64 | echo "perhap you did not configure&build libabac's c api??"; \ |
---|
65 | fi |
---|
66 | |
---|
67 | check_py_env: |
---|
68 | @rc=`$(MY_PY_ENV) ./test_util.py`; \ |
---|
69 | if [ $$? -eq 0 ]; then \ |
---|
70 | echo "py_env, okay"; \ |
---|
71 | else \ |
---|
72 | echo "py_env, not okay"; \ |
---|
73 | echo "perhap you did not configure&build libabac's swig/python api??"; \ |
---|
74 | fi |
---|
75 | |
---|
76 | check_pl_env: |
---|
77 | @rc=`$(MY_PL_ENV) ./test_util.pl`; \ |
---|
78 | if [ $$? -eq 0 ]; then \ |
---|
79 | echo "pl_env, okay"; \ |
---|
80 | else \ |
---|
81 | echo "pl_env, not okay"; \ |
---|
82 | echo "perhap you did not configure&build libabac's swig/perl api??"; \ |
---|
83 | fi |
---|
84 | |
---|
85 | |
---|
86 | clean: |
---|
87 | @export TESTDIR=$(abs_top_builddir)/tests; \ |
---|
88 | for i in $(DIRECTORY); do \ |
---|
89 | here=`pwd`; \ |
---|
90 | cd $$i; \ |
---|
91 | make -s clean; \ |
---|
92 | cd $$here; \ |
---|
93 | done |
---|
94 | rm -rf result |
---|
95 | rm -rf test_util.pyc |
---|
96 | |
---|
97 | clean-local: |
---|
98 | rm -rf result |
---|
99 | rm -rf test_util.pyc |
---|