mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@elte.hu>, Paul Mackerras <paulus@samba.org>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Borislav Petkov <bp@alien8.de>,
	Stephane Eranian <eranian@google.com>,
	Sam Ravnborg <sam@ravnborg.org>, David Ahern <dsahern@gmail.com>
Subject: Re: [PATCH 01/26] perf tools: Add automated make test suite
Date: Thu, 25 Apr 2013 18:05:01 +0900	[thread overview]
Message-ID: <871u9z9e0y.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <1366796273-4780-2-git-send-email-jolsa@redhat.com> (Jiri Olsa's message of "Wed, 24 Apr 2013 11:37:28 +0200")

On Wed, 24 Apr 2013 11:37:28 +0200, Jiri Olsa wrote:
> Adding automated test for testing the build process.
> To run it you need to be in perf directory or specify
> one with PERF variable. It's also possible to specify
> optional Makefile to test via MK variable.

  $ pwd
  /home/namhyung/project/linux

  $ make -f tools/perf/tests/make PERF=tools/perf
  - make_pure: cd tools/perf && make -f Makefile 
    test: test -x tools/perf/perf
  make: *** [make_pure] Error 1

  $ cat tools/perf/make_pure 
  cd tools/perf && make -f Makefile
  /bin/sh: line 3: cd: tools/perf: No such file or directory


I guess it's because calling 'clean' does cd $(PERF) in it.
Please see below.

>
> 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_clean_all: cd . && make -f Makefile clean all
>     test: test -x ./perf
>   - make_python_perf_so: cd . && make -f Makefile python/perf.so
>     test: test -f ./python/perf.so
>   - make_debug: cd . && make -f Makefile DEBUG=1
>     test: test -x ./perf
>   - make_no_libperl: cd . && make -f Makefile NO_LIBPERL=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 successfull build
> and for existence of several built files. Additional
> after-build checks could be added.
>
> Signed-off-by: Jiri Olsa <jolsa@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
> Cc: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Stephane Eranian <eranian@google.com>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: David Ahern <dsahern@gmail.com>
> ---
>  tools/perf/tests/make | 141 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 141 insertions(+)
>  create mode 100644 tools/perf/tests/make
>
> diff --git a/tools/perf/tests/make b/tools/perf/tests/make
> new file mode 100644
> index 0000000..6fdc8f5
> --- /dev/null
> +++ b/tools/perf/tests/make
> @@ -0,0 +1,141 @@
> +ifndef PERF
> +PERF := .
> +endif
> +
> +ifndef MK
> +MK := Makefile
> +endif

I think these two can be plain assignment without ifndef's as they
can be overridden from command line.

> +
> +# standard single make variable specified
[SNIP]
> +
> +clean := @cd $(PERF); make -s -f $(MK) clean >/dev/null

Why is this clean a function (or macro) rather than a 
prerequisites?  And it could be a single command:

  make -s -C $(PERF) -f $(MK) clean

One more good thing of this is that it doesn't change the current
directory.

> +
> +$(run):
> +	$(call clean) && \
> +	cmd="cd $(PERF) && make -f $(MK) $($@)"; \

So this could be

  $(run): clean
	cmd="make -C $(PERF) -f $(MK) $($@)"; \

> +	echo "- $@: $$cmd" && echo $$cmd > $@ && \
> +	( eval $$cmd ) >> $@ 2>&1; \
> +	echo "  test: $(call test,$@)"; \
> +	$(call test,$@)

It seems it doesn't delete result files.  Wouldn't it be better
deleting them - at least in case of success?

> +
> +$(run_O):
> +	$(call clean) && \
> +	TMP=$$(mktemp -d); \
> +	cmd="cd $(PERF) && make -f $(MK) $($(patsubst %_O,%,$@)) O=$$TMP"; \

Same as above.


> +	echo "- $@: $$cmd" && echo $$cmd > $@ && \
> +	( eval $$cmd ) >> $@ 2>&1 && \
> +	echo "  test: $(call test_O,$@)"; \
> +	$(call test_O,$@) && \
> +	rm -rf $$TMP
> +
> +all: $(run) $(run_O)
> +	@echo OK

Finally, I hope we can do this parallelly (i.e. with -j XX) at least
for $(run_O) targets only.  Is that possible?

Thanks,
Namhyung


> +
> +out: $(run_O)
> +	@echo OK
> +
> +.PHONY: all $(run) $(run_O) clean

  reply	other threads:[~2013-04-25  9:05 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-24  9:37 [PATCHv2 00/26] perf tools: Makefile changes Jiri Olsa
2013-04-24  9:37 ` [PATCH 01/26] perf tools: Add automated make test suite Jiri Olsa
2013-04-25  9:05   ` Namhyung Kim [this message]
2013-04-24  9:37 ` [PATCH 02/26] perf tools: Fix tab vs spaces issue in Makefile ifdef/endif Jiri Olsa
2013-05-31 11:29   ` [tip:perf/core] " tip-bot for Jiri Olsa
2013-04-24  9:37 ` [PATCH 03/26] perf tools: Move arch check into config/Makefile Jiri Olsa
2013-04-25  9:15   ` Namhyung Kim
2013-04-26 11:37     ` Jiri Olsa
2013-04-26 16:18       ` Jiri Olsa
2013-05-06  2:03         ` Namhyung Kim
2013-04-24  9:37 ` [PATCH 04/26] perf tools: Move programs " Jiri Olsa
2013-04-24  9:37 ` [PATCH 05/26] perf tools: Move compiler and linker flags " Jiri Olsa
2013-04-24  9:37 ` [PATCH 06/26] perf tools: Move libelf check config " Jiri Olsa
2013-04-24  9:37 ` [PATCH 07/26] perf tools: Move libdw " Jiri Olsa
2013-04-24  9:37 ` [PATCH 08/26] perf tools: Move libunwind " Jiri Olsa
2013-04-24  9:37 ` [PATCH 09/26] perf tools: Move libaudit " Jiri Olsa
2013-04-24  9:37 ` [PATCH 10/26] perf tools: Move slang " Jiri Olsa
2013-04-24  9:37 ` [PATCH 11/26] perf tools: Move gtk2 " Jiri Olsa
2013-04-24  9:37 ` [PATCH 12/26] perf tools: Move libperl " Jiri Olsa
2013-04-24  9:37 ` [PATCH 13/26] perf tools: Move libpython " Jiri Olsa
2013-04-24  9:37 ` [PATCH 14/26] perf tools: Move libbfd " Jiri Olsa
2013-04-24  9:37 ` [PATCH 15/26] perf tools: Move stdlib " Jiri Olsa
2013-04-24  9:37 ` [PATCH 16/26] perf tools: Move libnuma " Jiri Olsa
2013-04-24  9:37 ` [PATCH 17/26] perf tools: Move paths " Jiri Olsa
2013-04-24  9:37 ` [PATCH 18/26] perf tools: Final touches for CHK config move Jiri Olsa
2013-04-24  9:37 ` [PATCH 19/26] perf tools: Merge all *CFLAGS* make variable into CFLAGS Jiri Olsa
2013-04-24  9:37 ` [PATCH 20/26] perf tools: Merge all *LDFLAGS* make variable into LDFLAGS Jiri Olsa
2013-04-24  9:37 ` [PATCH 21/26] perf tools: Switch to full patch C include directories Jiri Olsa
2013-04-26 16:26   ` David Ahern
2013-04-29 10:02     ` Jiri Olsa
2013-04-24  9:37 ` [PATCH 22/26] perf tools: Add NO_BIONIC variable to confiure bionic setup Jiri Olsa
2013-04-24  9:37 ` [PATCH 23/26] perf tools: Replace tabs with spaces for all non-commands statements Jiri Olsa
2013-04-24  9:37 ` [PATCH 24/26] perf tools: Replace multiple line assignment with multiple statements Jiri Olsa
2013-04-24  9:37 ` [PATCH 25/26] perf tools: Remove '?=' Makefile STRIP assignment Jiri Olsa
2013-04-24  9:37 ` [PATCH 26/26] perf tools: Add missing liblk.a dependency for python/perf.so Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871u9z9e0y.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=bp@alien8.de \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=sam@ravnborg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome