mirror of https://github.com/nodejs/node.git
Fix dd command tests for Windows
parent
665a4e4a1d
commit
3b0f2cecff
|
@ -52,6 +52,17 @@ exports.indirectInstanceOf = function(obj, cls) {
|
|||
};
|
||||
|
||||
|
||||
exports.ddCommand = function(filename, kilobytes) {
|
||||
if (process.platform == 'win32') {
|
||||
return 'fsutil.exe file createnew "' + filename + '" ' + (kilobytes * 1024);
|
||||
} else {
|
||||
var blocks = Integer(size / 1024);
|
||||
return 'dd if=/dev/zero of="' + filename + '" bs=1024 count=' + kilobytes;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Turn this off if the test should not check for global leaks.
|
||||
exports.globalCheck = true;
|
||||
|
||||
|
|
|
@ -55,11 +55,13 @@ function maybeMakeRequest() {
|
|||
}
|
||||
|
||||
|
||||
cp.exec('dd if=/dev/zero of="' + filename + '" bs=1024 count=10240',
|
||||
function(err, stdout, stderr) {
|
||||
if (err) throw err;
|
||||
maybeMakeRequest();
|
||||
});
|
||||
var ddcmd = common.ddCommand(filename, 10240);
|
||||
console.log("dd command: ", ddcmd);
|
||||
|
||||
cp.exec(ddcmd, function(err, stdout, stderr) {
|
||||
if (err) throw err;
|
||||
maybeMakeRequest();
|
||||
});
|
||||
|
||||
|
||||
var server = http.createServer(function(req, res) {
|
||||
|
|
|
@ -58,7 +58,9 @@ var server = http.createServer(function(req, res) {
|
|||
server.listen(common.PORT);
|
||||
|
||||
server.on('listening', function() {
|
||||
var cmd = 'dd if=/dev/zero of="' + filename + '" bs=1024 count=10240';
|
||||
var cmd = common.ddCommand(filename, 10240);
|
||||
console.log("dd command: ", cmd);
|
||||
|
||||
cp.exec(cmd, function(err, stdout, stderr) {
|
||||
if (err) throw err;
|
||||
makeRequest();
|
||||
|
|
Loading…
Reference in New Issue