summaryrefslogtreecommitdiffstats
path: root/recipes-security/libseccomp/files/0001-tests-create-install-tests-target.patch
diff options
context:
space:
mode:
authorJoe MacDonald <joe@deserted.net>2013-11-04 11:50:32 -0500
committerSaul Wold <sgw@linux.intel.com>2013-11-04 12:41:45 -0800
commit62b5ee7ea3c44248d5482fb136f2d2e64cc1bbca (patch)
tree2de5fdbe3205e4e05674552fe8fd4efb77872d6b /recipes-security/libseccomp/files/0001-tests-create-install-tests-target.patch
parentcac0cef10cb7dc66d64c2e403b61457f5ba79bab (diff)
downloadmeta-security-62b5ee7ea3c44248d5482fb136f2d2e64cc1bbca.tar.gz
libseccomp: add latest stable version, add ptest
A new stable version of libseccomp is available, so update the recipe. At the same time, integrate the ptest support that's currently being discussed on the libseccomp list. Signed-off-by: Joe MacDonald <joe@deserted.net> Signed-off-by: Saul Wold <sgw@linux.intel.com>
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.patch203
1 files changed, 203 insertions, 0 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
new file mode 100644
index 0000000..55eaf81
--- /dev/null
+++ b/recipes-security/libseccomp/files/0001-tests-create-install-tests-target.patch
@@ -0,0 +1,203 @@
1From e8e166cdc1fc31e02d568424e17b9f9fc1e95256 Mon Sep 17 00:00:00 2001
2From: Joe MacDonald <joe@deserted.net>
3Date: Mon, 28 Oct 2013 15:40:14 -0400
4Subject: [PATCH 1/3] tests: create install-tests target
5
6It can be useful, in particular on a cross-build setup, to install the
7tests and regression suite in addition to the library itself. Since most
8people probably don't want that by default, though, create an
9install-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
13Upstream-Status: Submitted [http://www.mail-archive.com/libseccomp-discuss@lists.sourceforge.net/msg00470.html]
14
15Signed-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
26diff --git a/Makefile b/Makefile
27index 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 *
53diff --git a/README b/README
54index 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
72diff --git a/install.mk b/install.mk
73index 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
84diff --git a/macros.mk b/macros.mk
85index 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
113diff --git a/tests/Makefile b/tests/Makefile
114index 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
144diff --git a/tests/regression b/tests/regression
145index 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
188diff --git a/tools/Makefile b/tools/Makefile
189index 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--
2021.7.10.4
203