From 24b42ef192232a1301ed738b72f0c88ddda52d33 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Sat, 22 Sep 2018 13:54:20 +0100 Subject: [PATCH] Tests: Move all setup to named file --- test/leak/leak.sh | 4 ++-- test/leak/sharp.supp | 8 +++++++- test/unit/{cache.js => beforeEach.js} | 2 ++ 3 files changed, 11 insertions(+), 3 deletions(-) rename test/unit/{cache.js => beforeEach.js} (76%) diff --git a/test/leak/leak.sh b/test/leak/leak.sh index 6b6d01d1..998efeba 100755 --- a/test/leak/leak.sh +++ b/test/leak/leak.sh @@ -5,7 +5,7 @@ if ! type valgrind >/dev/null; then exit 1 fi -curl -o ./test/leak/libvips.supp https://raw.githubusercontent.com/libvips/libvips/master/libvips.supp +curl -s -o ./test/leak/libvips.supp https://raw.githubusercontent.com/libvips/libvips/master/libvips.supp for test in ./test/unit/*.js; do G_SLICE=always-malloc G_DEBUG=gc-friendly valgrind \ @@ -16,5 +16,5 @@ for test in ./test/unit/*.js; do --show-leak-kinds=definite,indirect,possible \ --num-callers=20 \ --trace-children=yes \ - mocha --slow=60000 --timeout=120000 "$test"; + node node_modules/.bin/mocha --slow=60000 --timeout=120000 --file test/unit/beforeEach.js "$test"; done diff --git a/test/leak/sharp.supp b/test/leak/sharp.supp index ed4ee3f4..7e57515d 100644 --- a/test/leak/sharp.supp +++ b/test/leak/sharp.supp @@ -233,7 +233,13 @@ ... fun:uv__work_done } - +{ + leak_libuv_FlushForegroundTasks + Memcheck:Leak + match-leak-kinds: possible + ... + fun:_ZN4node12NodePlatform28FlushForegroundTasksInternalEv +} # nodejs warnings { param_nodejs_write_buffer diff --git a/test/unit/cache.js b/test/unit/beforeEach.js similarity index 76% rename from test/unit/cache.js rename to test/unit/beforeEach.js index 888bf886..d47648e9 100644 --- a/test/unit/cache.js +++ b/test/unit/beforeEach.js @@ -4,7 +4,9 @@ const detectLibc = require('detect-libc'); const sharp = require('../../'); const usingCache = detectLibc.family !== detectLibc.MUSL; +const usingSimd = !process.env.G_DEBUG; beforeEach(function () { sharp.cache(usingCache); + sharp.simd(usingSimd); });