summaryrefslogtreecommitdiff
path: root/gmon/Makefile
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-08-15 15:49:40 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-08-15 15:49:45 +0200
commit6014c65de2ac75ac4ef147754d80c7992f07ece8 (patch)
treefb1c32b9acf4a86ce341a0ce8eb5923de389d30f /gmon/Makefile
parentee72219a497b6317c49dc0a9a02308fe408c8c5e (diff)
downloadglibc-6014c65de2ac75ac4ef147754d80c7992f07ece8.tar.gz
gmon: Add test for basic mcount/gprof functionality
Diffstat (limited to 'gmon/Makefile')
-rw-r--r--gmon/Makefile18
1 files changed, 17 insertions, 1 deletions
diff --git a/gmon/Makefile b/gmon/Makefile
index 6ff4cb0dfb..947e6b5905 100644
--- a/gmon/Makefile
+++ b/gmon/Makefile
@@ -27,7 +27,7 @@ routines := gmon mcount profil sprofil bb_init_func bb_exit_func prof-freq
elide-routines.os = bb_init_func bb_exit_func
-tests = tst-sprofil
+tests = tst-sprofil tst-gmon
ifeq ($(build-profile),yes)
tests += tst-profile-static
tests-static += tst-profile-static
@@ -38,6 +38,12 @@ endif
# The mcount code won't work without a frame pointer.
CFLAGS-mcount.c := -fno-omit-frame-pointer
+CFLAGS-tst-gmon.c := -pg
+LDFLAGS-tst-gmon := $(no-pie-ldflag)
+CRT-tst-gmon := $(csu-objpfx)gcrt1.o
+tst-gmon-ENV := GMON_OUT_PREFIX=$(objpfx)tst-gmon.data
+tests-special += $(objpfx)tst-gmon-gprof.out
+
include ../Rules
# We cannot compile mcount.c with -pg because that would
@@ -53,3 +59,13 @@ endif
$(noprof:%=$(objpfx)%.op): %.op: %.o
rm -f $@
ln $< $@
+
+# GMON_OUTPUT_PREFIX only sets the output prefix. The actual file
+# name contains the PID as well.
+$(objpfx)tst-gmon.out: clean-tst-gmon-data
+clean-tst-gmon-data:
+ rm -f $(objpfx)tst-gmon.data.*
+
+$(objpfx)tst-gmon-gprof.out: tst-gmon-gprof.sh $(objpfx)tst-gmon.out
+ $(SHELL) $< $(GPROF) $(objpfx)tst-gmon $(objpfx)tst-gmon.data.* > $@; \
+ $(evaluate-test)