diff mbox

[v3] libseccomp: Add new config option to build and install tests

Message ID 1442827716-8802-1-git-send-email-markos.chandras@imgtec.com
State Rejected
Headers show

Commit Message

Markos Chandras Sept. 21, 2015, 9:28 a.m. UTC
Add new config option to allow building and installing the libseccomp
testsuite on the target. It's useful for testing the kernels'
seccomp behavior for the target architecture.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
---
changes since v2:
- Move installation path for tests to /usr/share/libseccomp
- Do not install python files. We don't support python + libseccomp
at the moment so there is no point in installing these tests yet.

changes since v1:
- Drop compile hook for tests and use MAKE_OPTS instead
---
 package/libseccomp/Config.in     |  9 +++++++++
 package/libseccomp/libseccomp.mk | 16 ++++++++++++++++
 2 files changed, 25 insertions(+)

Comments

Vicente Olivert Riera Sept. 21, 2015, 10:40 a.m. UTC | #1
Dear Markos Chandras,

could you please mark your previous patch as superseded?

http://patchwork.ozlabs.org/patch/519170/

On 09/21/2015 10:28 AM, Markos Chandras wrote:
> Add new config option to allow building and installing the libseccomp
> testsuite on the target. It's useful for testing the kernels'
> seccomp behavior for the target architecture.
> 
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Reviewed-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
Tested-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>

Build test for MIPS architecture. All fine. Binary files built for the
right architecture and no more .py files installed on target. Checked
that now the tests and tools are installed in /usr/share/libseccomp/.

Regards,

Vincent.

> ---
> changes since v2:
> - Move installation path for tests to /usr/share/libseccomp
> - Do not install python files. We don't support python + libseccomp
> at the moment so there is no point in installing these tests yet.
> 
> changes since v1:
> - Drop compile hook for tests and use MAKE_OPTS instead
> ---
>  package/libseccomp/Config.in     |  9 +++++++++
>  package/libseccomp/libseccomp.mk | 16 ++++++++++++++++
>  2 files changed, 25 insertions(+)
> 
> diff --git a/package/libseccomp/Config.in b/package/libseccomp/Config.in
> index 4c34c5466592..760a6f321142 100644
> --- a/package/libseccomp/Config.in
> +++ b/package/libseccomp/Config.in
> @@ -15,6 +15,15 @@ config BR2_PACKAGE_LIBSECCOMP
>  
>  	  https://github.com/seccomp/libseccomp
>  
> +config BR2_PACKAGE_LIBSECCOMP_TESTS
> +	bool "Install libseccomp tests"
> +	depends on BR2_PACKAGE_BASH && BR2_PACKAGE_LIBSECCOMP
> +	help
> +	  Build and install the libseccomp testsuite.
> +
> +comment "libseccomp testsuite needs bash as running shell"
> +	depends on !BR2_PACKAGE_BASH && BR2_PACKAGE_LIBSECCOMP
> +
>  comment "libseccomp needs a toolchain w/ headers >= 3.12"
>  	depends on BR2_aarch64 || BR2_mips || BR2_mipsel || BR2_mips64 || \
>  		BR2_mips64el || BR2_i386 || BR2_x86_64
> diff --git a/package/libseccomp/libseccomp.mk b/package/libseccomp/libseccomp.mk
> index a188298006b1..e6e578b85561 100644
> --- a/package/libseccomp/libseccomp.mk
> +++ b/package/libseccomp/libseccomp.mk
> @@ -17,4 +17,20 @@ define LIBSECCOMP_FIXUP_M4_DIR
>  endef
>  LIBSECCOMP_POST_EXTRACT_HOOKS += LIBSECCOMP_FIXUP_M4_DIR
>  
> +ifeq ($(BR2_PACKAGE_LIBSECCOMP_TESTS),y)
> +
> +LIBSECCOMP_MAKE_OPTS += check-build
> +
> +define LIBSECCOMP_TESTS_INSTALL
> +	mkdir -p $(TARGET_DIR)/usr/share/libseccomp/{tests,tools} && \
> +	for x in tests tools; do \
> +		find $(@D)/$$x -maxdepth 1 \( -name "*.tests" -o -perm -a=x \) -a ! -name "*.py" \
> +			-type f -exec cp {} $(TARGET_DIR)/usr/share/libseccomp/$$x/ \; ; \
> +	done
> +endef
> +
> +LIBSECCOMP_POST_INSTALL_TARGET_HOOKS += LIBSECCOMP_TESTS_INSTALL
> +
> +endif
> +
>  $(eval $(autotools-package))
>
Markos Chandras Oct. 2, 2015, 8:24 a.m. UTC | #2
On 09/21/2015 10:28 AM, Markos Chandras wrote:
> Add new config option to allow building and installing the libseccomp
> testsuite on the target. It's useful for testing the kernels'
> seccomp behavior for the target architecture.
> 
> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
> ---
> changes since v2:
> - Move installation path for tests to /usr/share/libseccomp
> - Do not install python files. We don't support python + libseccomp
> at the moment so there is no point in installing these tests yet.
> 
> changes since v1:
> - Drop compile hook for tests and use MAKE_OPTS instead
> ---

ping?
Markos Chandras Nov. 10, 2015, 9:49 a.m. UTC | #3
On 10/02/2015 09:24 AM, Markos Chandras wrote:
> On 09/21/2015 10:28 AM, Markos Chandras wrote:
>> Add new config option to allow building and installing the libseccomp
>> testsuite on the target. It's useful for testing the kernels'
>> seccomp behavior for the target architecture.
>>
>> Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
>> ---
>> changes since v2:
>> - Move installation path for tests to /usr/share/libseccomp
>> - Do not install python files. We don't support python + libseccomp
>> at the moment so there is no point in installing these tests yet.
>>
>> changes since v1:
>> - Drop compile hook for tests and use MAKE_OPTS instead
>> ---
> 
> ping?
> 
ping?
Thomas Petazzoni Nov. 10, 2015, 10 a.m. UTC | #4
Markos,

On Tue, 10 Nov 2015 09:49:45 +0000, Markos Chandras wrote:

> ping?

I think the reason I still don't apply this patch is because I'm not
happy with Buildroot doing all this complicated logic to install the
tests, and that it should be part of the libseccomp build system to
provide a mechanism to do that easily.

So if you want to see this integrated, I would recommend to work with
upstream libseccomp to implement something allowing the installation of
tests, and then use it in Buildroot.

Best regards,

Thomas
Markos Chandras Nov. 10, 2015, 10:14 a.m. UTC | #5
On 11/10/2015 10:00 AM, Thomas Petazzoni wrote:
> Markos,
> 
> On Tue, 10 Nov 2015 09:49:45 +0000, Markos Chandras wrote:
> 
>> ping?
> 
> I think the reason I still don't apply this patch is because I'm not
> happy with Buildroot doing all this complicated logic to install the
> tests, and that it should be part of the libseccomp build system to
> provide a mechanism to do that easily.
> 
> So if you want to see this integrated, I would recommend to work with
> upstream libseccomp to implement something allowing the installation of
> tests, and then use it in Buildroot.

Hi Thomas,

Ok fair enough
diff mbox

Patch

diff --git a/package/libseccomp/Config.in b/package/libseccomp/Config.in
index 4c34c5466592..760a6f321142 100644
--- a/package/libseccomp/Config.in
+++ b/package/libseccomp/Config.in
@@ -15,6 +15,15 @@  config BR2_PACKAGE_LIBSECCOMP
 
 	  https://github.com/seccomp/libseccomp
 
+config BR2_PACKAGE_LIBSECCOMP_TESTS
+	bool "Install libseccomp tests"
+	depends on BR2_PACKAGE_BASH && BR2_PACKAGE_LIBSECCOMP
+	help
+	  Build and install the libseccomp testsuite.
+
+comment "libseccomp testsuite needs bash as running shell"
+	depends on !BR2_PACKAGE_BASH && BR2_PACKAGE_LIBSECCOMP
+
 comment "libseccomp needs a toolchain w/ headers >= 3.12"
 	depends on BR2_aarch64 || BR2_mips || BR2_mipsel || BR2_mips64 || \
 		BR2_mips64el || BR2_i386 || BR2_x86_64
diff --git a/package/libseccomp/libseccomp.mk b/package/libseccomp/libseccomp.mk
index a188298006b1..e6e578b85561 100644
--- a/package/libseccomp/libseccomp.mk
+++ b/package/libseccomp/libseccomp.mk
@@ -17,4 +17,20 @@  define LIBSECCOMP_FIXUP_M4_DIR
 endef
 LIBSECCOMP_POST_EXTRACT_HOOKS += LIBSECCOMP_FIXUP_M4_DIR
 
+ifeq ($(BR2_PACKAGE_LIBSECCOMP_TESTS),y)
+
+LIBSECCOMP_MAKE_OPTS += check-build
+
+define LIBSECCOMP_TESTS_INSTALL
+	mkdir -p $(TARGET_DIR)/usr/share/libseccomp/{tests,tools} && \
+	for x in tests tools; do \
+		find $(@D)/$$x -maxdepth 1 \( -name "*.tests" -o -perm -a=x \) -a ! -name "*.py" \
+			-type f -exec cp {} $(TARGET_DIR)/usr/share/libseccomp/$$x/ \; ; \
+	done
+endef
+
+LIBSECCOMP_POST_INSTALL_TARGET_HOOKS += LIBSECCOMP_TESTS_INSTALL
+
+endif
+
 $(eval $(autotools-package))