diff options
Diffstat (limited to 'recipes-security/libseccomp/files/0001-tests-create-install-tests-target.patch')
| -rw-r--r-- | recipes-security/libseccomp/files/0001-tests-create-install-tests-target.patch | 203 |
1 files changed, 0 insertions, 203 deletions
diff --git a/recipes-security/libseccomp/files/0001-tests-create-install-tests-target.patch b/recipes-security/libseccomp/files/0001-tests-create-install-tests-target.patch deleted file mode 100644 index 55eaf81..0000000 --- a/recipes-security/libseccomp/files/0001-tests-create-install-tests-target.patch +++ /dev/null | |||
| @@ -1,203 +0,0 @@ | |||
| 1 | From e8e166cdc1fc31e02d568424e17b9f9fc1e95256 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Joe MacDonald <joe@deserted.net> | ||
| 3 | Date: Mon, 28 Oct 2013 15:40:14 -0400 | ||
| 4 | Subject: [PATCH 1/3] tests: create install-tests target | ||
| 5 | |||
| 6 | It can be useful, in particular on a cross-build setup, to install the | ||
| 7 | tests and regression suite in addition to the library itself. Since most | ||
| 8 | people probably don't want that by default, though, create an | ||
| 9 | install-tests target that will place tests and regression script in | ||
| 10 | $(INSTALL_LIB_DIR)/libseccomp/tests and install the necessary tools in | ||
| 11 | $(INSTALL_BIN_DIR)/bin. | ||
| 12 | |||
| 13 | Upstream-Status: Submitted [http://www.mail-archive.com/libseccomp-discuss@lists.sourceforge.net/msg00470.html] | ||
| 14 | |||
| 15 | Signed-off-by: Joe MacDonald <joe@deserted.net> | ||
| 16 | --- | ||
| 17 | Makefile | 9 +++++++++ | ||
| 18 | README | 8 ++++++++ | ||
| 19 | install.mk | 1 + | ||
| 20 | macros.mk | 18 ++++++++++++++++++ | ||
| 21 | tests/Makefile | 7 ++++++- | ||
| 22 | tests/regression | 19 ++++++++++++++++--- | ||
| 23 | tools/Makefile | 3 +++ | ||
| 24 | 7 files changed, 61 insertions(+), 4 deletions(-) | ||
| 25 | |||
| 26 | diff --git a/Makefile b/Makefile | ||
| 27 | index 1f61f20..8cb0a16 100644 | ||
| 28 | --- a/Makefile | ||
| 29 | +++ b/Makefile | ||
| 30 | @@ -40,6 +40,7 @@ include install.mk | ||
| 31 | CONFIGS = configure.mk configure.h version_info.mk libseccomp.pc | ||
| 32 | SUBDIRS_BUILD = include src tests tools | ||
| 33 | SUBDIRS_INSTALL = include src tools doc | ||
| 34 | +SUBDIRS_INSTALL_TEST = tools tests | ||
| 35 | |||
| 36 | .PHONY: tarball install check check-syntax ctags cstags clean dist-clean \ | ||
| 37 | $(SUBDIRS_BUILD) | ||
| 38 | @@ -106,6 +107,14 @@ check: tools tests | ||
| 39 | check-syntax: | ||
| 40 | @./tools/check-syntax | ||
| 41 | |||
| 42 | +install-tests: $(SUBDIRS_INSTALL_TEST) | ||
| 43 | + @$(ECHO_INFO) "installing tests in $(INSTALL_PREFIX) ..." | ||
| 44 | + $(ECHO_INFO) "installing from $$dir/" | ||
| 45 | + @for dir in $(SUBDIRS_INSTALL_TEST); do \ | ||
| 46 | + $(ECHO_INFO) "installing from $$dir/"; \ | ||
| 47 | + $(MAKE) -C $$dir install-tests; \ | ||
| 48 | + done | ||
| 49 | + | ||
| 50 | ctags: | ||
| 51 | @$(ECHO_INFO) "generating ctags for the project ..." | ||
| 52 | @ctags -R * | ||
| 53 | diff --git a/README b/README | ||
| 54 | index 37b9709..14ae254 100644 | ||
| 55 | --- a/README | ||
| 56 | +++ b/README | ||
| 57 | @@ -41,6 +41,14 @@ to run all of the tests you can simply run the script: | ||
| 58 | However, the script takes a number of options to customize its execution; the | ||
| 59 | options can be displayed by running "./regression -h". | ||
| 60 | |||
| 61 | +It is also possible to install the tests and regression script to the system by | ||
| 62 | +issuing: | ||
| 63 | + | ||
| 64 | + # make install-tests | ||
| 65 | + | ||
| 66 | +When complete, installed tests and regression script may be found in | ||
| 67 | +$LIBDIR/lib/libseccomp/test | ||
| 68 | + | ||
| 69 | * Other Useful Tools | ||
| 70 | |||
| 71 | The "tools/" directory includes a number of tools which may be helpful in the | ||
| 72 | diff --git a/install.mk b/install.mk | ||
| 73 | index 123af33..f6aa311 100644 | ||
| 74 | --- a/install.mk | ||
| 75 | +++ b/install.mk | ||
| 76 | @@ -24,6 +24,7 @@ INSTALL_PREFIX ?= $(CONF_INSTALL_PREFIX) | ||
| 77 | INSTALL_SBIN_DIR ?= $(DESTDIR)/$(INSTALL_PREFIX)/sbin | ||
| 78 | INSTALL_BIN_DIR ?= $(DESTDIR)/$(INSTALL_PREFIX)/bin | ||
| 79 | INSTALL_LIB_DIR ?= $(DESTDIR)/$(CONF_INSTALL_LIBDIR) | ||
| 80 | +INSTALL_TEST_DIR ?= $(DESTDIR)/$(CONF_INSTALL_LIBDIR)/libseccomp/tests | ||
| 81 | INSTALL_INC_DIR ?= $(DESTDIR)/$(INSTALL_PREFIX)/include | ||
| 82 | INSTALL_MAN_DIR ?= $(DESTDIR)/$(INSTALL_PREFIX)/share/man | ||
| 83 | |||
| 84 | diff --git a/macros.mk b/macros.mk | ||
| 85 | index 6df5b3a..e7c196d 100644 | ||
| 86 | --- a/macros.mk | ||
| 87 | +++ b/macros.mk | ||
| 88 | @@ -206,6 +206,24 @@ INSTALL_INC_MACRO += \ | ||
| 89 | $^ "$(INSTALL_INC_DIR)"; | ||
| 90 | |||
| 91 | ifeq ($(V),0) | ||
| 92 | + INSTALL_TEST_MACRO = @echo " INSTALL $^ ($(INSTALL_TEST_DIR))"; | ||
| 93 | +endif | ||
| 94 | +INSTALL_TEST_MACRO += \ | ||
| 95 | + $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \ | ||
| 96 | + -d "$(INSTALL_TEST_DIR)"; \ | ||
| 97 | + $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0755 \ | ||
| 98 | + $^ "$(INSTALL_TEST_DIR)"; | ||
| 99 | + | ||
| 100 | +ifeq ($(V),0) | ||
| 101 | + INSTALL_REGRESSION_TEST_MACRO = @echo " INSTALL regression ($(INSTALL_TEST_DIR))"; | ||
| 102 | +endif | ||
| 103 | +INSTALL_REGRESSION_TEST_MACRO += \ | ||
| 104 | + $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \ | ||
| 105 | + -d "$(INSTALL_TEST_DIR)"; \ | ||
| 106 | + $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0755 \ | ||
| 107 | + regression "$(INSTALL_TEST_DIR)"; | ||
| 108 | + | ||
| 109 | +ifeq ($(V),0) | ||
| 110 | INSTALL_MAN1_MACRO = \ | ||
| 111 | @echo " INSTALL manpages ($(INSTALL_MAN_DIR)/man1)"; | ||
| 112 | endif | ||
| 113 | diff --git a/tests/Makefile b/tests/Makefile | ||
| 114 | index 5fdbca7..135551c 100644 | ||
| 115 | --- a/tests/Makefile | ||
| 116 | +++ b/tests/Makefile | ||
| 117 | @@ -31,6 +31,7 @@ include ../macros.mk | ||
| 118 | |||
| 119 | include $(TOPDIR)/version_info.mk | ||
| 120 | include $(TOPDIR)/configure.mk | ||
| 121 | +include $(TOPDIR)/install.mk | ||
| 122 | |||
| 123 | OBJS = util.o | ||
| 124 | |||
| 125 | @@ -71,7 +72,7 @@ DEPS_TESTS = $(TESTS:%=%.d) | ||
| 126 | # targets | ||
| 127 | # | ||
| 128 | |||
| 129 | -.PHONY: check clean | ||
| 130 | +.PHONY: check clean install-tests | ||
| 131 | |||
| 132 | all: $(TESTS) $(OBJS) | ||
| 133 | |||
| 134 | @@ -91,5 +92,9 @@ $(TEST_PRIVATE): 00-test.c $(OBJS) ../src/libseccomp.a | ||
| 135 | check: $(TESTS) | ||
| 136 | ./regression | ||
| 137 | |||
| 138 | +install-tests: $(TESTS) $(TESTS:%=%.tests) | ||
| 139 | + $(INSTALL_TEST_MACRO) | ||
| 140 | + $(INSTALL_REGRESSION_TEST_MACRO) | ||
| 141 | + | ||
| 142 | clean: | ||
| 143 | $(RM) $(DEPS_TESTS) $(DEPS_OBJS) $(TESTS) $(TEST_PRIVATE) $(OBJS) *.pyc | ||
| 144 | diff --git a/tests/regression b/tests/regression | ||
| 145 | index 790d5e1..3c293a4 100755 | ||
| 146 | --- a/tests/regression | ||
| 147 | +++ b/tests/regression | ||
| 148 | @@ -23,9 +23,18 @@ | ||
| 149 | |||
| 150 | GLBL_ARCH_SUPPORT="x86 x86_64 x32 arm" | ||
| 151 | |||
| 152 | -GLBL_SYS_ARCH="../tools/scmp_arch_detect" | ||
| 153 | -GLBL_SYS_RESOLVER="../tools/scmp_sys_resolver" | ||
| 154 | -GLBL_SYS_SIM="../tools/scmp_bpf_sim" | ||
| 155 | +GLBL_SYS_PATH=$(dirname $(readlink -m $0)) | ||
| 156 | +if [ -d $GLBL_SYS_PATH/../tools/ ]; then | ||
| 157 | + # prepend ../tools to $PATH so we can use verify_deps to check for | ||
| 158 | + # scmp_* support binaries if regression is running out of the build | ||
| 159 | + # tree. | ||
| 160 | + PATH=$GLBL_SYS_PATH/../tools/:$PATH | ||
| 161 | + export PATH | ||
| 162 | +fi | ||
| 163 | + | ||
| 164 | +GLBL_SYS_ARCH=$(which scmp_arch_detect) | ||
| 165 | +GLBL_SYS_RESOLVER=$(which scmp_sys_resolver) | ||
| 166 | +GLBL_SYS_SIM=$(which scmp_bpf_sim) | ||
| 167 | |||
| 168 | #### | ||
| 169 | # functions | ||
| 170 | @@ -761,6 +770,9 @@ verify_deps head | ||
| 171 | verify_deps sed | ||
| 172 | verify_deps seq | ||
| 173 | verify_deps tr | ||
| 174 | +verify_deps scmp_arch_detect | ||
| 175 | +verify_deps scmp_sys_resolver | ||
| 176 | +verify_deps scmp_bpf_sim | ||
| 177 | |||
| 178 | # global variables | ||
| 179 | declare -a batch_list | ||
| 180 | @@ -865,6 +877,7 @@ arch=$($GLBL_SYS_ARCH) | ||
| 181 | # display the test output and run the requested tests | ||
| 182 | echo "=============== $(date) ===============" >&$logfd | ||
| 183 | echo "Regression Test Report (\"regression $*\")" >&$logfd | ||
| 184 | +cd $(dirname $0) | ||
| 185 | for mode in $mode_list; do | ||
| 186 | run_tests | ||
| 187 | done | ||
| 188 | diff --git a/tools/Makefile b/tools/Makefile | ||
| 189 | index 79c7d25..9f4ffea 100644 | ||
| 190 | --- a/tools/Makefile | ||
| 191 | +++ b/tools/Makefile | ||
| 192 | @@ -62,5 +62,8 @@ $(TOOLS): | ||
| 193 | install: $(TOOLS_INSTALL) | ||
| 194 | $(INSTALL_BIN_MACRO) | ||
| 195 | |||
| 196 | +install-tests: $(TOOLS) | ||
| 197 | + $(INSTALL_BIN_MACRO) | ||
| 198 | + | ||
| 199 | clean: | ||
| 200 | $(RM) $(DEPS) $(TOOLS) | ||
| 201 | -- | ||
| 202 | 1.7.10.4 | ||
| 203 | |||
