Skip to content

Commit 1dad99a

Browse files
captain5050namhyung
authored andcommitted
perf test: Make tests its own library
Make the tests code its own library. This is done to avoid compiling code twice, once for the perf tool and once for the perf python module. Signed-off-by: Ian Rogers <irogers@google.com> Reviewed-by: James Clark <james.clark@arm.com> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Kees Cook <keescook@chromium.org> Cc: Palmer Dabbelt <palmer@dabbelt.com> Cc: Albert Ou <aou@eecs.berkeley.edu> Cc: Nick Terrell <terrelln@fb.com> Cc: Gary Guo <gary@garyguo.net> Cc: Alex Gaynor <alex.gaynor@gmail.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Wedson Almeida Filho <wedsonaf@gmail.com> Cc: Ze Gao <zegao2021@gmail.com> Cc: Alice Ryhl <aliceryhl@google.com> Cc: Andrei Vagin <avagin@google.com> Cc: Yicong Yang <yangyicong@hisilicon.com> Cc: Jonathan Cameron <jonathan.cameron@huawei.com> Cc: Guo Ren <guoren@kernel.org> Cc: Miguel Ojeda <ojeda@kernel.org> Cc: Will Deacon <will@kernel.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Leo Yan <leo.yan@linux.dev> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: John Garry <john.g.garry@oracle.com> Cc: Benno Lossin <benno.lossin@proton.me> Cc: Björn Roy Baron <bjorn3_gh@protonmail.com> Cc: Andreas Hindborg <a.hindborg@samsung.com> Cc: Paul Walmsley <paul.walmsley@sifive.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Link: https://lore.kernel.org/r/20240625214117.953777-5-irogers@google.com
1 parent 49f4ac4 commit 1dad99a

File tree

13 files changed

+115
-104
lines changed

13 files changed

+115
-104
lines changed

tools/perf/Build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ endif
3636
perf-$(CONFIG_LIBELF) += builtin-probe.o
3737

3838
perf-y += bench/
39-
perf-y += tests/
39+
perf-test-y += tests/
4040

4141
perf-y += perf.o
4242

@@ -55,6 +55,7 @@ CFLAGS_builtin-report.o += -DDOCDIR="BUILD_STR($(srcdir_SQ)/Documentation)"
5555

5656
perf-y += util/
5757
perf-y += arch/
58+
perf-test-y += arch/
5859
perf-ui-y += ui/
5960
perf-y += scripts/
6061

tools/perf/Makefile.perf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,9 @@ endif
425425

426426
export PERL_PATH
427427

428+
LIBPERF_TEST_IN := $(OUTPUT)perf-test-in.o
429+
LIBPERF_TEST := $(OUTPUT)libperf-test.a
430+
428431
LIBPERF_UI_IN := $(OUTPUT)perf-ui-in.o
429432
LIBPERF_UI := $(OUTPUT)libperf-ui.a
430433

@@ -435,7 +438,7 @@ PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL)
435438
ifdef LIBBPF_STATIC
436439
PERFLIBS += $(LIBBPF)
437440
endif
438-
PERFLIBS += $(LIBPERF_UI) $(LIBPMU_EVENTS)
441+
PERFLIBS += $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS)
439442

440443
# We choose to avoid "if .. else if .. else .. endif endif"
441444
# because maintaining the nesting to match is a pain. If
@@ -737,6 +740,12 @@ $(LIBPMU_EVENTS_IN): FORCE prepare
737740
$(LIBPMU_EVENTS): $(LIBPMU_EVENTS_IN)
738741
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
739742

743+
$(LIBPERF_TEST_IN): FORCE prepare
744+
$(Q)$(MAKE) $(build)=perf-test
745+
746+
$(LIBPERF_TEST): $(LIBPERF_TEST_IN)
747+
$(QUIET_AR)$(RM) $@ && $(AR) rcs $@ $<
748+
740749
$(LIBPERF_UI_IN): FORCE prepare
741750
$(Q)$(MAKE) $(build)=perf-ui
742751

tools/perf/arch/Build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
perf-y += common.o
22
perf-y += $(SRCARCH)/
3+
perf-test-y += $(SRCARCH)/

tools/perf/arch/arm/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
perf-y += util/
2-
perf-$(CONFIG_DWARF_UNWIND) += tests/
2+
perf-test-$(CONFIG_DWARF_UNWIND) += tests/

tools/perf/arch/arm/tests/Build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
perf-y += regs_load.o
2-
perf-y += dwarf-unwind.o
3-
perf-y += vectors-page.o
1+
perf-test-y += regs_load.o
2+
perf-test-y += dwarf-unwind.o
3+
perf-test-y += vectors-page.o
44

5-
perf-y += arch-tests.o
5+
perf-test-y += arch-tests.o

tools/perf/arch/arm64/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
perf-y += util/
2-
perf-y += tests/
2+
perf-test-y += tests/

tools/perf/arch/arm64/tests/Build

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
perf-y += regs_load.o
2-
perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
1+
perf-test-y += regs_load.o
2+
perf-test-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
33

4-
perf-y += arch-tests.o
5-
perf-y += cpuid-match.o
4+
perf-test-y += arch-tests.o
5+
perf-test-y += cpuid-match.o

tools/perf/arch/powerpc/Build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
perf-y += util/
2-
perf-y += tests/
2+
perf-test-y += tests/
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
perf-$(CONFIG_DWARF_UNWIND) += regs_load.o
2-
perf-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
1+
perf-test-$(CONFIG_DWARF_UNWIND) += regs_load.o
2+
perf-test-$(CONFIG_DWARF_UNWIND) += dwarf-unwind.o
33

4-
perf-y += arch-tests.o
4+
perf-test-y += arch-tests.o

tools/perf/arch/x86/Build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
perf-y += util/
2-
perf-y += tests/
2+
perf-test-y += tests/
33

44
ifdef SHELLCHECK
55
SHELL_TESTS := entry/syscalls/syscalltbl.sh
@@ -13,4 +13,4 @@ $(OUTPUT)%.shellcheck_log: %
1313
$(call rule_mkdir)
1414
$(Q)$(call echo-cmd,test)shellcheck -a -S warning "$<" > $@ || (cat $@ && rm $@ && false)
1515

16-
perf-y += $(TEST_LOGS)
16+
perf-test-y += $(TEST_LOGS)

0 commit comments

Comments
 (0)