From 4552db836b7210b32582b55c7115f7c254de7d18 Mon Sep 17 00:00:00 2001 From: maier Date: Wed, 5 Dec 2012 14:09:05 +0000 Subject: [PATCH] Testsuite: Port some tests to the CMake style config.h.in git-svn-id: https://svn.dealii.org/branches/branch_cmake@27761 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/base/mutex_01.cc | 59 ++++++++++++++--------------- tests/bits/data_out_curved_cells.cc | 2 +- tests/bits/fe_system.cc | 2 +- 3 files changed, 30 insertions(+), 33 deletions(-) diff --git a/tests/base/mutex_01.cc b/tests/base/mutex_01.cc index 856df038e2..7ee33043a9 100644 --- a/tests/base/mutex_01.cc +++ b/tests/base/mutex_01.cc @@ -24,16 +24,16 @@ Threads::ThreadMutex mutex; -void test () +void test () { - // get the mutex, but note that it is first - // held by main() which will therefore - // usually get to write to deallog first + // get the mutex, but note that it is first + // held by main() which will therefore + // usually get to write to deallog first mutex.acquire(); deallog << "2" << std::endl; } - + int main() { std::ofstream logfile("mutex_01/output"); @@ -41,30 +41,27 @@ int main() deallog.depth_console(0); deallog.threshold_double(1.e-10); - if (DEAL_II_USE_MT != 0) - { - mutex.acquire (); - - Threads::Thread<> t = Threads::new_thread (&test); - - sleep (2); - deallog << "1" << std::endl; - - mutex.release (); - t.join (); - - // the other thread should now have - // acquired the mutex, so release - // it again (destroying an acquired - // lock invokes undefined behavior - // in pthread_mutex_destroy) - mutex.release (); - } - else - { - // make sure the test also - // works in non-MT mode - deallog << "1" << std::endl; - deallog << "2" << std::endl; - } +#ifdef DEAL_II_USE_MT + + mutex.acquire (); + + Threads::Thread<> t = Threads::new_thread (&test); + + sleep (2); + deallog << "1" << std::endl; + + mutex.release (); + t.join (); + + // the other thread should now have acquired the mutex, so release it + // again (destroying an acquired lock invokes undefined behavior in + // pthread_mutex_destroy) + mutex.release (); + +#else + + // make sure the test also works in non-MT mode + deallog << "1" << std::endl; + deallog << "2" << std::endl; +#endif } diff --git a/tests/bits/data_out_curved_cells.cc b/tests/bits/data_out_curved_cells.cc index 70940c193d..663b4c67bb 100644 --- a/tests/bits/data_out_curved_cells.cc +++ b/tests/bits/data_out_curved_cells.cc @@ -256,7 +256,7 @@ int main () // to me, appears to deadlock at // times. make sure we kill it // after some time -#if DEAL_II_USE_MT == 1 +#ifdef DEAL_II_USE_MT DeadlockKiller killer; #endif diff --git a/tests/bits/fe_system.cc b/tests/bits/fe_system.cc index 773adcfc1b..dea26d124f 100644 --- a/tests/bits/fe_system.cc +++ b/tests/bits/fe_system.cc @@ -40,7 +40,7 @@ template void test() { - #if DEAL_II_USE_MT == 1 + #ifdef DEAL_II_USE_MT DeadlockKiller killer; #endif -- 2.39.5