aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex
diff options
context:
space:
mode:
authorBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
committerBen Cheng <bccheng@google.com>2014-03-25 22:37:19 -0700
commit1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch)
treec607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex
parent283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff)
downloadtoolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2
toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex')
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/1.cc49
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/assign_neg.cc35
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/copy_neg.cc34
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/requirements/standard_layout.cc31
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/1.cc52
-rw-r--r--gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/2.cc67
6 files changed, 268 insertions, 0 deletions
diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/1.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/1.cc
new file mode 100644
index 000000000..b38cdbbcb
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/1.cc
@@ -0,0 +1,49 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++1y -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++1y -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++1y " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2013-2014 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <shared_mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::shared_timed_mutex mutex_type;
+
+ try
+ {
+ mutex_type m1;
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ return 0;
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/assign_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/assign_neg.cc
new file mode 100644
index 000000000..c8be74101
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/assign_neg.cc
@@ -0,0 +1,35 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++1y" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2008-2014 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <shared_mutex>
+
+void test01()
+{
+ // assign
+ typedef std::shared_timed_mutex mutex_type;
+ mutex_type m1;
+ mutex_type m2;
+ m1 = m2; // { dg-error "deleted" }
+}
+
+// { dg-prune-output "include" }
diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/copy_neg.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/copy_neg.cc
new file mode 100644
index 000000000..780c19341
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/cons/copy_neg.cc
@@ -0,0 +1,34 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++1y" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2013-2014 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <shared_mutex>
+
+void test01()
+{
+ // assign
+ typedef std::shared_timed_mutex mutex_type;
+ mutex_type m1;
+ mutex_type m2(m1); // { dg-error "deleted" }
+}
+
+// { dg-prune-output "include" }
diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/requirements/standard_layout.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/requirements/standard_layout.cc
new file mode 100644
index 000000000..3133b10eb
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/requirements/standard_layout.cc
@@ -0,0 +1,31 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++1y" }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2013-2014 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <shared_mutex>
+#include <testsuite_common_types.h>
+
+void test01()
+{
+ __gnu_test::standard_layout test;
+ test.operator()<std::shared_timed_mutex>();
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/1.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/1.cc
new file mode 100644
index 000000000..c13e05b57
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/1.cc
@@ -0,0 +1,52 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++1y -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++1y -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++1y " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2013-2014 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <shared_mutex>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::shared_timed_mutex mutex_type;
+
+ try
+ {
+ mutex_type m;
+ bool b = m.try_lock();
+ VERIFY( b );
+ m.unlock();
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ return 0;
+}
diff --git a/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/2.cc b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/2.cc
new file mode 100644
index 000000000..28f833ba6
--- /dev/null
+++ b/gcc-4.9/libstdc++-v3/testsuite/30_threads/shared_timed_mutex/try_lock/2.cc
@@ -0,0 +1,67 @@
+// { dg-do run { target *-*-freebsd* *-*-netbsd* *-*-linux* *-*-solaris* *-*-cygwin *-*-darwin* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++1y -pthread" { target *-*-freebsd* *-*-netbsd* *-*-linux* powerpc-ibm-aix* } }
+// { dg-options " -std=gnu++1y -pthreads" { target *-*-solaris* } }
+// { dg-options " -std=gnu++1y " { target *-*-cygwin *-*-darwin* } }
+// { dg-require-cstdint "" }
+// { dg-require-gthreads "" }
+
+// Copyright (C) 2013-2014 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
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+
+#include <shared_mutex>
+#include <thread>
+#include <system_error>
+#include <testsuite_hooks.h>
+
+int main()
+{
+ bool test __attribute__((unused)) = true;
+ typedef std::shared_timed_mutex mutex_type;
+
+ try
+ {
+ mutex_type m;
+ m.lock();
+ bool b;
+
+ std::thread t([&] {
+ try
+ {
+ b = m.try_lock();
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ });
+ t.join();
+ VERIFY( !b );
+
+ m.unlock();
+ }
+ catch (const std::system_error& e)
+ {
+ VERIFY( false );
+ }
+ catch (...)
+ {
+ VERIFY( false );
+ }
+
+ return 0;
+}