From 5b376364f56367e67b849f7fd8e2b65a56cd169b Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Thu, 27 Aug 2015 23:59:48 +0100 Subject: [PATCH] Add test case for require-time libc++ segfault --- package.json | 3 ++- test/unit/gamma.js | 2 +- test/unit/require.js | 15 +++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 test/unit/require.js diff --git a/package.json b/package.json index 687c33df..49a51a8b 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,8 @@ "mocha": "^2.2.5", "mocha-jshint": "^2.2.3", "node-cpplint": "^0.4.0", - "rimraf": "^2.4.2" + "rimraf": "^2.4.2", + "bufferutil": "^1.2.1" }, "license": "Apache-2.0", "engines": { diff --git a/test/unit/gamma.js b/test/unit/gamma.js index b109e28e..5cf36d52 100755 --- a/test/unit/gamma.js +++ b/test/unit/gamma.js @@ -16,7 +16,7 @@ describe('Gamma correction', function() { assert.strictEqual('jpeg', info.format); assert.strictEqual(129, info.width); assert.strictEqual(111, info.height); - fixtures.assertSimilar(fixtures.expected('gamma-0.0.jpg'), data, done); + fixtures.assertSimilar(fixtures.expected('gamma-0.0.jpg'), data, {threshold: 12}, done); }); }); diff --git a/test/unit/require.js b/test/unit/require.js new file mode 100644 index 00000000..e195e5a1 --- /dev/null +++ b/test/unit/require.js @@ -0,0 +1,15 @@ +'use strict'; + +describe('Require-time checks', function() { + + /* + Including sharp alongside another C++ module that does not require + -stdlib=libc++ (for its C++11 features) has caused clang/llvm to + segfault due to the use of static function variables. + */ + it('Require alongside C++ module that does not use libc++', function() { + var bufferutil = require('bufferutil'); + var sharp = require('../../index'); + }); + +});