diff options
-rw-r--r-- | raul/Semaphore.hpp | 1 | ||||
-rw-r--r-- | test/build_test.cpp | 7 | ||||
-rw-r--r-- | test/sem_test.cpp | 2 | ||||
-rw-r--r-- | wscript | 43 |
4 files changed, 31 insertions, 22 deletions
diff --git a/raul/Semaphore.hpp b/raul/Semaphore.hpp index 1dd6e39..1c6ee71 100644 --- a/raul/Semaphore.hpp +++ b/raul/Semaphore.hpp @@ -20,6 +20,7 @@ #ifdef __APPLE__ # include <mach/mach.h> #elif defined(_WIN32) +# define NOMINMAX # include <windows.h> #else # include <cerrno> diff --git a/test/build_test.cpp b/test/build_test.cpp index 9de137c..cbf153d 100644 --- a/test/build_test.cpp +++ b/test/build_test.cpp @@ -21,14 +21,17 @@ #include "raul/Maid.hpp" #include "raul/Noncopyable.hpp" #include "raul/Path.hpp" -#include "raul/Process.hpp" #include "raul/RingBuffer.hpp" #include "raul/Semaphore.hpp" -#include "raul/Socket.hpp" #include "raul/Symbol.hpp" #include "raul/TimeSlice.hpp" #include "raul/TimeStamp.hpp" +#ifndef _WIN32 +#include "raul/Process.hpp" +#include "raul/Socket.hpp" +#endif + int main() { diff --git a/test/sem_test.cpp b/test/sem_test.cpp index 8daf82b..3830604 100644 --- a/test/sem_test.cpp +++ b/test/sem_test.cpp @@ -56,7 +56,7 @@ main() const auto start = std::chrono::steady_clock::now(); sem.timed_wait(std::chrono::milliseconds(100)); const auto end = std::chrono::steady_clock::now(); - assert(end - start > std::chrono::milliseconds(100)); + assert(end - start > std::chrono::milliseconds(80)); assert(end - start < std::chrono::milliseconds(200)); // Check that we can't successfully wait on a zero semaphore @@ -2,6 +2,7 @@ import os import subprocess +import sys from waflib import Options from waflib.extras import autowaf @@ -60,19 +61,19 @@ def configure(conf): autowaf.display_summary(conf, {'Unit tests': bool(conf.env.BUILD_TESTS)}) -tests = ''' - test/array_test - test/build_test - test/double_buffer_test - test/maid_test - test/path_test - test/ringbuffer_test - test/sem_test - test/socket_test - test/symbol_test - test/thread_test - test/time_test -''' +tests = ['array_test', + 'build_test', + 'double_buffer_test', + 'maid_test', + 'path_test', + 'ringbuffer_test', + 'sem_test', + 'symbol_test', + 'thread_test', + 'time_test'] + +if sys.platform != 'win32': + tests += ['socket_test'] def build(bld): # Headers @@ -104,15 +105,15 @@ def build(bld): test_linkflags += ['--coverage'] # Unit tests - for i in tests.split(): + for i in tests: obj = bld(features = 'cxx cxxprogram', - source = i + '.cpp', + source = os.path.join('test', i + '.cpp'), includes = ['.', './src'], lib = test_libs, use = 'libraul_static', uselib = 'GLIB GTHREAD', framework = framework, - target = i, + target = os.path.join('test', i), install_path = '', cxxflags = test_cxxflags, linkflags = test_linkflags, @@ -122,9 +123,13 @@ def build(bld): autowaf.build_dox(bld, 'RAUL', RAUL_VERSION, top, out) def test(ctx): - autowaf.pre_test(ctx, APPNAME, dirs=['.', 'src', 'test']) - autowaf.run_tests(ctx, APPNAME, tests.split(), dirs=['.', 'src', 'test']) - autowaf.post_test(ctx, APPNAME, dirs=['.', 'src', 'test']) + dirs = ['.', 'src', 'test'] + autowaf.pre_test(ctx, APPNAME, dirs=dirs) + autowaf.run_tests( + ctx, APPNAME, + map(lambda x: os.path.join('test', x), tests), + dirs=dirs) + autowaf.post_test(ctx, APPNAME, dirs=dirs) def lint(ctx): "checks code for style issues" |