Re: [PATCH 01/27] perf tools: Add automated make test suite

From: Sam Ravnborg
Date: Mon Apr 01 2013 - 15:53:23 EST


On Mon, Apr 01, 2013 at 09:18:24PM +0200, Jiri Olsa wrote:
> Adding automatd test for testing the build process.
> To run it you needto be in perf directory or specify
> one with PERF variable. It's also possible to specify
> optional Makefile to test via MK variable.
>
> Whole suite is executed twice, the second time with
> O=/tmp/xxx option added.
>
> To run the whole suite:
> $ make -f tests/make
> MAKE_PURE: cd . && make -f Makefile
> TEST: test -x ./perf
> MAKE_DEBUG: cd . && make -f Makefile DEBUG=1
> TEST: test -x ./perf
> ...
>
> You see command line for 'MAKE_PURE' test right away,
> and the output is stored into MAKE_PURE file.
>
> To run simple test:
> $ make -f tests/make MAKE_DEBUG
> MAKE_DEBUG: cd . && make -f Makefile DEBUG=1
> TEST: test -x ./perf
>
> At this moment tests checks for succesfull build
> and for existence of several built files. Additional
> after-build checks could be added.

Some nit-picks.
I did not try to find out how this works.

> +
> +MAKE_DEBUG := DEBUG=1
> +MAKE_NO_LIBPERL := NO_LIBPERL=1

Why all these ugly UPPERCASE names?
In kbuild files the unwritten rule is that variables
with global scope are upper-case.
And variables with local scope are lower case.

You can find many examples where this is not followed - but this
is the general approach.

> +MAKE_MINIMAL := NO_LIBPERL=1 NO_LIBPYTHON=1 NO_NEWT=1 NO_GTK2=1 NO_DEMANGLE=1 NO_LIBELF=1 NO_LIBUNWIND=1 NO_BACKTRACE=1 NO_LIBNUMA=1 NO_LIBAUDIT=1 NO_LIBBIONIC=1

Keeping lines less than 120 chars long is good.
Some people swer to 80 chars.

> +RUN := \
> + MAKE_PURE \
> + MAKE_DEBUG \
> + MAKE_NO_LIBPERL \

RUN += MAKE_PURE
RUN += MAKE_DEBUG
RUN += MAKE_NO_LIBPERL

Is so much more readable.
As a general rule - use \
to continue lines only when you really have to.

Sam
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/