require("../common");
var path = require('path');
var fs = require('fs');
var got_error = false;
var success_count = 0;
var file = path.join(fixturesDir, "a.js");
fs.open(file, process.O_WRONLY | process.O_APPEND, 0777, function (err, fd) {
try {
if(err) {
got_error = true;
}
else {
if(typeof(fs.fdatasyncSync(fd)) == "undefined") {
puts("fdatasync SYNC: ok");
success_count++;
}
else {
got_error = true;
}
if(typeof(fs.fsyncSync(fd)) == "undefined") {
puts("fsync SYNC: ok");
success_count++;
}
else {
got_error = true;
}
fs.fdatasync(fd, function(err) {
if(err) {
got_error = true;
}
else {
puts("fdatasync ASYNC: ok");
success_count++;
}
fs.fsync(fd, function(err) {
if(err) {
got_error = true;
}
else {
puts("fsync ASYNC: ok");
success_count++;
}
});
});
}
}
catch(e) {
got_error = true;
}
});
process.addListener("exit", function () {
assert.equal(4, success_count);
assert.equal(false, got_error);
});