fix big file test

auto-timeout
Mathias Buus 4 years ago
parent 62401463df
commit aa745f4ff5

@ -54,11 +54,11 @@ tape('read', function (t) {
} }
const fuse = new Fuse(mnt, ops, { debug: !true, autoCache: true }) const fuse = new Fuse(mnt, ops, { debug: !true, autoCache: true })
fuse.mount(function (err) { let fd = 0
t.error(err, 'no error')
fs.open(path.join(mnt, 'test'), 'w+', function (_, fd) {
run( run(
(_, cb) => fuse.mount(cb),
open,
(_, cb) => fs.fstat(fd, cb), (_, cb) => fs.fstat(fd, cb),
checkSize(0), checkSize(0),
(_, cb) => fs.ftruncate(fd, 4 * 1024 * 1024 * 1024 + 1, cb), (_, cb) => fs.ftruncate(fd, 4 * 1024 * 1024 * 1024 + 1, cb),
@ -72,6 +72,8 @@ tape('read', function (t) {
(_, cb) => fs.write(fd, Buffer.alloc(4096), 0, 4096, 6 * 1024 * 1024 * 1024, cb), (_, cb) => fs.write(fd, Buffer.alloc(4096), 0, 4096, 6 * 1024 * 1024 * 1024, cb),
(_, cb) => fs.fstat(fd, cb), (_, cb) => fs.fstat(fd, cb),
checkSize(6 * 1024 * 1024 * 1024 + 4096), checkSize(6 * 1024 * 1024 * 1024 + 4096),
(_, cb) => fs.close(fd, cb),
open,
(_, cb) => fs.read(fd, Buffer.alloc(4096), 0, 4096, 0, cb), (_, cb) => fs.read(fd, Buffer.alloc(4096), 0, 4096, 0, cb),
(_, cb) => fs.read(fd, Buffer.alloc(4096), 0, 4096, 4 * 1024 * 1024 * 1024, cb), (_, cb) => fs.read(fd, Buffer.alloc(4096), 0, 4096, 4 * 1024 * 1024 * 1024, cb),
(_, cb) => fs.read(fd, Buffer.alloc(4096), 0, 4096, 6 * 1024 * 1024 * 1024, cb), (_, cb) => fs.read(fd, Buffer.alloc(4096), 0, 4096, 6 * 1024 * 1024 * 1024, cb),
@ -83,8 +85,13 @@ tape('read', function (t) {
t.end() t.end()
} }
) )
function open (_, cb) {
fs.open(path.join(mnt, 'test'), 'a+', function (_, res) {
fd = res
cb()
}) })
}) }
function checkSize (n) { function checkSize (n) {
return ({ size}, cb) => { return ({ size}, cb) => {
@ -92,13 +99,14 @@ tape('read', function (t) {
cb() cb()
} }
} }
})
function run (...fns) { function run (...fns) {
const all = [...fns] const all = [...fns]
tick() tick()
function tick (_, val) { function tick (err, val) {
t.error(err, 'no error')
const next = all.shift() const next = all.shift()
if (next) next(val, tick) if (next) next(val, tick)
} }
} }
})

Loading…
Cancel
Save