Browse Source

Fix test-eio-race on Windows

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
efa95c2718
  1. 12
      test/simple/test-eio-race.js

12
test/simple/test-eio-race.js

@ -19,8 +19,6 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// libuv-broken
var common = require('../common');
var assert = require('assert');
@ -28,6 +26,9 @@ var assert = require('assert');
var count = 100;
var fs = require('fs');
// person.jpg is 57kb. We just need some file that is sufficently large.
var filename = require('path').join(common.fixturesDir, 'person.jpg');
function tryToKillEventLoop() {
console.log('trying to kill event loop ...');
@ -58,11 +59,11 @@ function tryToKillEventLoop() {
// Generate a lot of thread pool events
var pos = 0;
fs.open('/dev/zero', 'r', 0666, function(err, fd) {
fs.open(filename, 'r', 0666, function(err, fd) {
if (err) throw err;
function readChunk() {
fs.read(fd, 1024, pos, 'binary', function(err, chunk, bytesRead) {
fs.read(fd, 1024, 0, 'binary', function(err, chunk, bytesRead) {
if (err) throw err;
if (chunk) {
pos += bytesRead;
@ -70,8 +71,7 @@ fs.open('/dev/zero', 'r', 0666, function(err, fd) {
readChunk();
} else {
fs.closeSync(fd);
throw new Exception('/dev/zero shouldn\'t end ' +
'before the issue shows up');
throw new Exception("Shouldn't get EOF");
}
});
}

Loading…
Cancel
Save