Skip to contentSkip to conversation

selinux-testsuite patches

RFC PATCH In review Paul Moore 2 participants 15 messages Sep 24, 2013 – Sep 27, 2013 SELinux security module

lore
Share & tools
lore

Paul Moore

author
#0 lore raw

cover selinux-testsuite patches

This is a small patchset I put together this morning to get the SELinux testsuite running on my Rawhide system which was current as of a few minutes ago. You can pull from here if you are so inclined:

* git://git.infradead.org/users/pcmoore/selinux_testsuite
* http://git.infradead.org/users/pcmoore/selinux_testsuite

The only patch that is really necessary is 1/4, the change to test_global.te. At this point I haven't really looked closely enough at the tests to see if it is correct, but it at least builds and the tests all run to completion without failure. The other three patches are basically just style/formatting tweaks I did while working on the fix in 1/4. Feel free to do with them what you will.

Comments are always welcome. I'm hoping to start running this against the upstream bits on a regular basis.

---

Paul Moore (4):
test_policy: test_global.te fix for Fedora Rawhide (Sept 24th, 2013)
test_policy: general Makefile cleanup
test_policy: use RHEL instead of REDHAT in Makefile
test_policy: create a "build" target

 policy/Makefile       |   85 ++++++++++++++++++++++++++++---------------------
 policy/test_global.te |    5 ++-
 2 files changed, 51 insertions(+), 39 deletions(-)

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#1 lore raw

RFC PATCH 1/4 test_policy: test_global.te fix for Fedora Rawhide (Sept 24th, 2013)

---
 policy/test_global.te |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
policy/test_global.te +3 -2
index 3891f6e..49c85b1 100644
@@ -5,6 +5,7 @@ policy_module(test_policy,1.0.0)
 #
 # Declarations
 #
+
 attribute testdomain;
 
 gen_require(`
@@ -34,8 +35,8 @@ miscfiles_read_test_files(testdomain)
 
 # Let the test domains set their current, exec and fscreate contexts.
 allow testdomain self:process setcurrent;
-# domain_dyntrans_type(testdomain)
-selinux_get_fs_mount(testdomain)
+#domain_dyntrans_type(testdomain)
+#selinux_get_fs_mount(testdomain)
 allow testdomain self:process setexec;
 allow testdomain self:process setfscreate;
 

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

Acked-by Serge Hallyn on v1 1/4
#2 lore raw

Re: [selinux-testsuite RFC PATCH 1/4] test_policy: test_global.te fix for Fedora Rawhide (Sept 24th, 2013)

Quoted 1 line · Paul Moore

Thanks, Paul! This break had been reported to me and I got as far as tracking it to its cause, but I hadn't yet figured out what to replace it by. I assume you're saying it's not strictly necessary :) All the better.

Quoted 17 lines
---
 policy/test_global.te |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
policy/test_global.te +1 -0
index 3891f6e..49c85b1 100644
@@ -5,6 +5,7 @@ policy_module(test_policy,1.0.0)
 #
 # Declarations
 #
+
 attribute testdomain;
 
 gen_require(`

policy/test_global.te miscfiles_read_test_files(testdomain) · line 42

Quoted 10 lines
policy/test_global.te +2 -2
@@ -34,8 +35,8 @@ miscfiles_read_test_files(testdomain)
 
 # Let the test domains set their current, exec and fscreate contexts.
 allow testdomain self:process setcurrent;
-# domain_dyntrans_type(testdomain)
-selinux_get_fs_mount(testdomain)
+#domain_dyntrans_type(testdomain)
+#selinux_get_fs_mount(testdomain)
 allow testdomain self:process setexec;
 allow testdomain self:process setfscreate;
 

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#3 lore raw

Re: [selinux-testsuite RFC PATCH 1/4] test_policy: test_global.te fix for Fedora Rawhide (Sept 24th, 2013)

Quoted 6 lines · Serge E. Hallyn
Quoted 1 line · Paul Moore

Thanks, Paul! This break had been reported to me and I got as far as tracking it to its cause, but I hadn't yet figured out what to replace it by.

No problem.

Quoted 1 line

I assume you're saying it's not strictly necessary :) All the better.

Well, I guess what I'm trying to say is that I'm not sure if this is the right fix, but it does at least resolve the build problems I'm seeing. I have yet to check to see if it works correctly.

Quoted 1 line

Ack? I thought you were the one maintaining the test suite?

Quoted 33 lines
Quoted 33 lines

---

 policy/test_global.te |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
policy/test_global.te +1 -0
index 3891f6e..49c85b1 100644
@@ -5,6 +5,7 @@ policy_module(test_policy,1.0.0)
 
 #
 # Declarations
 #
 
+
 

attribute testdomain;

gen_require(`

policy/test_global.te +2 -2
@@ -34,8 +35,8 @@ miscfiles_read_test_files(testdomain)
 
 # Let the test domains set their current, exec and fscreate contexts.
 allow testdomain self:process setcurrent;
 
-# domain_dyntrans_type(testdomain)
-selinux_get_fs_mount(testdomain)
+#domain_dyntrans_type(testdomain)
+#selinux_get_fs_mount(testdomain)
 
 allow testdomain self:process setexec;

allow testdomain self:process setfscreate;

Signature · 8 lines
paul moore
security and virtualization @ redhat


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#4 lore raw

Re: [selinux-testsuite RFC PATCH 1/4] test_policy: test_global.te fix for Fedora Rawhide (Sept 24th, 2013)

Quoted 12 lines · Paul Moore
Quoted 6 lines · Serge E. Hallyn
Quoted 1 line · Paul Moore

Thanks, Paul! This break had been reported to me and I got as far as tracking it to its cause, but I hadn't yet figured out what to replace it by.

No problem.

Quoted 1 line

I assume you're saying it's not strictly necessary :) All the better.

Quoted 7 lines

Well, I guess what I'm trying to say is that I'm not sure if this is the right fix, but it does at least resolve the build problems I'm seeing. I have yet to check to see if it works correctly.

Quoted 1 line

Ack? I thought you were the one maintaining the test suite?

Yes, that's me saying I'll apply that.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#5 lore raw

Re: [selinux-testsuite RFC PATCH 1/4] test_policy: test_global.te fix for Fedora Rawhide (Sept 24th, 2013)

Quoted 17 lines · Serge E. Hallyn
Quoted 16 lines · Paul Moore
Quoted 6 lines · Serge E. Hallyn
Quoted 1 line · Paul Moore

Thanks, Paul! This break had been reported to me and I got as far as tracking it to its cause, but I hadn't yet figured out what to replace it by.

No problem.

Quoted 1 line

I assume you're saying it's not strictly necessary :) All the better.

Well, I guess what I'm trying to say is that I'm not sure if this is the right fix, but it does at least resolve the build problems I'm seeing. I have yet to check to see if it works correctly.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ack? I thought you were the one maintaining the test suite?

Yes, that's me saying I'll apply that.

Great, thanks.

Signature · 8 lines
paul moore
security and virtualization @ redhat


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#6 lore raw

Re: [selinux-testsuite RFC PATCH 1/4] test_policy: test_global.te fix for Fedora Rawhide (Sept 24th, 2013)

Quoted 18 lines · Paul Moore
Quoted 17 lines · Serge E. Hallyn
Quoted 16 lines · Paul Moore
Quoted 6 lines · Serge E. Hallyn
Quoted 1 line · Paul Moore

Thanks, Paul! This break had been reported to me and I got as far as tracking it to its cause, but I hadn't yet figured out what to replace it by.

No problem.

Quoted 1 line

I assume you're saying it's not strictly necessary :) All the better.

Well, I guess what I'm trying to say is that I'm not sure if this is the right fix, but it does at least resolve the build problems I'm seeing. I have yet to check to see if it works correctly.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ack? I thought you were the one maintaining the test suite?

Yes, that's me saying I'll apply that.

Great, thanks.

Thanks, Paul, all tests passed (on f19) with your patches!

-serge

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#7 lore raw

Re: [selinux-testsuite RFC PATCH 1/4] test_policy: test_global.te fix for Fedora Rawhide (Sept 24th, 2013)

Quoted 24 lines · Serge E. Hallyn
Quoted 23 lines · Paul Moore
Quoted 22 lines · Serge E. Hallyn
Quoted 21 lines · Paul Moore
Quoted 6 lines · Serge E. Hallyn
Quoted 1 line · Paul Moore

Thanks, Paul! This break had been reported to me and I got as far as tracking it to its cause, but I hadn't yet figured out what to replace it by.

No problem.

Quoted 2 lines

I assume you're saying it's not strictly necessary :) All the better.

Well, I guess what I'm trying to say is that I'm not sure if this is the
right fix, but it does at least resolve the build problems I'm seeing.
I
have yet to check to see if it works correctly.

Quoted 1 line
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Ack? I thought you were the one maintaining the test suite?

Yes, that's me saying I'll apply that.

Great, thanks.

Thanks, Paul, all tests passed (on f19) with your patches!

Great, glad they worked for you too.

Signature · 8 lines
paul moore
security and virtualization @ redhat


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#8 lore raw

Re: [selinux-testsuite RFC PATCH 1/4] test_policy: test_global.te fix for Fedora Rawhide (Sept 24th, 2013)

In reply to Paul Moore
Quoted 8 lines · Paul Moore
Quoted 6 lines · Serge E. Hallyn
Quoted 1 line · Paul Moore

Thanks, Paul! This break had been reported to me and I got as far as tracking it to its cause, but I hadn't yet figured out what to replace it by.

Quoted 7 lines

No problem.

Quoted 1 line

I assume you're saying it's not strictly necessary :) All the better.

Well, I guess what I'm trying to say is that I'm not sure if this is the right fix, but it does at least resolve the build problems I'm seeing. I have yet to check to see if it works correctly.

(I'm hoping to work on that tomorrow, fwiw)

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#9 lore raw

RFC PATCH 2/4 test_policy: general Makefile cleanup

In reply to Paul Moore
---
 policy/Makefile |   51 +++++++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 24 deletions(-)
policy/Makefile +27 -24
index 6fb9578..5dbb655 100644
@@ -1,36 +1,40 @@
-REDHAT_RELEASE=$(shell rpm -q redhat-release)
-REDHAT_VERS=$(shell echo $(REDHAT_RELEASE) | cut -f3 -d"-" | sed -e "s/[^0-9]*//g")
 
-POLICYDEVEL = /usr/share/selinux/devel
+POLDEV = /usr/share/selinux/devel
 SEMODULE = /usr/sbin/semodule
 CHECKPOLICY = /usr/bin/checkpolicy
-VERS := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ')
-
-TARGETS=test_global.te test_capable_file.te test_capable_net.te \
-test_capable_sys.te test_dyntrace.te test_dyntrans.te test_entrypoint.te \
-test_execshare.te test_exectrace.te test_execute_no_trans.te \
-test_fdreceive.te test_file.te test_inherit.te test_ioctl.te test_ipc.te \
-test_link.te test_mkdir.te test_open.te test_ptrace.te test_readlink.te \
-test_relabel.te test_rename.te test_rxdir.te test_setattr.te test_setnice.te \
-test_sigkill.te test_stat.te test_sysctl.te test_task_create.te \
-test_task_getpgid.te test_task_getsched.te test_task_getsid.te \
-test_task_setpgid.te test_task_setsched.te test_transition.te test_wait.te
-
-VERS_GE_24 := $(shell [ $(VERS) -ge 24 ] && echo true )
-
-ifeq ($(VERS_GE_24),true)
-TARGETS+= test_bounds.te
+
+REDHAT_RELEASE=$(shell rpm -q redhat-release)
+REDHAT_VERS=$(shell echo $(REDHAT_RELEASE) | cut -f3 -d"-" | sed -e "s/[^0-9]*//g")
+
+POL_VERS := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ')
+
+TARGETS = \
+	test_global.te test_capable_file.te test_capable_net.te \
+	test_capable_sys.te test_dyntrace.te test_dyntrans.te \
+	test_entrypoint.te test_execshare.te test_exectrace.te \
+	test_execute_no_trans.te test_fdreceive.te test_file.te \
+	test_inherit.te test_ioctl.te test_ipc.te test_link.te test_mkdir.te \
+	test_open.te test_ptrace.te test_readlink.te \
+	test_relabel.te test_rename.te test_rxdir.te test_setattr.te \
+	test_setnice.te test_sigkill.te test_stat.te test_sysctl.te \
+	test_task_create.te test_task_getpgid.te test_task_getsched.te \
+	test_task_getsid.te test_task_setpgid.te test_task_setsched.te \
+	test_transition.te test_wait.te
+
+ifeq ($(shell [ $(POL_VERS) -ge 24 ] && echo true),true)
+TARGETS += test_bounds.te
 endif
 
 all: $(TARGETS)
 ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
 	$(MAKE) -C redhat/$(REDHAT_VERS) all
 else
-	@if [ -d $(POLICYDEVEL) ]; then \
+	@if [ -d $(POLDEV) ]; then \
 		mkdir -p test_policy; \
 		cp test_policy.if test_policy; \
-		set -e; rm -f test_policy.te; cat $(TARGETS) > test_policy/test_policy.te; \
-		cd test_policy && $(MAKE) -f $(POLICYDEVEL)/Makefile test_policy.pp; \
+		set -e; rm -f test_policy.te; \
+		cat $(TARGETS) > test_policy/test_policy.te; \
+		$(MAKE) -C test_policy -f $(POLDEV)/Makefile test_policy.pp; \
 	else \
 		echo "ERROR: You must have selinux-policy-devel installed."; \
 	fi
@@ -44,7 +48,7 @@ else
 	$(SEMODULE) -i test_policy/test_policy.pp
 endif
 
-unload:	
+unload:
 ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
 	$(MAKE) -C redhat/$(REDHAT_VERS) unload
 else
@@ -54,4 +58,3 @@ endif
 
 clean:
 	rm -rf test_policy tmp
-

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

Acked-by Serge Hallyn on v1 2/4
#10 lore raw

Re: [selinux-testsuite RFC PATCH 2/4] test_policy: general Makefile cleanup

Quoted 1 line · Paul Moore
Quoted 81 lines
---
 policy/Makefile |   51 +++++++++++++++++++++++++++------------------------
 1 file changed, 27 insertions(+), 24 deletions(-)
policy/Makefile +27 -23
index 6fb9578..5dbb655 100644
@@ -1,36 +1,40 @@
-REDHAT_RELEASE=$(shell rpm -q redhat-release)
-REDHAT_VERS=$(shell echo $(REDHAT_RELEASE) | cut -f3 -d"-" | sed -e "s/[^0-9]*//g")
 
-POLICYDEVEL = /usr/share/selinux/devel
+POLDEV = /usr/share/selinux/devel
 SEMODULE = /usr/sbin/semodule
 CHECKPOLICY = /usr/bin/checkpolicy
-VERS := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ')
-
-TARGETS=test_global.te test_capable_file.te test_capable_net.te \
-test_capable_sys.te test_dyntrace.te test_dyntrans.te test_entrypoint.te \
-test_execshare.te test_exectrace.te test_execute_no_trans.te \
-test_fdreceive.te test_file.te test_inherit.te test_ioctl.te test_ipc.te \
-test_link.te test_mkdir.te test_open.te test_ptrace.te test_readlink.te \
-test_relabel.te test_rename.te test_rxdir.te test_setattr.te test_setnice.te \
-test_sigkill.te test_stat.te test_sysctl.te test_task_create.te \
-test_task_getpgid.te test_task_getsched.te test_task_getsid.te \
-test_task_setpgid.te test_task_setsched.te test_transition.te test_wait.te
-
-VERS_GE_24 := $(shell [ $(VERS) -ge 24 ] && echo true )
-
-ifeq ($(VERS_GE_24),true)
-TARGETS+= test_bounds.te
+
+REDHAT_RELEASE=$(shell rpm -q redhat-release)
+REDHAT_VERS=$(shell echo $(REDHAT_RELEASE) | cut -f3 -d"-" | sed -e "s/[^0-9]*//g")
+
+POL_VERS := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ')
+
+TARGETS = \
+	test_global.te test_capable_file.te test_capable_net.te \
+	test_capable_sys.te test_dyntrace.te test_dyntrans.te \
+	test_entrypoint.te test_execshare.te test_exectrace.te \
+	test_execute_no_trans.te test_fdreceive.te test_file.te \
+	test_inherit.te test_ioctl.te test_ipc.te test_link.te test_mkdir.te \
+	test_open.te test_ptrace.te test_readlink.te \
+	test_relabel.te test_rename.te test_rxdir.te test_setattr.te \
+	test_setnice.te test_sigkill.te test_stat.te test_sysctl.te \
+	test_task_create.te test_task_getpgid.te test_task_getsched.te \
+	test_task_getsid.te test_task_setpgid.te test_task_setsched.te \
+	test_transition.te test_wait.te
+
+ifeq ($(shell [ $(POL_VERS) -ge 24 ] && echo true),true)
+TARGETS += test_bounds.te
 endif
 
 all: $(TARGETS)
 ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
 	$(MAKE) -C redhat/$(REDHAT_VERS) all
 else
-	@if [ -d $(POLICYDEVEL) ]; then \
+	@if [ -d $(POLDEV) ]; then \
 		mkdir -p test_policy; \
 		cp test_policy.if test_policy; \
-		set -e; rm -f test_policy.te; cat $(TARGETS) > test_policy/test_policy.te; \
-		cd test_policy && $(MAKE) -f $(POLICYDEVEL)/Makefile test_policy.pp; \
+		set -e; rm -f test_policy.te; \
+		cat $(TARGETS) > test_policy/test_policy.te; \
+		$(MAKE) -C test_policy -f $(POLDEV)/Makefile test_policy.pp; \
 	else \
 		echo "ERROR: You must have selinux-policy-devel installed."; \
 	fi
@@ -44,7 +48,7 @@ else
 	$(SEMODULE) -i test_policy/test_policy.pp
 endif
 
-unload:	
+unload:
 ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
 	$(MAKE) -C redhat/$(REDHAT_VERS) unload
 else

policy/Makefile endif · line 57

Quoted 4 lines
policy/Makefile +0 -1
@@ -54,4 +58,3 @@ endif
 
 clean:
 	rm -rf test_policy tmp
-

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#11 lore raw

RFC PATCH 3/4 test_policy: use RHEL instead of REDHAT in Makefile

In reply to Paul Moore

We also rework some of the if statements to make it easier to add additional distributions, e.g. Fedora.

---
 policy/Makefile |   34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)
policy/Makefile +20 -14
index 5dbb655..8763143 100644
@@ -3,8 +3,8 @@ POLDEV = /usr/share/selinux/devel
 SEMODULE = /usr/sbin/semodule
 CHECKPOLICY = /usr/bin/checkpolicy
 
-REDHAT_RELEASE=$(shell rpm -q redhat-release)
-REDHAT_VERS=$(shell echo $(REDHAT_RELEASE) | cut -f3 -d"-" | sed -e "s/[^0-9]*//g")
+RHEL_REL=$(shell rpm -q redhat-release)
+RHEL_VERS=$(shell echo $(RHEL_REL) | cut -f3 -d"-" | sed -e "s/[^0-9]*//g")
 
 POL_VERS := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ')
 
@@ -26,9 +26,12 @@ TARGETS += test_bounds.te
 endif
 
 all: $(TARGETS)
-ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
-	$(MAKE) -C redhat/$(REDHAT_VERS) all
-else
+ifeq (x$(RHEL_VERS),$(filter x$(RHEL_VERS),x4 x5))
+	# RHEL specific policy build
+	$(MAKE) -C redhat/$(RHEL_VERS) all \
+	exit $$?
+endif
+	# General policy build
 	@if [ -d $(POLDEV) ]; then \
 		mkdir -p test_policy; \
 		cp test_policy.if test_policy; \
@@ -38,23 +41,26 @@ else
 	else \
 		echo "ERROR: You must have selinux-policy-devel installed."; \
 	fi
-endif
 
 load: all
-ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
-	$(MAKE) -C redhat/$(REDHAT_VERS) load
-else
+ifeq (x$(RHEL_VERS),$(filter x$(RHEL_VERS),x4 x5))
+	# RHEL specific policy load
+	$(MAKE) -C redhat/$(RHEL_VERS) load \
+	exit $$?
+endif
+	# General policy load
 	/usr/sbin/setsebool allow_domain_fd_use=0
 	$(SEMODULE) -i test_policy/test_policy.pp
-endif
 
 unload:
-ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
-	$(MAKE) -C redhat/$(REDHAT_VERS) unload
-else
+ifeq (x$(RHEL_VERS),$(filter x$(RHEL_VERS),x4 x5))
+	# RHEL specific policy unload
+	$(MAKE) -C redhat/$(RHEL_VERS) unload \
+	exit $$?
+endif
+	# General policy unload
 	/usr/sbin/setsebool allow_domain_fd_use=1
 	$(SEMODULE) -r test_policy
-endif
 
 clean:
 	rm -rf test_policy tmp

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

Acked-by Serge Hallyn on v1 3/4
#12 lore raw

Re: [selinux-testsuite RFC PATCH 3/4] test_policy: use RHEL instead of REDHAT in Makefile

Quoted 4 lines · Paul Moore

We also rework some of the if statements to make it easier to add additional distributions, e.g. Fedora.

Quoted 61 lines
---
 policy/Makefile |   34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)
policy/Makefile +16 -13
index 5dbb655..8763143 100644
@@ -3,8 +3,8 @@ POLDEV = /usr/share/selinux/devel
 SEMODULE = /usr/sbin/semodule
 CHECKPOLICY = /usr/bin/checkpolicy
 
-REDHAT_RELEASE=$(shell rpm -q redhat-release)
-REDHAT_VERS=$(shell echo $(REDHAT_RELEASE) | cut -f3 -d"-" | sed -e "s/[^0-9]*//g")
+RHEL_REL=$(shell rpm -q redhat-release)
+RHEL_VERS=$(shell echo $(RHEL_REL) | cut -f3 -d"-" | sed -e "s/[^0-9]*//g")
 
 POL_VERS := $(shell $(CHECKPOLICY) -V |cut -f 1 -d ' ')
 
@@ -26,9 +26,12 @@ TARGETS += test_bounds.te
 endif
 
 all: $(TARGETS)
-ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
-	$(MAKE) -C redhat/$(REDHAT_VERS) all
-else
+ifeq (x$(RHEL_VERS),$(filter x$(RHEL_VERS),x4 x5))
+	# RHEL specific policy build
+	$(MAKE) -C redhat/$(RHEL_VERS) all \
+	exit $$?
+endif
+	# General policy build
 	@if [ -d $(POLDEV) ]; then \
 		mkdir -p test_policy; \
 		cp test_policy.if test_policy; \
@@ -38,23 +41,26 @@ else
 	else \
 		echo "ERROR: You must have selinux-policy-devel installed."; \
 	fi
-endif
 
 load: all
-ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
-	$(MAKE) -C redhat/$(REDHAT_VERS) load
-else
+ifeq (x$(RHEL_VERS),$(filter x$(RHEL_VERS),x4 x5))
+	# RHEL specific policy load
+	$(MAKE) -C redhat/$(RHEL_VERS) load \
+	exit $$?
+endif
+	# General policy load
 	/usr/sbin/setsebool allow_domain_fd_use=0
 	$(SEMODULE) -i test_policy/test_policy.pp
-endif
 
 unload:
-ifeq (x$(REDHAT_VERS),$(filter x$(REDHAT_VERS),x4 x5))
-	$(MAKE) -C redhat/$(REDHAT_VERS) unload
-else
+ifeq (x$(RHEL_VERS),$(filter x$(RHEL_VERS),x4 x5))
+	# RHEL specific policy unload

policy/Makefile else · line 66

Quoted 10 lines
policy/Makefile +4 -1
+	$(MAKE) -C redhat/$(RHEL_VERS) unload \
+	exit $$?
+endif
+	# General policy unload
 	/usr/sbin/setsebool allow_domain_fd_use=1
 	$(SEMODULE) -r test_policy
-endif
 
 clean:
 	rm -rf test_policy tmp

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

author
#13 lore raw

RFC PATCH 4/4 test_policy: create a "build" target

In reply to Paul Moore
---
 policy/Makefile |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
policy/Makefile +3 -1
index 8763143..3a8a10d 100644
@@ -25,7 +25,9 @@ ifeq ($(shell [ $(POL_VERS) -ge 24 ] && echo true),true)
 TARGETS += test_bounds.te
 endif
 
-all: $(TARGETS)
+all: build
+
+build: $(TARGETS)
 ifeq (x$(RHEL_VERS),$(filter x$(RHEL_VERS),x4 x5))
 	# RHEL specific policy build
 	$(MAKE) -C redhat/$(RHEL_VERS) all \

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

Acked-by Serge Hallyn on v1 4/4
#14 lore raw

Re: [selinux-testsuite RFC PATCH 4/4] test_policy: create a "build" target

Quoted 1 line · Paul Moore
Quoted 9 lines
---
 policy/Makefile |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
policy/Makefile +0 -0
index 8763143..3a8a10d 100644

policy/Makefile ifeq ($(shell [ $(POL_VERS) -ge 24 ] && echo true),true) · line 33

Quoted 10 lines
policy/Makefile +3 -1
@@ -25,7 +25,9 @@ ifeq ($(shell [ $(POL_VERS) -ge 24 ] && echo true),true)
 TARGETS += test_bounds.te
 endif
 
-all: $(TARGETS)
+all: build
+
+build: $(TARGETS)
 ifeq (x$(RHEL_VERS),$(filter x$(RHEL_VERS),x4 x5))
 	# RHEL specific policy build
 	$(MAKE) -C redhat/$(RHEL_VERS) all \

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.