diff options
author | David Robillard <d@drobilla.net> | 2012-08-17 22:06:28 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2012-08-17 22:06:28 +0000 |
commit | cd6209bcdd686b630bece9dc7b73e24584dbf769 (patch) | |
tree | c8295ad5056ad25ff72de6e40018fe86dbedbb6b /test | |
parent | 882245f41683924d0465b5afac2f8bb5c3786e60 (diff) | |
download | raul-cd6209bcdd686b630bece9dc7b73e24584dbf769.tar.gz raul-cd6209bcdd686b630bece9dc7b73e24584dbf769.tar.bz2 raul-cd6209bcdd686b630bece9dc7b73e24584dbf769.zip |
Update test suite to compile and pass again.
git-svn-id: http://svn.drobilla.net/lad/trunk/raul@4718 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'test')
-rw-r--r-- | test/path_test.cpp | 3 | ||||
-rw-r--r-- | test/queue_test.cpp | 14 | ||||
-rw-r--r-- | test/ringbuffer_test.cpp | 1 | ||||
-rw-r--r-- | test/sem_test.cpp | 4 | ||||
-rw-r--r-- | test/symbol_test.cpp | 3 | ||||
-rw-r--r-- | test/thread_test.cpp | 17 | ||||
-rw-r--r-- | test/uri_test.cpp | 4 |
7 files changed, 16 insertions, 30 deletions
diff --git a/test/path_test.cpp b/test/path_test.cpp index d9d2b57..01f55c0 100644 --- a/test/path_test.cpp +++ b/test/path_test.cpp @@ -17,7 +17,6 @@ #include <cstring> #include <iostream> -#include "raul/log.hpp" #include "raul/Path.hpp" using namespace std; @@ -28,7 +27,7 @@ main() { #define CHECK(cond) \ do { if (!(cond)) { \ - error << "Test failed: " << (cond) << endl; \ + cerr << "Test failed: " << (cond) << endl; \ return 1; \ } } while (0) diff --git a/test/queue_test.cpp b/test/queue_test.cpp index e894647..bcdf039 100644 --- a/test/queue_test.cpp +++ b/test/queue_test.cpp @@ -27,7 +27,7 @@ #include "raul/SRMWQueue.hpp" #include "raul/SRSWQueue.hpp" #include "raul/Thread.hpp" -#include "raul/log.hpp" +#include "raul/fmt.hpp" using namespace std; using namespace Raul; @@ -63,11 +63,11 @@ SRMWQueue<WriteAction> queue(QUEUE_SIZE); class WriteThread : public Thread { public: - WriteThread(const std::string& name) : Thread(name) {} + WriteThread() {} protected: void _run() { - while (true) { + while (!_exit_flag) { for (unsigned j=0; j < PUSHES_PER_ITERATION; ++j) { unsigned i = rand() % NUM_DATA; if (queue.push(WriteAction(i))) { @@ -77,10 +77,6 @@ protected: //cerr << "FAILED WRITE\r\n"; } } - - // This thread will never cancel without this here since - // this loop is hard RT safe and thus cancellation point free - pthread_testcancel(); } cout << "Writer exiting." << endl; @@ -136,7 +132,7 @@ main() vector<WriteThread*> writers(NUM_WRITERS, NULL); for (unsigned i=0; i < NUM_WRITERS; ++i) { - writers[i] = new WriteThread((Raul::fmt("Writer %1%") % i).str()); + writers[i] = new WriteThread(); writers[i]->start(); } @@ -163,7 +159,7 @@ main() // Stop the writers for (unsigned i=0; i < NUM_WRITERS; ++i) - writers[i]->stop(); + writers[i]->join(); //cout << "\n\n****************** DONE *********************\n\n"; diff --git a/test/ringbuffer_test.cpp b/test/ringbuffer_test.cpp index 302f918..7537c85 100644 --- a/test/ringbuffer_test.cpp +++ b/test/ringbuffer_test.cpp @@ -20,7 +20,6 @@ #include <cstring> #include <iostream> -#include "raul/log.hpp" #include "raul/RingBuffer.hpp" using namespace std; diff --git a/test/sem_test.cpp b/test/sem_test.cpp index 7e06693..1836317 100644 --- a/test/sem_test.cpp +++ b/test/sem_test.cpp @@ -26,8 +26,8 @@ using namespace Raul; class Waiter : public Raul::Thread { public: - Waiter(Semaphore& sem) : Raul::Thread("Waiter"), _sem(sem) { - } + Waiter(Semaphore& sem) : Raul::Thread(), _sem(sem) + {} private: void _run() { diff --git a/test/symbol_test.cpp b/test/symbol_test.cpp index 9726001..547961c 100644 --- a/test/symbol_test.cpp +++ b/test/symbol_test.cpp @@ -18,7 +18,6 @@ #include <iostream> #include <list> -#include "raul/log.hpp" #include "raul/Path.hpp" using namespace std; @@ -29,7 +28,7 @@ main() { #define CHECK(cond) \ do { if (!(cond)) { \ - error << "Test failed: " << (cond) << endl; \ + cerr << "Test failed: " << (cond) << endl; \ return 1; \ } } while (0) diff --git a/test/thread_test.cpp b/test/thread_test.cpp index 00539eb..f823936 100644 --- a/test/thread_test.cpp +++ b/test/thread_test.cpp @@ -16,7 +16,6 @@ #include <iostream> -#include "raul/log.hpp" #include "raul/AtomicInt.hpp" #include "raul/Semaphore.hpp" #include "raul/Thread.hpp" @@ -30,16 +29,16 @@ Raul::AtomicInt n_errors(0); class Waiter : public Raul::Thread { public: - Waiter(Semaphore& sem) : Raul::Thread("Waiter"), _sem(sem) { + Waiter(Semaphore& sem) : Raul::Thread(), _sem(sem) { if (set_scheduling(true, 10)) { - Raul::warn << "Set priority on non-existent thread" << endl; + cerr << "Set priority on non-existent thread" << endl; } } private: void _run() { if (!set_scheduling(true, 10)) { - Raul::error << "Failed to set priority" << endl; + cerr << "Failed to set priority" << endl; } var = 41; cout << "[Waiter] Waiting for signal..." << endl; @@ -47,7 +46,7 @@ private: cout << "[Waiter] Received signal, exiting" << endl; var = 42; if (var != 42) { - Raul::error << "[Waiter] var != 42" << endl; + cerr << "[Waiter] var != 42" << endl; ++n_errors; } } @@ -58,12 +57,6 @@ private: int main() { - Thread& main_thread = Thread::get("Main"); - if (main_thread.name() != "Main") { - Raul::error << "[Main] Thread name is not 'Main'" << endl; - return 1; - } - Semaphore sem(0); Waiter waiter(sem); waiter.start(); @@ -79,7 +72,7 @@ main() cout << "[Main] Exiting" << endl; if (var != 24) { - Raul::error << "[Main] var != 24" << endl; + cerr << "[Main] var != 24" << endl; ++n_errors; } diff --git a/test/uri_test.cpp b/test/uri_test.cpp index d3b9a99..a65fb70 100644 --- a/test/uri_test.cpp +++ b/test/uri_test.cpp @@ -14,9 +14,9 @@ along with Raul. If not, see <http://www.gnu.org/licenses/>. */ +#include <cassert> #include <iostream> -#include "raul/log.hpp" #include "raul/URI.hpp" using namespace std; @@ -27,7 +27,7 @@ main() { #define CHECK(cond) \ do { if (!(cond)) { \ - error << "Test failed: " << (cond) << endl; \ + cerr << "Test failed: " << (cond) << endl; \ assert(0); \ return 1; \ } } while (0) |