Browse Source

Remove /tmp assumption from runtests.js

Use 'tmp' package for auto-deleting temporary filenames.  This should be
portable to e.g. Windows.
pull/368/head
Sami Vaarala 9 years ago
parent
commit
9d13222e6d
  1. 6
      runtests/package.json
  2. 12
      runtests/runtests.js

6
runtests/package.json

@ -7,12 +7,12 @@
"email": "sami.vaarala@iki.fi"
},
"dependencies": {
"optimist": "~0.3.5",
"MD5": "~1.0.0",
"async": "~0.2.4",
"optimist": "~0.3.5",
"tmp": "0.0.27",
"xml2js": "~0.2.4",
"MD5": "~1.0.0",
"yamljs": "~0.2.1"
},
"main": "runtests.js"
}

12
runtests/runtests.js

@ -8,7 +8,7 @@
var fs = require('fs'),
path = require('path'),
// temp = require('temp'),
tmp = require('tmp'),
child_process = require('child_process'),
async = require('async'),
xml2js = require('xml2js'),
@ -33,12 +33,12 @@ var knownIssues;
* Utils.
*/
// FIXME: placeholder; for some reason 'temp' didn't work
var tmpCount = 0;
var tmpUniq = process.pid || Math.floor(Math.random() * 1e6);
// Generate temporary filename, file will be autodeleted on exit unless
// deleted explicitly. See: https://www.npmjs.com/package/tmp
function mkTempName(ext) {
return '/tmp/runtests-' + tmpUniq + '-' + (++tmpCount) + (ext !== undefined ? ext : '');
var fn = tmp.tmpNameSync({ keep: false, prefix: 'tmp-runtests-' });
console.log('mkTempName -> ' + fn);
return fn;
}
function safeUnlinkSync(filePath) {

Loading…
Cancel
Save