[apparmor] [PATCH v2] parser_common.c and unit test cleanups

Steve Beattie steve at nxnw.org
Thu May 19 23:28:11 UTC 2011


On Wed, May 11, 2011 at 03:52:07AM -0700, Kees Cook wrote:
> [v2: added clean-ups, backed off on some of the build silencing]
> 
> This is a rather large rearrangement of how a subset of the parser global
> variables are defined. Right now, there are unit tests built without
> linking against parser_main.c. As a result, none of the globals defined in
> parser_main.c could be used in the code that is built for unit tests
> (misc, regex, symtab, variable). To get a clean build, either stubs needed
> to be added to "#ifdef UNIT_TEST" blocks in each .c file, or we had to
> depend on link-time optimizations that would throw out the unused routines.
> 
> First, this is a problem because all the compile-time warnings had to be
> explicitly silenced, so reviewing the build logs becomes difficult on
> failures, and we can potentially (in really unlucky situations) test
> something that isn't actually part of the "real" parser.
> 
> Second, not all compilers will allow this kind of linking (e.g. mips gcc),
> and the missing symbols at link time will fail the entire build even though
> they're technically not needed.
> 
> To solve all of this, I've moved all of the global variables used in lex,
> yacc, and main to parser_common.c, and adjusted the .h files. On top of
> this, I made sure to fully link the tst builds so all symbols are resolved
> (including aare lib) and removedonly  tst build-log silencing (for now,
> deferring to another future patchset to consolidate the build silencing).

Can you incorporate the following to parser/Makefile?

+parser_common.o: parser_common.c parser.h
+       $(CC) $(EXTRA_CFLAGS) -c -o $@ $<
+

With the above added, Acked-By: Steve Beattie <sbeattie at ubuntu.com>

(Fixing it so adding entries like that isn't necessary would be useful,
too.)

Thanks!

-- 
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/apparmor/attachments/20110519/0ab9f5ae/attachment.pgp>


More information about the AppArmor mailing list