[apparmor] [patch] fix test-aa-decode.py

Seth Arnold seth.arnold at canonical.com
Fri Feb 28 00:07:06 UTC 2014


On Thu, Feb 27, 2014 at 03:58:00PM -0800, Steve Beattie wrote:
> On Thu, Feb 27, 2014 at 09:47:35PM +0100, Christian Boltz wrote:
> > test-aa-decode.py is also called by "make check" (utils/Makefile), but 
> > as "test/test-aa-decode.py" - and if called this way, ./aa-decode is 
> > right because it has a different pwd.
> > 
> > Looks like we should find a solution that works with make check _and_ a 
> > manual call ("./test-aa-decode.py"). Any ideas?
> 
> Probably the best way to fix this is to push the make check call into
> the test/ subdirectory, like in the attached patch (which includes
> your updated path for aa-decode). Thanks.
> 
> Also attached is a second patch that hooks in the (former) test target
> in the utils/vim/ subdirectory.

Both patches look good to me, I like the consistent 'make check' target.

Acked-by: Seth Arnold <seth.arnold at canonical.com>

> Signed-off-by: Steve Beattie <steve at nxnw.org>
> ---
>  utils/Makefile               |    5 +++--
>  utils/test/Makefile          |   41 +++++++++++++++++++++++++++++++++++++++++
>  utils/test/test-aa-decode.py |    2 +-
>  3 files changed, 45 insertions(+), 3 deletions(-)
> 
> Index: b/utils/Makefile
> ===================================================================
> --- a/utils/Makefile
> +++ b/utils/Makefile
> @@ -70,9 +70,10 @@ clean: _clean
>  	rm -f Make.rules
>  	$(MAKE) -C po clean
>  	$(MAKE) -C vim clean
> +	$(MAKE) -C test clean
>  	rm -rf staging/ build/
>  	rm -f apparmor/*.pyc
> -	rm -rf test/__pycache__/ apparmor/__pycache__/
> +	rm -rf apparmor/__pycache__/
>  
>  # ${CAPABILITIES} is defined in common/Make.rules
>  .PHONY: check_severity_db
> @@ -100,4 +101,4 @@ check: check_severity_db
>  		test -s $$tmpfile && cat $$tmpfile && rm -f $$tmpfile && exit 1; \
>  	done || true; \
>  	rm -f $$tmpfile
> -	$(foreach test, $(wildcard test/test-*.py), $(call pyalldo, $(test)))
> +	$(MAKE) -C test check
> Index: b/utils/test/Makefile
> ===================================================================
> --- /dev/null
> +++ b/utils/test/Makefile
> @@ -0,0 +1,41 @@
> +# ----------------------------------------------------------------------
> +#    Copyright (c) 1999, 2004-2009 NOVELL (All rights reserved)
> +#    Copyright (c) 2010-2014 Canonical Ltd.
> +#
> +#    This program is free software; you can redistribute it and/or
> +#    modify it under the terms of version 2 of the GNU General Public
> +#    License published by the Free Software Foundation.
> +#
> +#    This program is distributed in the hope that it will be useful,
> +#    but WITHOUT ANY WARRANTY; without even the implied warranty of
> +#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> +#    GNU General Public License for more details.
> +#
> +#    You should have received a copy of the GNU General Public License
> +#    along with this program; if not, contact Novell, Inc.
> +# ----------------------------------------------------------------------
> +NAME 		= apparmor-utils
> +all:
> +COMMONDIR=../../common/
> +
> +include common/Make.rules
> +
> +COMMONDIR_EXISTS=$(strip $(shell [ -d ${COMMONDIR} ] && echo true))
> +ifeq ($(COMMONDIR_EXISTS), true)
> +common/Make.rules: $(COMMONDIR)/Make.rules
> +	ln -sf $(COMMONDIR) .
> +endif
> +
> +.PHONY: clean
> +ifndef VERBOSE
> +.SILENT: clean
> +endif
> +clean: _clean
> +	rm -rf __pycache__/
> +
> +.PHONY: check
> +ifndef VERBOSE
> +.SILENT: check
> +endif
> +check:
> +	$(foreach test, $(wildcard test-*.py), $(call pyalldo, $(test)))
> Index: b/utils/test/test-aa-decode.py
> ===================================================================
> --- a/utils/test/test-aa-decode.py
> +++ b/utils/test/test-aa-decode.py
> @@ -18,7 +18,7 @@ import unittest
>  # The locationg of the aa-decode utility can be overridden by setting
>  # the APPARMOR_DECODE environment variable; this is useful for running
>  # these tests in an installed environment
> -aadecode_bin = "./aa-decode"
> +aadecode_bin = "../aa-decode"
>  
>  # http://www.chiark.greenend.org.uk/ucgi/~cjwatson/blosxom/2009-07-02-python-sigpipe.html
>  # This is needed so that the subprocesses that produce endless output

> Signed-off-by: Steve Beattie <steve at nxnw.org>
> ---
>  utils/Makefile     |    1 +
>  utils/vim/Makefile |    3 ++-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> Index: b/utils/Makefile
> ===================================================================
> --- a/utils/Makefile
> +++ b/utils/Makefile
> @@ -102,3 +102,4 @@ check: check_severity_db
>  	done || true; \
>  	rm -f $$tmpfile
>  	$(MAKE) -C test check
> +	$(MAKE) -C vim check
> Index: b/utils/vim/Makefile
> ===================================================================
> --- a/utils/vim/Makefile
> +++ b/utils/vim/Makefile
> @@ -24,7 +24,8 @@ install: apparmor.vim manpages
>  	install -m 644 $< $(VIM_INSTALL_PATH)
>  	$(MAKE) install_manpages DESTDIR=${DESTDIR}
>  
> -test: apparmor.vim.in Makefile create-apparmor.vim.py
> +.PHONY: check
> +check:
>  	#Testing with all pythons
>  	$(call pyalldo, create-apparmor.vim.py > /dev/null)
>  

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20140227/61aa747a/attachment-0001.pgp>


More information about the AppArmor mailing list