From 46d09be1d92a3f7b548c64e7b53d45d1bc047242 Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Tue, 19 Nov 2019 14:04:46 +0100 Subject: [PATCH] travis and prebuildify --- .travis.yml | 37 +++++++++++++++++++++++++++++++++++++ package.json | 9 +++++++-- test/helpers/index.js | 6 ++++++ test/links.js | 3 ++- test/misc.js | 15 ++++++++------- test/read.js | 4 ++-- test/statfs.js | 7 ++++--- test/write.js | 3 ++- 8 files changed, 68 insertions(+), 16 deletions(-) create mode 100644 .travis.yml create mode 100644 test/helpers/index.js diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..ab5857c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,37 @@ +language: node_js + +sudo: required + +osx_image: xcode8.3 + +node_js: +- node + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 + - gcc-4.8-multilib + - g++-4.8-multilib + - gcc-multilib + - g++-multilib + +os: +- osx +- linux + +before_install: +- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cinst -y python2; fi + +install: +- npm install +- npm run configure + +before_deploy: +- ARCHIVE_NAME="${TRAVIS_TAG:-latest}-$TRAVIS_OS_NAME.tar" +- npm run prebuild +- if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then PREBUILD_ARCH=ia32 npm run prebuild; fi +- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then PREBUILD_ARCH=ia32 npm run prebuild; fi +- cd prebuilds && tar cvf "../$ARCHIVE_NAME" . && cd .. diff --git a/package.json b/package.json index eb5b75e..5074d73 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,12 @@ "scripts": { "install": "node-gyp-build", "test": "tape test/*.js", - "prebuild": "prebuildify -a --strip", - "prebuild-ia32": "prebuildify -a --strip --arch=ia32" + "prebuild": "prebuildify --napi --strip", + "prebuild-ia32": "prebuildify --napi --strip --arch=ia32", + "configure": "NODE=$(which node) && sudo -E $NODE ./bin.js configure || true" + }, + "bin": { + "fuse-native": "./bin.js" }, "gypfile": true, "dependencies": { @@ -22,6 +26,7 @@ }, "devDependencies": { "concat-stream": "^2.0.0", + "prebuildify": "^3.0.4", "standard": "^13.1.0", "tape": "^4.11.0" }, diff --git a/test/helpers/index.js b/test/helpers/index.js new file mode 100644 index 0000000..cf8ee0c --- /dev/null +++ b/test/helpers/index.js @@ -0,0 +1,6 @@ +exports.unmount = function (fuse, cb) { // This only seems to be nessesary an the ancient osx we use on travis so ... yolo + fuse.unmount(function (err) { + if (err) return cb(err) + setTimeout(cb, 1000) + }) +} diff --git a/test/links.js b/test/links.js index ac4b35d..a52d5c1 100644 --- a/test/links.js +++ b/test/links.js @@ -1,6 +1,7 @@ const tape = require('tape') const fs = require('fs') const path = require('path') +const { unmount } = require('./helpers') const Fuse = require('../') const mnt = require('./fixtures/mnt') @@ -53,7 +54,7 @@ tape('readlink', function (t) { t.error(err, 'no error') t.same(buf, Buffer.from('hello world'), 'can read link content') - fuse.unmount(function () { + unmount(fuse, function () { t.end() }) }) diff --git a/test/misc.js b/test/misc.js index 1aec5b6..53644b4 100644 --- a/test/misc.js +++ b/test/misc.js @@ -1,14 +1,15 @@ -var mnt = require('./fixtures/mnt') -var tape = require('tape') +const mnt = require('./fixtures/mnt') +const tape = require('tape') -var Fuse = require('../') +const Fuse = require('../') +const { unmount } = require('./helpers') tape('mount', function (t) { const fuse = new Fuse(mnt, {}, { force: true }) fuse.mount(function (err) { t.error(err, 'no error') t.ok(true, 'works') - fuse.unmount(function () { + unmount(fuse, function () { t.end() }) }) @@ -21,11 +22,11 @@ tape('mount + unmount + mount', function (t) { fuse1.mount(function (err) { t.error(err, 'no error') t.ok(true, 'works') - fuse1.unmount(function () { + unmount(fuse1, function () { fuse2.mount(function (err) { t.error(err, 'no error') t.ok(true, 'works') - fuse2.unmount(function () { + unmount(fuse2, function () { t.end() }) }) @@ -39,7 +40,7 @@ tape('mount + unmount + mount with same instance fails', function (t) { fuse.mount(function (err) { t.error(err, 'no error') t.ok(true, 'works') - fuse.unmount(function () { + unmount(fuse, function () { fuse.mount(function (err) { t.ok(err, 'had error') t.end() diff --git a/test/read.js b/test/read.js index 96be7f5..3115a27 100644 --- a/test/read.js +++ b/test/read.js @@ -6,6 +6,7 @@ const concat = require('concat-stream') const Fuse = require('../') const mnt = require('./fixtures/mnt') const stat = require('./fixtures/stat') +const { unmount } = require('./helpers') tape('read', function (t) { var ops = { @@ -23,7 +24,6 @@ tape('read', function (t) { return process.nextTick(cb, 0, 42) }, release: function (path, fd, cb) { - console.log('IN JS RELEASE') t.same(fd, 42, 'fd was passed to release') return process.nextTick(cb, 0) }, @@ -53,7 +53,7 @@ tape('read', function (t) { fs.createReadStream(path.join(mnt, 'test'), { start: 6, end: 10 }).pipe(concat(function (buf) { t.same(buf, Buffer.from('world'), 'partial read file + start offset') - fuse.unmount(function () { + unmount(fuse, function () { t.end() }) })) diff --git a/test/statfs.js b/test/statfs.js index 558a916..5fcd377 100644 --- a/test/statfs.js +++ b/test/statfs.js @@ -1,7 +1,8 @@ const { exec } = require('child_process') -var tape = require('tape') +const { unmount } = require('./helpers') +const tape = require('tape') -var Fuse = require('../') +const Fuse = require('../') const mnt = require('./fixtures/mnt') const stat = require('./fixtures/stat') @@ -29,7 +30,7 @@ tape('statfs', function (t) { t.error(err, 'no error') exec(`df ${mnt}`, (err) => { t.error(err, 'no error') - fuse.unmount(function () { + unmount(fuse, function () { t.end() }) }) diff --git a/test/write.js b/test/write.js index 7239598..b3aa051 100644 --- a/test/write.js +++ b/test/write.js @@ -5,6 +5,7 @@ const path = require('path') const Fuse = require('../') const mnt = require('./fixtures/mnt') const stat = require('./fixtures/stat') +const { unmount } = require('./helpers') tape('write', function (t) { var created = false @@ -48,7 +49,7 @@ tape('write', function (t) { t.error(err, 'no error') t.same(data.slice(0, size), Buffer.from('hello world'), 'data was written') - fuse.unmount(function () { + unmount(fuse, function () { t.end() }) })