Patchwork [v3] adjust weak_ptr testcase

login
register
mail settings
Submitter Jonathan Wakely
Date Feb. 5, 2012, 1:10 p.m.
Message ID <CAH6eHdRNi+U2EYzEyvphrWwvJZZs6LhU=aJJ4XJK4YNKaEh4tA@mail.gmail.com>
Download mbox | patch
Permalink /patch/139642/
State New
Headers show

Comments

Jonathan Wakely - Feb. 5, 2012, 1:10 p.m.
On 23 December 2011 17:33, Jonathan Wakely wrote:
> This modifies the test to PASS when the expected type of exception is
> caught, instead of being XFAIL due to uncaught exception.
>
> Tested x86_64-linux, committed to trunk.
>
>        * testsuite/tr1/2_general_utilities/shared_ptr/cons/
>        weak_ptr_expired.cc: Modify to PASS instead of XFAIL.

And the same for the 20_util equivalent of the same test, this avoids
aborting which should make it run slightly faster (and means Fedora's
ABRT doesn't flag up a crash when running the testsuite)

2012-02-05  Jonathan Wakely  <jwakely.gcc@gmail.com>

        * testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc: Modify to
        PASS instead of XFAIL.

Tested x86_64-linux and committed to trunk.

Patch

diff --git a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc
index cff9b3b..d2bf508 100644
--- a/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc
+++ b/libstdc++-v3/testsuite/20_util/shared_ptr/cons/weak_ptr_expired.cc
@@ -1,7 +1,6 @@ 
 // { dg-options "-std=gnu++0x" }
-// { dg-do run { xfail *-*-* } }
 
-// Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation
+// Copyright (C) 2005, 2006, 2007, 2009, 2012 Free Software Foundation
 //
 // 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
@@ -31,7 +30,7 @@  struct A { };
 int
 test01()
 {
-  bool test __attribute__((unused)) = true;
+  bool test = false;
 
   std::shared_ptr<A> a1(new A);
   std::weak_ptr<A> wa(a1);
@@ -44,12 +43,9 @@  test01()
   catch (const std::bad_weak_ptr&)
   {
     // Expected.
-      __throw_exception_again;
-  }
-  catch (...)
-  {
-    // Failed.
+    test = true;
   }
+  VERIFY( test );
 
   return 0;
 }