From: Nick Terrell Date: Sun, 1 Jan 2017 00:10:13 +0000 (-0500) Subject: Switch thread pool test to threading.h X-Git-Tag: v1.1.3^2~19^2~59^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d13243353465b386e333651e1ba63f5f4b30cdce;p=thirdparty%2Fzstd.git Switch thread pool test to threading.h --- diff --git a/.travis.yml b/.travis.yml index 36537cbee..6bf99f1bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ matrix: os: linux sudo: false - - env: Ubu=12.04cont Cmd="make zlibwrapper && make clean && make -C tests test-pool && make -C tests test-symbols && make clean && make -C tests test-zstd-nolegacy && make clean && make cmaketest && make clean && make -C contrib/pzstd googletest pzstd tests check && make -C contrib/pzstd clean" + - env: Ubu=12.04cont Cmd="make zlibwrapper && make clean && make -C tests test-symbols && make clean && make -C tests test-zstd-nolegacy && make clean && make cmaketest && make clean && make -C contrib/pzstd googletest pzstd tests check && make -C contrib/pzstd clean" os: linux sudo: false language: cpp diff --git a/tests/Makefile b/tests/Makefile index 739944de8..6312584a9 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -48,8 +48,10 @@ ZDICT_FILES := $(ZSTDDIR)/dictBuilder/*.c # Define *.exe as extension for Windows systems ifneq (,$(filter Windows%,$(OS))) EXT =.exe +PTHREAD = -DZSTD_PTHREAD else EXT = +PTHREAD = -pthread -DZSTD_PTHREAD endif VOID = /dev/null @@ -158,8 +160,8 @@ else $(CC) $(FLAGS) $^ -o $@$(EXT) -Wl,-rpath=$(ZSTDDIR) $(ZSTDDIR)/libzstd.so endif -pool : pool.c $(ZSTDDIR)/common/pool.c - $(CC) $(FLAGS) -pthread -DZSTD_PTHREAD $^ -o $@$(EXT) +pool : pool.c $(ZSTDDIR)/common/pool.c $(ZSTDDIR)/common/threading.c + $(CC) $(FLAGS) $(PTHREAD) $^ -o $@$(EXT) namespaceTest: if $(CC) namespaceTest.c ../lib/common/xxhash.c -o $@ ; then echo compilation should fail; exit 1 ; fi @@ -225,7 +227,7 @@ zstd-playTests: datagen file $(ZSTD) ZSTD="$(QEMU_SYS) $(ZSTD)" ./playTests.sh $(ZSTDRTTEST) -test: test-zstd test-fullbench test-fuzzer test-zstream test-longmatch test-invalidDictionaries +test: test-zstd test-fullbench test-fuzzer test-zstream test-longmatch test-invalidDictionaries test-pool test32: test-zstd32 test-fullbench32 test-fuzzer32 test-zstream32 diff --git a/tests/pool.c b/tests/pool.c index ce38075d0..27414642d 100644 --- a/tests/pool.c +++ b/tests/pool.c @@ -1,5 +1,5 @@ #include "pool.h" -#include +#include "threading.h" #include #include @@ -31,7 +31,7 @@ int testOrder(size_t numThreads, size_t queueLog) { POOL_ctx *ctx = POOL_create(numThreads, queueLog); ASSERT_TRUE(ctx); data.i = 0; - ASSERT_FALSE(pthread_mutex_init(&data.mutex, NULL)); + pthread_mutex_init(&data.mutex, NULL); { size_t i; for (i = 0; i < 1024; ++i) { @@ -46,7 +46,7 @@ int testOrder(size_t numThreads, size_t queueLog) { ASSERT_EQ(i, data.data[i]); } } - ASSERT_FALSE(pthread_mutex_destroy(&data.mutex)); + pthread_mutex_destroy(&data.mutex); return 0; }