Makefile: unload policy when testsuite fails
Subsystems (2)
PATCH 1/1 Makefile: unload policy when testsuite fails
Make sure that the test policy is properly unloaded when make test fails, to prevent it from accidentally lingering on the system after a failed test.
--- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile +5 -1
@@ -5,7 +5,11 @@ all: test: make -C policy load - make -C tests test + make -C tests test || { \ + res=$$?; \ + make -C policy unload; \ + exit $$res; \ + } make -C policy unload check-syntax:
Signature · 1 line
2.29.2
Paul Moore
maintainerQuoted 15 lines · Ondrej Mosnacek
Make sure that the test policy is properly unloaded when
make testfails, to prevent it from accidentally lingering on the system after a failed test.Signed-off-by Ondrej Mosnacek <[email protected]>--- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)Makefile +0
-0
Makefile all: · line 13
Quoted 10 lines
Makefile +5
-1@@ -5,7 +5,11 @@ all: test: make -C policy load - make -C tests test + make -C tests test || { \ + res=$$?; \ + make -C policy unload; \ + exit $$res; \ + } make -C policy unload
Why not just do '-make -C tests test' instead?
Signature · 2 lines
paul moore www.paul-moore.com
Quoted 17 lines · Paul Moore
Quoted 16 lines · Ondrej Mosnacek
Make sure that the test policy is properly unloaded when
make testfails, to prevent it from accidentally lingering on the system after a failed test.Signed-off-by Ondrej Mosnacek <[email protected]>--- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)Makefile +0
-0@@ -5,7 +5,11 @@ all:
Quoted 11 lines
Makefile all: · line 13
Quoted 9 lines
Makefile +5
-1test: make -C policy load - make -C tests test + make -C tests test || { \ + res=$$?; \ + make -C policy unload; \ + exit $$res; \ + } make -C policy unloadWhy not just do '-make -C tests test' instead?
Then the exit code would be 0 regardless of whether the tests passed or failed.
Signature · 3 lines
Ondrej Mosnacek Software Engineer, Platform Security - SELinux kernel Red Hat, Inc.
Paul Moore
maintainerQuoted 30 lines · Ondrej Mosnacek
Quoted 17 lines · Paul Moore
Quoted 16 lines · Ondrej Mosnacek
Make sure that the test policy is properly unloaded when
make testfails, to prevent it from accidentally lingering on the system after a failed test.Signed-off-by Ondrej Mosnacek <[email protected]>--- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)Makefile +0
-0@@ -5,7 +5,11 @@ all:Quoted 11 lines
Makefile all: · line 13
Quoted 9 lines
Makefile +5
-1test: make -C policy load - make -C tests test + make -C tests test || { \ + res=$$?; \ + make -C policy unload; \ + exit $$res; \ + } make -C policy unloadWhy not just do '-make -C tests test' instead?
Quoted 1 line
Then the exit code would be 0 regardless of whether the tests passed or failed.
Good point ;)
Signature · 2 lines
paul moore www.paul-moore.com
Stephen Smalley
maintainerQuoted 6 lines · Ondrej Mosnacek
Make sure that the test policy is properly unloaded when
make testfails, to prevent it from accidentally lingering on the system after a failed test.Signed-off-by Ondrej Mosnacek <[email protected]>
Not saying that you can't change it but the current behavior was intentional; it made it easier to quickly re-run the failing test(s) by hand in order to get more verbose output as per the README.
Quoted 11 lines · Stephen Smalley
Quoted 6 lines · Ondrej Mosnacek
Make sure that the test policy is properly unloaded when
make testfails, to prevent it from accidentally lingering on the system after a failed test.Signed-off-by Ondrej Mosnacek <[email protected]>Not saying that you can't change it but the current behavior was intentional; it made it easier to quickly re-run the failing test(s) by hand in order to get more verbose output as per the README.
Okay, that makes sense. I would expect the simple invocation to always clean up after itself, but then other people can expect the opposite, so I'll rather keep the status quo.
Signature · 3 lines
Ondrej Mosnacek Software Engineer, Platform Security - SELinux kernel Red Hat, Inc.