[apparmor] [patch 23/24] Make dbus tests be conditionally run based on pkg-config [v2]
John Johansen
john.johansen at canonical.com
Wed Mar 12 09:06:49 UTC 2014
On 03/11/2014 10:08 AM, Steve Beattie wrote:
> On Fri, Mar 07, 2014 at 09:31:44AM -0800, john.johansen at canonical.com wrote:
>> > The addition of the dbus tests requires dbus dev libraries be installed
>> > to run the test suite. This is not always desirable or even possible.
>> >
>> > So make building and running the dbus tests conditional on the
>> > pkg-config info from those libs. If they are not present output a
>> > message about skipping the tests.
> I'm okay with this idea; however, the pkg-config command wasn't actually
> being run, so no matter what, the dbus tests were getting skipped.
> Secondly, asking pkg-config for settings for a package that isn't
> installed, the error emitted goes to stderr, e.g.:
>
> Package dbus-1 was not found in the pkg-config search path.
> Perhaps you should add the directory containing `dbus-1.pc'
> to the PKG_CONFIG_PATH environment variable
> No package 'dbus-1' found
> No dbus pkg-config skipping dbus_eavesdrop dbus_message dbus_services tests ...
>
> which feels ugly to me, though (thirdly) I would like to see the
> warning message when dbus devel information cannot be found be more
> prominent.
>
> Anyway, attached is an updated patch which addresses the first two
> issues (but didn't address the prominence of the warning message).
>
> -- Steve Beattie <sbeattie at ubuntu.com> http://NxNW.org/~steve/
>
looks good to me, As for making the dbus message more prominent
how about something like
$(warning ${nl}\
************************************************************************${nl}\
No dbus pkg-config skipping dbus_eavesdrop dbus_message dbus_services tests ...${nl})\
Install libdbus-1-dev or equivalent package to build and run these tests${nl}\
************************************************************************${nl})
>
> jj-tests-cond-dbus.patch
>
>
> Subject: Make dbus tests be conditionally run based on pkg-config [v2]
>
> The addition of the dbus tests requires dbus dev libraries be installed
> to run the test suite. This is not always desirable or even possible.
>
> So make building and running the dbus tests conditional on the
> pkg-config info from those libs. If they are not present output a
> message about skipping the tests.
>
> Signed-off-by: John Johansen <john.johansen at canonical.com>
> Signed-off-by: Steve Beattie <steve at nxnw.org>
> ---
> tests/regression/apparmor/Makefile | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> Index: b/tests/regression/apparmor/Makefile
> ===================================================================
> --- a/tests/regression/apparmor/Makefile
> +++ b/tests/regression/apparmor/Makefile
> @@ -56,9 +56,6 @@ SRC=access.c \
> chown.c \
> clone.c \
> coredump.c \
> - dbus_eavesdrop.c \
> - dbus_message.c \
> - dbus_service.c \
> deleted.c \
> environ.c \
> env_check.c \
> @@ -115,6 +112,13 @@ ifneq (,$(findstring $(shell uname -i),i
> SRC+=syscall_ioperm.c syscall_iopl.c
> endif
>
> +#only do dbus if proper libs are installl
> +ifneq (,$(shell pkg-config --exists dbus-1 && echo TRUE))
> +SRC+=dbus_eavesdrop.c dbus_message.c dbus_service.c
> +else
> +$(info No dbus pkg-config skipping dbus_eavesdrop dbus_message dbus_services tests ...)
> +endif
> +
> EXEC=$(SRC:%.c=%)
>
> TESTS=access \
> @@ -128,9 +132,6 @@ TESTS=access \
> chdir \
> clone \
> coredump \
> - dbus_eavesdrop \
> - dbus_message \
> - dbus_service \
> deleted \
> environ \
> exec \
> @@ -169,6 +170,11 @@ TESTS=access \
> xattrs\
> longpath
>
> +#only do dbus if proper libs are installl
> +ifneq (,$(shell pkg-config --exists dbus-1 && echo TRUE))
> +TESTS+=dbus_eavesdrop dbus_message dbus_service
> +endif
> +
> # Tests that can crash the kernel should be placed here
> RISKY_TESTS=
>
>
>
>
> -- AppArmor mailing list AppArmor at lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/apparmor
>
More information about the AppArmor
mailing list