summaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--recipes-security/libseccomp/files/0001-tests-create-install-tests-target.patch203
-rw-r--r--recipes-security/libseccomp/files/0002-tests-install-python-tests-if-appropriate.patch61
-rw-r--r--recipes-security/libseccomp/files/0003-tests-introduce-alternate-test-report-format.patch124
-rw-r--r--recipes-security/libseccomp/libseccomp_2.1.1.bb (renamed from recipes-security/libseccomp/libseccomp_2.1.0.bb)10
4 files changed, 395 insertions, 3 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
diff --git a/recipes-security/libseccomp/files/0002-tests-install-python-tests-if-appropriate.patch b/recipes-security/libseccomp/files/0002-tests-install-python-tests-if-appropriate.patch
new file mode 100644
index 0000000..52ae751
--- /dev/null
+++ b/recipes-security/libseccomp/files/0002-tests-install-python-tests-if-appropriate.patch
@@ -0,0 +1,61 @@
1From 49dd92b85ca1797f2d289f48d3c1cdaec678334b Mon Sep 17 00:00:00 2001
2From: Joe MacDonald <joe@deserted.net>
3Date: Mon, 28 Oct 2013 15:40:15 -0400
4Subject: [PATCH 2/3] tests: install python tests if appropriate
5
6Install the python tests in addition to the C tests if python bindings are
7being built. The regression script can, and needs to, have the
8modification of the PYTHONPATH removed since it's unlikely in this
9scenario that the original source tree will be around at all anymore.
10This shouldn't be a problem since the library should be installed to the
11default PYTHONPATH anyway.
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 macros.mk | 3 ++-
18 tests/Makefile | 6 +++++-
19 2 files changed, 7 insertions(+), 2 deletions(-)
20
21diff --git a/macros.mk b/macros.mk
22index e7c196d..13e7ed3 100644
23--- a/macros.mk
24+++ b/macros.mk
25@@ -221,7 +221,8 @@ INSTALL_REGRESSION_TEST_MACRO += \
26 $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) \
27 -d "$(INSTALL_TEST_DIR)"; \
28 $(INSTALL) -o $(INSTALL_OWNER) -g $(INSTALL_GROUP) -m 0755 \
29- regression "$(INSTALL_TEST_DIR)";
30+ regression "$(INSTALL_TEST_DIR)"; \
31+ $(SED) -i "/\/..\/src\/python\/build\/lib\./d" "$(INSTALL_TEST_DIR)/regression";
32
33 ifeq ($(V),0)
34 INSTALL_MAN1_MACRO = \
35diff --git a/tests/Makefile b/tests/Makefile
36index 135551c..309a570 100644
37--- a/tests/Makefile
38+++ b/tests/Makefile
39@@ -78,6 +78,10 @@ all: $(TESTS) $(OBJS)
40
41 -include $(DEPS_TESTS) $(DEPS_OBJS)
42
43+ifeq ($(CONF_BINDINGS_PYTHON), 1)
44+ PY_TESTS = $(TESTS:%=%.py)
45+endif
46+
47 $(DEPS_TESTS):
48 $(MAKEDEP_EXEC)
49 $(ADDDEP) $@ ../src/libseccomp.a
50@@ -92,7 +96,7 @@ $(TEST_PRIVATE): 00-test.c $(OBJS) ../src/libseccomp.a
51 check: $(TESTS)
52 ./regression
53
54-install-tests: $(TESTS) $(TESTS:%=%.tests)
55+install-tests: $(TESTS) $(TESTS:%=%.tests) $(PY_TESTS)
56 $(INSTALL_TEST_MACRO)
57 $(INSTALL_REGRESSION_TEST_MACRO)
58
59--
601.7.10.4
61
diff --git a/recipes-security/libseccomp/files/0003-tests-introduce-alternate-test-report-format.patch b/recipes-security/libseccomp/files/0003-tests-introduce-alternate-test-report-format.patch
new file mode 100644
index 0000000..cd4d6fb
--- /dev/null
+++ b/recipes-security/libseccomp/files/0003-tests-introduce-alternate-test-report-format.patch
@@ -0,0 +1,124 @@
1From 389604a4d7b445e429998599827195751238400a Mon Sep 17 00:00:00 2001
2From: Joe MacDonald <joe@deserted.net>
3Date: Mon, 28 Oct 2013 15:40:16 -0400
4Subject: [PATCH 3/3] tests: introduce alternate test report format
5
6Adding an alternate test report format to the regression script. The
7output format is modelled on the automake style described here:
8
9 http://www.gnu.org/software/automake/manual/automake.html#Simple-Tests
10
11and is intended to support integrating the existing test scripts with the
12Yocto Project's ptest infrastructure:
13
14 https://wiki.yoctoproject.org/wiki/Ptest#What_constitutes_a_ptest.3F
15
16Currently there was only one use of the existing "INFO" tag in test
17reporting, used in a way that better fit the "SKIP" model, so update that
18as well and adjust print_result to handle SKIP and INFO interchangeably so
19as to minimize the impact of this change on anyone not choosing to use the
20new report format.
21
22Upstream-Status: Submitted [http://www.mail-archive.com/libseccomp-discuss@lists.sourceforge.net/msg00470.html]
23
24Signed-off-by: Joe MacDonald <joe@deserted.net>
25---
26 tests/regression | 35 +++++++++++++++++++++++++++--------
27 1 file changed, 27 insertions(+), 8 deletions(-)
28
29diff --git a/tests/regression b/tests/regression
30index 3c293a4..a9315f7 100755
31--- a/tests/regression
32+++ b/tests/regression
33@@ -71,7 +71,7 @@ function verify_deps() {
34 function usage() {
35 cat << EOF
36 usage: regression [-h] [-v] [-m MODE] [-a] [-b BATCH_NAME] [-l <LOG>]
37- [-s SINGLE_TEST] [-t <TEMP_DIR>] [-T <TEST_TYPE>]
38+ [-p] [-s SINGLE_TEST] [-t <TEMP_DIR>] [-T <TEST_TYPE>]
39
40 libseccomp regression test automation script
41 optional arguments:
42@@ -80,6 +80,7 @@ optional arguments:
43 -a specifies all tests are to be run
44 -b BATCH_NAME specifies batch of tests to be run
45 -l [LOG] specifies log file to write test results to
46+ -p use automake-style results output (ptest format)
47 -s SINGLE_TEST specifies individual test number to be run
48 -t [TEMP_DIR] specifies directory to create temporary files in
49 -T [TEST_TYPE] only run tests matching the specified type
50@@ -127,17 +128,31 @@ function print_data() {
51 #
52 # Arguments:
53 # 1 string containing generated test number
54-# 2 string containing the test result (INFO, SUCCESS, ERROR, or FAILURE)
55+# 2 string containing the test result (SKIP, INFO, SUCCESS, ERROR, or FAILURE)
56 # 3 string containing addition details
57 #
58 function print_result() {
59- if [[ $2 == "INFO" && -z $verbose ]]; then
60+ if [[ $2 == "INFO" || $2 == "SKIP" ]] && [[ -z $verbose ]]; then
61 return
62 fi
63- if [[ $3 == "" ]]; then
64- printf "Test %s result: %s\n" "$1" "$2" >&$logfd
65+ if [[ -n $ptest_report ]]; then
66+ case $2 in
67+ SUCCESS )
68+ printf "PASS: %s %s\n" "$1" "$3" >&$logfd
69+ ;;
70+ ERROR | FAILURE )
71+ printf "FAIL: %s %s\n" "$1" "$3" >&$logfd
72+ ;;
73+ SKIP )
74+ printf "SKIP: %s %s\n" "$1" "$3" >&$logfd
75+ ;;
76+ esac
77 else
78- printf "Test %s result: %s %s\n" "$1" "$2" "$3" >&$logfd
79+ if [[ $3 == "" ]]; then
80+ printf "Test %s result: %s\n" "$1" "$2" >&$logfd
81+ else
82+ printf "Test %s result: %s %s\n" "$1" "$2" "$3" >&$logfd
83+ fi
84 fi
85 }
86
87@@ -358,7 +373,7 @@ function run_test_bpf_sim() {
88 fi
89 elif [[ "$testarch" != "all" ]] && [[ "$testarch" != "$arch" ]]; then
90 # only run tests that match the current architecture
91- print_result $(generate_test_num "$1" $2 1) "INFO" \
92+ print_result $(generate_test_num "$1" $2 1) "SKIP" \
93 "Test skipped due to test/system architecture difference"
94 stats_skipped=$(($stats_skipped+1))
95 return
96@@ -788,13 +803,14 @@ tmpfile=""
97 tmpdir=""
98 type=
99 verbose=
100+ptest_report=
101 stats_all=0
102 stats_skipped=0
103 stats_success=0
104 stats_failure=0
105 stats_error=0
106
107-while getopts "ab:gl:m:s:t:T:vh" opt; do
108+while getopts "ab:gl:m:ps:t:T:vh" opt; do
109 case $opt in
110 a)
111 runall=1
112@@ -820,6 +836,9 @@ while getopts "ab:gl:m:s:t:T:vh" opt; do
113 exit 1
114 esac
115 ;;
116+ p)
117+ ptest_report=1
118+ ;;
119 s)
120 single_list[single_count]=$OPTARG
121 single_count=$(($single_count+1))
122--
1231.7.10.4
124
diff --git a/recipes-security/libseccomp/libseccomp_2.1.0.bb b/recipes-security/libseccomp/libseccomp_2.1.1.bb
index f909c62..27fa259 100644
--- a/recipes-security/libseccomp/libseccomp_2.1.0.bb
+++ b/recipes-security/libseccomp/libseccomp_2.1.1.bb
@@ -5,10 +5,14 @@ LICENSE = "GPL-2.0"
5LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6" 5LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
6 6
7SRC_URI = "http://sourceforge.net/projects/libseccomp/files/${PN}-${PV}.tar.gz \ 7SRC_URI = "http://sourceforge.net/projects/libseccomp/files/${PN}-${PV}.tar.gz \
8 file://compiler.patch" 8 file://compiler.patch \
9 file://0001-tests-create-install-tests-target.patch \
10 file://0002-tests-install-python-tests-if-appropriate.patch \
11 file://0003-tests-introduce-alternate-test-report-format.patch \
12"
9 13
10SRC_URI[md5sum] = "3961103c1234c13a810f6a12e60c797f" 14SRC_URI[md5sum] = "1f41207b29e66a7e5e375dd48a64de85"
11SRC_URI[sha256sum] = "b0d6e4f0984e6632a04f0cf33c6babdb011674ba15ff208e196f037e0e09905e" 15SRC_URI[sha256sum] = "8812c11e407c383f5ad6afb84a88e5a0224477bcfe8ff03f0c548e5abaac841c"
12 16
13do_configure() { 17do_configure() {
14 ${S}/configure --prefix=${prefix} --libdir=${libdir} 18 ${S}/configure --prefix=${prefix} --libdir=${libdir}