From 14cbee7109a9aa569ea7bd37d70383c29cc4b425 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6=20Fahlke?= <jorrit@jorrit.de>
Date: Thu, 18 Dec 2014 05:11:05 +0100
Subject: [PATCH] [threads] Put a check for call_once() in the test suite.

---
 dune/common/test/.gitignore      |  1 +
 dune/common/test/CMakeLists.txt  |  3 +++
 dune/common/test/Makefile.am     |  3 +++
 dune/common/test/calloncetest.cc | 12 ++++++++++++
 4 files changed, 19 insertions(+)
 create mode 100644 dune/common/test/calloncetest.cc

diff --git a/dune/common/test/.gitignore b/dune/common/test/.gitignore
index 590b258e0..e24e6f6ef 100644
--- a/dune/common/test/.gitignore
+++ b/dune/common/test/.gitignore
@@ -11,6 +11,7 @@
 /bigunsignedinttest
 /bitsetvectortest
 /blockbitfieldtest
+/calloncetest
 /check_fvector_size
 /conversiontest
 /diagonalmatrixtest
diff --git a/dune/common/test/CMakeLists.txt b/dune/common/test/CMakeLists.txt
index 65131327a..366c3ca79 100644
--- a/dune/common/test/CMakeLists.txt
+++ b/dune/common/test/CMakeLists.txt
@@ -4,6 +4,7 @@ set(TESTS
     arraytest
     bigunsignedinttest
     bitsetvectortest
+    calloncetest
     check_fvector_size
     conversiontest
     diagonalmatrixtest
@@ -65,6 +66,8 @@ add_executable("bigunsignedinttest" bigunsignedinttest.cc)
 target_link_libraries("bigunsignedinttest" "dunecommon")
 
 add_executable("bitsetvectortest" bitsetvectortest.cc)
+add_executable("calloncetest" calloncetest.cc)
+target_link_libraries("calloncetest" "dunecommon")
 add_executable("check_fvector_size" check_fvector_size.cc)
 add_executable("check_fvector_size_fail1" EXCLUDE_FROM_ALL check_fvector_size_fail.cc)
 set_target_properties(check_fvector_size_fail1 PROPERTIES COMPILE_FLAGS "-DDIM=1")
diff --git a/dune/common/test/Makefile.am b/dune/common/test/Makefile.am
index 36a4bee51..17f902524 100644
--- a/dune/common/test/Makefile.am
+++ b/dune/common/test/Makefile.am
@@ -5,6 +5,7 @@ TESTPROGS = \
     arraytest \
     bigunsignedinttest \
     bitsetvectortest \
+    calloncetest \
     check_fvector_size \
     conversiontest \
     diagonalmatrixtest \
@@ -91,6 +92,8 @@ bigunsignedinttest_CPPFLAGS = $(AM_CPPFLAGS)
 
 bitsetvectortest_SOURCES = bitsetvectortest.cc
 
+calloncetest_SOURCES = calloncetest.cc
+
 check_fvector_size_fail1_SOURCES = check_fvector_size_fail.cc
 check_fvector_size_fail1_CPPFLAGS = $(AM_CPPFLAGS) -DDIM=1
 
diff --git a/dune/common/test/calloncetest.cc b/dune/common/test/calloncetest.cc
new file mode 100644
index 000000000..ebc82d7f9
--- /dev/null
+++ b/dune/common/test/calloncetest.cc
@@ -0,0 +1,12 @@
+// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+// vi: set et ts=4 sw=2 sts=2:
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <dune/common/stdthread.hh>
+
+int main() {
+  DUNE_ASSERT_CALL_ONCE();
+}
-- 
GitLab