Fix dd command tests for Windows

pull/5370/head
Ryan Dahl 2011-08-09 17:43:57 -07:00
parent 665a4e4a1d
commit 3b0f2cecff
3 changed files with 21 additions and 6 deletions

View File

@ -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;

View File

@ -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) {

View File

@ -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();