]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gprof: Update PR gprof/32764 test
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 7 Mar 2025 05:55:06 +0000 (13:55 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 7 Mar 2025 07:05:57 +0000 (15:05 +0800)
1. Remove gmon.out first before generating it in the configure check.
2. Make tst-gmon-gprof.out depend on the gprof binary.
3. Check that gmon.out is non-empty.
4. Don't include <sys/cdefs.h> in tst-gmon.c.

PR gprof/32764
* configure.ac: Remove gmon.out first.
* configure: Regenerated.
* testsuite/Makefile.am (tst-gmon-gprof.out): Depend on
$(GPROF).
* testsuite/Makefile.in: Regenerated.
* testsuite/tst-gmon-gprof.sh: Check that gmon.out is non-empty.
* testsuite/tst-gmon.c: Don't include <sys/cdefs.h>.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
gprof/configure
gprof/configure.ac
gprof/testsuite/Makefile.am
gprof/testsuite/Makefile.in
gprof/testsuite/tst-gmon-gprof.sh
gprof/testsuite/tst-gmon.c

index ad2033c802a49cc945e9fa6e12988f97e333fb19..b830da03289f624caac41ca04009e40e18875ee9 100755 (executable)
@@ -13973,6 +13973,7 @@ else
     gprof_cv_sys_native=no
   if test x"${host}" = x"${target}" \
      && ${CC-cc} -O2 -pg -o tst-gmon $srcdir/testsuite/tst-gmon.c; then
+    rm -f gmon.out
     ./tst-gmon
     if test -s gmon.out; then
       gprof_cv_sys_native=yes
index 37eff97b2c2eedca230228702b5dfd302611bcef..f74da7d309aabc8d50b38a4684d623f1a1c60c6c 100644 (file)
@@ -78,6 +78,7 @@ AC_CACHE_CHECK([whether gprof tests can run],
   gprof_cv_sys_native=no
   if test x"${host}" = x"${target}" \
      && ${CC-cc} -O2 -pg -o tst-gmon $srcdir/testsuite/tst-gmon.c; then
+    rm -f gmon.out
     ./tst-gmon
     if test -s gmon.out; then
       gprof_cv_sys_native=yes
index 17ee148df5b5a76db92a6f0bdd3bcc4c86b16238..7cc95e33f1b749933067f8b6bf3293121005338d 100644 (file)
@@ -32,7 +32,7 @@ tst-gmon.$(OBJEXT): tst-gmon.c
        $(COMPILE) -c -o $@ $<
 tst-gmon: tst-gmon.$(OBJEXT)
        $(LINK) tst-gmon.$(OBJEXT)
-tst-gmon-gprof.out: tst-gmon$(EXEEXT)
+tst-gmon-gprof.out: tst-gmon$(EXEEXT) $(GPROF)
        $(srcdir)/tst-gmon-gprof.sh $(GPROF) tst-gmon$(EXEEXT)
 
 endif NATIVE
index 87ce1dcf8861529904da799154edc5bb6a15d162..91d2854c4389c58af49c36c99f2f06d9e5f9bc95 100644 (file)
@@ -875,7 +875,7 @@ uninstall-am:
 @NATIVE_TRUE@  $(COMPILE) -c -o $@ $<
 @NATIVE_TRUE@tst-gmon: tst-gmon.$(OBJEXT)
 @NATIVE_TRUE@  $(LINK) tst-gmon.$(OBJEXT)
-@NATIVE_TRUE@tst-gmon-gprof.out: tst-gmon$(EXEEXT)
+@NATIVE_TRUE@tst-gmon-gprof.out: tst-gmon$(EXEEXT) $(GPROF)
 @NATIVE_TRUE@  $(srcdir)/tst-gmon-gprof.sh $(GPROF) tst-gmon$(EXEEXT)
 
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
index 562d4806e96f051ee50406df1f1dec4fe34ac08f..deaa802837479f546a2a85cee0b761f3c2298cb3 100755 (executable)
@@ -28,7 +28,7 @@ program="$2"
 data=gmon.out
 rm -f $data
 ./$program
-if test ! -f $data; then
+if test ! -s $data; then
     echo "FAIL"
     exit 1
 fi
index add2d9253c254454f78936f364a8dd5e502422c9..917f5e64af4dad3f8d18020a8da53907b9caeb35 100644 (file)
@@ -16,8 +16,6 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <sys/cdefs.h>
-
 /* This program does not use the test harness because we want tight
    control over the call graph.  */