[PATCH] gprof: Copy a simple test from glibc
H.J. Lu
hjl.tools@gmail.com
Tue Apr 1 15:15:35 GMT 2025
On Tue, Apr 1, 2025 at 1:49 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 01.04.2025 09:37, Jan Beulich wrote:
> > On 31.03.2025 18:37, H.J. Lu wrote:
> >> Please verify if this glibc bug:
> >>
> >> https://sourceware.org/bugzilla/show_bug.cgi?id=28153
> >>
> >> is the cause.
> >
> > Well, yes, main() is before _start() in the executables on both systems.
> > The older system has glibc 2.22, the newer glibc 2.26. And no, I do not
> > think I should be upgrading the distros there. As said on earlier
> > occasions, testcases ought to work independent of the underlying
> > platform, or be disabled if they can't be made work in older
> > environments.
> >
> > I couldn't find a command line option to pass to gcc to avoid use of
> > .text.startup / .text.startup.main. Adding
> > __attribute__((section(".text.main"))) may help, but may not be portable
> > enough.
>
> This
>
> --- a/gprof/testsuite/tst-gmon.c
> +++ b/gprof/testsuite/tst-gmon.c
> @@ -45,6 +45,7 @@ f3 (int count)
> }
> }
>
> +__attribute__ ((section (".text.main"))) /* See glibc bug 28153. */
> int
> main (void)
> {
>
> indeed helps. Since there are __attribute__ ((weak)) already in the test,
> this may even be acceptable.
>
> However, further observations on these new tests: The test status summary
> doesn't appear at all when any of these tests fail:
>
> Making check in testsuite
> --- expected
> +++ actual
> @@ -1,3 +1,2 @@
> f1 2000
> f2 1000
> -f3 1
> FAIL
> make[5]: *** [Makefile:888: tst-gmon-gprof.out] Error 1
> --- expected
> +++ actual
> @@ -1,3 +1,2 @@
> 25 f1 2000
> 31 f2 1000
> -40 f3 1
> FAIL
> make[5]: *** [Makefile:890: tst-gmon-gprof-l.out] Error 1
> make[4]: *** [Makefile:761: check-am] Error 2
> make[4]: Target 'check' not remade because of errors.
> make[3]: *** [Makefile:848: check-recursive] Error 1
> make[2]: *** [Makefile:948: check] Error 2
> make[1]: *** [Makefile:6910: check-gprof] Error 2
>
> Then, when I had these tests temporarily disabled, the summary looked
> like this:
>
> Making check in testsuite
> PASS: tst-gmon-gprof.sh
> PASS: tst-gmon-gprof-l.sh
> ============================================================================
> Testsuite summary for gprof 2.44.50
> ============================================================================
> # TOTAL: 2
> # PASS: 2
> # SKIP: 0
> # XFAIL: 0
> # FAIL: 0
> # XPASS: 0
> # ERROR: 0
> ============================================================================
>
> Now, with the tests re-enabled I get this:
>
> Making check in testsuite
> PASS
> PASS
> PASS: tst-gmon-gprof.sh
> PASS: tst-gmon-gprof-l.sh
> ============================================================================
> Testsuite summary for gprof 2.44.50
> ============================================================================
> # TOTAL: 2
> # PASS: 2
> # SKIP: 0
> # XFAIL: 0
> # FAIL: 0
> # XPASS: 0
> # ERROR: 0
> ============================================================================
>
> Note how the count of tests hasn't changed, and how the first two "PASS"
> don't say what has passed.
>
> Jan
This is because automake tests don't take arguments for the test script.
--
H.J.
More information about the Binutils
mailing list