Patchwork libstdc++: Fix up explicit-hle.cc test

login
register
mail settings
Submitter Jakub Jelinek
Date Jan. 22, 2013, 5 p.m.
Message ID <20130122170044.GZ7269@tucnak.redhat.com>
Download mbox | patch
Permalink /patch/214605/
State New
Headers show

Comments

Jakub Jelinek - Jan. 22, 2013, 5 p.m.
On Mon, Jan 21, 2013 at 03:05:45PM +0100, Jakub Jelinek wrote:
> On Sun, Jan 13, 2013 at 10:06:05PM -0800, Andi Kleen wrote:
> > 2013-01-12  Andi Kleen  <ak@linux.intel.com>
> > 	    Jonathan Wakely  <jwakely.gcc@gmail.com>
> > 
> >         PR libstdc++/55223
> > 	* testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc:
> > 	Add.
> 
> The test is broken on i?86-linux,
> 
> > --- /dev/null
> > +++ b/libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc
> > @@ -0,0 +1,120 @@
> > +// { dg-options "-std=gnu++0x" }
> 
> 1) you need // { dg-additional-options "-march=i486" { target ia32 } }
>    or something similar, otherwise for a pure i386 target it will not work right
> 
> > +// { dg-do compile { target i?86-*-* x86_64-*-* } }
> > +// { dg-final { scan-assembler-times "\(xacquire\|\.byte.*0xf2\)" 14 } }
> > +// { dg-final { scan-assembler-times "\(xrelease\|\.byte.*0xf3\)" 14 } }
> 
> 2) \.byte.*0xf needs to be replaced by \.byte\[^\n\r]*0xf
>    otherwise it will happily match say
>         .byte   0                                                                                                                                  
>         .uleb128 0x2d                                                                                                                              
>         .long   0xf23                                                                                                                              
>    in .debug_info
> 
> 3) I guess you want to add "-g0 -fno-exceptions -fno-asynchronous-unwind-tables"
>    to double check that .byte 0xf2 or .byte 0xf3 won't suddenly appear in
>    .debug_* or .eh_frame sections.

Now in the form of a tested patch (regtested on x86_64-linux and
i686-linux).  Ok for trunk?

dg-additional-options unfortunately isn't supported in libstdc++ testsuite,
so had to use second dg-options, and also the \(, \) were wrong and resulted
in no matches.

2013-01-22  Jakub Jelinek  <jakub@redhat.com>

	* testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc:
	Tightten scan-assembler-times regexps, add dg-additional-options for
	ia32, add -g0 -fno-exceptions -fno-asynchronous-unwind-tables to
	dg-options.



	Jakub
Jonathan Wakely - Jan. 22, 2013, 5:12 p.m.
On 22 January 2013 17:00, Jakub Jelinek wrote:
>
> Now in the form of a tested patch (regtested on x86_64-linux and
> i686-linux).  Ok for trunk?

OK, thanks.

> dg-additional-options unfortunately isn't supported in libstdc++ testsuite,
> so had to use second dg-options, and also the \(, \) were wrong and resulted
> in no matches.

Kai has a forthcoming patch to add dg-additional-options:
http://gcc.gnu.org/ml/gcc-patches/2013-01/msg00945.html
Andi Kleen - Jan. 22, 2013, 5:23 p.m.
> Now in the form of a tested patch (regtested on x86_64-linux and
> i686-linux).  Ok for trunk?
> 
> dg-additional-options unfortunately isn't supported in libstdc++ testsuite,
> so had to use second dg-options, and also the \(, \) were wrong and resulted
> in no matches.

Looks good to me (but cannot approve). Thanks Jakub for fixing this up.

-Andi

> 
> 2013-01-22  Jakub Jelinek  <jakub@redhat.com>
> 
> 	* testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc:
> 	Tightten scan-assembler-times regexps, add dg-additional-options for
> 	ia32, add -g0 -fno-exceptions -fno-asynchronous-unwind-tables to
> 	dg-options.
> 
> --- libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc.jj	2013-01-21 10:57:10.199935240 +0100
> +++ libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc	2013-01-22 14:46:15.851668073 +0100
> @@ -1,9 +1,10 @@
> -// { dg-options "-std=gnu++0x" }
>  // { dg-do compile { target i?86-*-* x86_64-*-* } }
> -// { dg-final { scan-assembler-times "\(xacquire\|\.byte.*0xf2\)" 14 } }
> -// { dg-final { scan-assembler-times "\(xrelease\|\.byte.*0xf3\)" 14 } }
> +// { dg-options "-std=gnu++0x -g0 -fno-exceptions -fno-asynchronous-unwind-tables" }
> +// { dg-options "-std=gnu++0x -g0 -fno-exceptions -fno-asynchronous-unwind-tables -march=i486" { target ia32 } }
> +// { dg-final { scan-assembler-times "xacquire\|\.byte\[^\n\r]*0xf2" 14 } }
> +// { dg-final { scan-assembler-times "xrelease\|\.byte\[^\n\r]*0xf3" 14 } }
>  
> -// Copyright (C) 2008, 2009, 2013 Free Software Foundation, Inc.
> +// Copyright (C) 2008-2013 Free Software Foundation, Inc.
>  //
>  // This file is part of the GNU ISO C++ Library.  This library is free
>  // software; you can redistribute it and/or modify it under the
> 
> 
> 	Jakub
>

Patch

--- libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc.jj	2013-01-21 10:57:10.199935240 +0100
+++ libstdc++-v3/testsuite/29_atomics/atomic_flag/test_and_set/explicit-hle.cc	2013-01-22 14:46:15.851668073 +0100
@@ -1,9 +1,10 @@ 
-// { dg-options "-std=gnu++0x" }
 // { dg-do compile { target i?86-*-* x86_64-*-* } }
-// { dg-final { scan-assembler-times "\(xacquire\|\.byte.*0xf2\)" 14 } }
-// { dg-final { scan-assembler-times "\(xrelease\|\.byte.*0xf3\)" 14 } }
+// { dg-options "-std=gnu++0x -g0 -fno-exceptions -fno-asynchronous-unwind-tables" }
+// { dg-options "-std=gnu++0x -g0 -fno-exceptions -fno-asynchronous-unwind-tables -march=i486" { target ia32 } }
+// { dg-final { scan-assembler-times "xacquire\|\.byte\[^\n\r]*0xf2" 14 } }
+// { dg-final { scan-assembler-times "xrelease\|\.byte\[^\n\r]*0xf3" 14 } }
 
-// Copyright (C) 2008, 2009, 2013 Free Software Foundation, Inc.
+// Copyright (C) 2008-2013 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the