Skip to content

Commit f8aa60b

Browse files
committed
perf test: Make tests its own library
JIRA: https://issues.redhat.com/browse/RHEL-29795 upstream ======== commit 1dad99a Author: Ian Rogers <irogers@google.com> Date: Tue Jun 25 14:41:13 2024 -0700 description =========== 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 Signed-off-by: Michael Petlan <mpetlan@redhat.com>
1 parent 8c56db6 commit f8aa60b

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
@@ -426,6 +426,9 @@ endif
426426

427427
export PERL_PATH
428428

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

@@ -436,7 +439,7 @@ PERFLIBS = $(LIBAPI) $(LIBPERF) $(LIBSUBCMD) $(LIBSYMBOL)
436439
ifdef LIBBPF_STATIC
437440
PERFLIBS += $(LIBBPF)
438441
endif
439-
PERFLIBS += $(LIBPERF_UI) $(LIBPMU_EVENTS)
442+
PERFLIBS += $(LIBPERF_TEST) $(LIBPERF_UI) $(LIBPMU_EVENTS)
440443

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

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

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)