Fix test-eio-race on Windows

This commit is contained in:
Ryan Dahl 2011-10-21 14:54:11 -07:00
parent 3c3ec7b2d7
commit efa95c2718

View File

@ -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");
}
});
}