FAIL: test-blocksize-sharding.sh ================================ + requires_run + is_windows ++ nbdkit --dump-config ++ grep '^host_os' ++ cut -d= -f2 + host_os=linux-gnu + [[ linux-gnu =~ mingw|msys ]] + requires_plugin eval + requires nbdkit eval --version + requires_nbdsh_uri + requires nbdsh -c 'exit(not h.supports_uri())' + requires dd oflag=seek_bytes + files='blocksize-sharding.img blocksize-sharding.tmp' + rm -f blocksize-sharding.img blocksize-sharding.tmp + cleanup_fn rm -f blocksize-sharding.img blocksize-sharding.tmp + local _hook=_cleanup_hook0 + declare -ag _cleanup_hook0 + eval '_cleanup_hook0=("$@")' ++ _cleanup_hook0=("$@") + export 'script= import os import time witness = os.getenv("witness") def touch(path): open(path, "a").close() # First pass: check that two aligned operations work in parallel # Total time should be closer to 2 seconds, rather than 4 if serialized print("sanity check") ba1 = bytearray(b"1"*16) ba2 = bytearray(b"2"*16) buf1 = nbd.Buffer.from_bytearray(ba1) buf2 = nbd.Buffer.from_bytearray(ba2) touch(witness) start_t = time.time() h.aio_pwrite(buf1, 0) h.aio_pwrite(buf2, 0) while h.aio_in_flight() > 0: h.poll(-1) end_t = time.time() os.unlink(witness) out = h.pread(16,0) print(out) t = end_t - start_t print(t) assert out in [b"1"*16, b"2"*16] assert t >= 2 and t <= 3 # Next pass: try to kick off unaligned first print("unaligned first") h.zero(16, 0) ba3 = bytearray(b"3"*12) ba4 = bytearray(b"4"*16) buf3 = nbd.Buffer.from_bytearray(ba3) buf4 = nbd.Buffer.from_bytearray(ba4) touch(witness) start_t = time.time() h.aio_pwrite(buf3, 4) h.aio_pwrite(buf4, 0) while h.aio_in_flight() > 0: h.poll(-1) end_t = time.time() os.unlink(witness) out = h.pread(16,0) print(out) t = end_t - start_t print(t) assert out in [b"4"*4 + b"3"*12, b"4"*16] assert t >= 8 # Next pass: try to kick off aligned first print("aligned first") ba5 = bytearray(b"5"*16) ba6 = bytearray(b"6"*12) buf5 = nbd.Buffer.from_bytearray(ba5) buf6 = nbd.Buffer.from_bytearray(ba6) h.zero(16, 0) touch(witness) start_t = time.time() h.aio_pwrite(buf5, 0) h.aio_pwrite(buf6, 4) while h.aio_in_flight() > 0: h.poll(-1) end_t = time.time() os.unlink(witness) out = h.pread(16,0) print(out) t = end_t - start_t print(t) assert out in [b"5"*4 + b"6"*12, b"5"*16] assert t >= 8 ' + script=' import os import time witness = os.getenv("witness") def touch(path): open(path, "a").close() # First pass: check that two aligned operations work in parallel # Total time should be closer to 2 seconds, rather than 4 if serialized print("sanity check") ba1 = bytearray(b"1"*16) ba2 = bytearray(b"2"*16) buf1 = nbd.Buffer.from_bytearray(ba1) buf2 = nbd.Buffer.from_bytearray(ba2) touch(witness) start_t = time.time() h.aio_pwrite(buf1, 0) h.aio_pwrite(buf2, 0) while h.aio_in_flight() > 0: h.poll(-1) end_t = time.time() os.unlink(witness) out = h.pread(16,0) print(out) t = end_t - start_t print(t) assert out in [b"1"*16, b"2"*16] assert t >= 2 and t <= 3 # Next pass: try to kick off unaligned first print("unaligned first") h.zero(16, 0) ba3 = bytearray(b"3"*12) ba4 = bytearray(b"4"*16) buf3 = nbd.Buffer.from_bytearray(ba3) buf4 = nbd.Buffer.from_bytearray(ba4) touch(witness) start_t = time.time() h.aio_pwrite(buf3, 4) h.aio_pwrite(buf4, 0) while h.aio_in_flight() > 0: h.poll(-1) end_t = time.time() os.unlink(witness) out = h.pread(16,0) print(out) t = end_t - start_t print(t) assert out in [b"4"*4 + b"3"*12, b"4"*16] assert t >= 8 # Next pass: try to kick off aligned first print("aligned first") ba5 = bytearray(b"5"*16) ba6 = bytearray(b"6"*12) buf5 = nbd.Buffer.from_bytearray(ba5) buf6 = nbd.Buffer.from_bytearray(ba6) h.zero(16, 0) touch(witness) start_t = time.time() h.aio_pwrite(buf5, 0) h.aio_pwrite(buf6, 4) while h.aio_in_flight() > 0: h.poll(-1) end_t = time.time() os.unlink(witness) out = h.pread(16,0) print(out) t = end_t - start_t print(t) assert out in [b"5"*4 + b"6"*12, b"5"*16] assert t >= 8 ' + truncate -s 16 blocksize-sharding.img + export witness=/home/solstice/.cache/paru/clone/nbdkit/src/nbdkit-1.38.1/tests/blocksize-sharding.tmp + witness=/home/solstice/.cache/paru/clone/nbdkit/src/nbdkit-1.38.1/tests/blocksize-sharding.tmp + nbdkit --filter=blocksize --filter=delay eval delay-write=2 'config=ln -sf "$(realpath "$3")" $tmpdir/$2' img=/home/solstice/.cache/paru/clone/nbdkit/src/nbdkit-1.38.1/tests/blocksize-sharding.img tmp=/home/solstice/.cache/paru/clone/nbdkit/src/nbdkit-1.38.1/tests/blocksize-sharding.tmp 'get_size=echo 16' 'block_size=echo 16 64K 1M' 'thread_model=echo parallel' 'zero=dd if=/dev/zero of=$tmpdir/img skip=$4 count=$3 \ iflag=count_bytes,skip_bytes' 'pread= dd if=$tmpdir/img skip=$4 count=$3 iflag=count_bytes,skip_bytes if [ -f $tmpdir/tmp ]; then sleep 4; fi ' 'pwrite=dd of=$tmpdir/img seek=$4 conv=notrunc oflag=seek_bytes' --run 'nbdsh -u "$uri" -c "$script"' libnbd: debug: nbd1: nbd_create: opening handle libnbd: debug: nbd1: nbd_get_package_name: enter: libnbd: debug: nbd1: nbd_get_package_name: leave: ret=libnbd libnbd: debug: nbd1: nbd_close: closing handle libnbd: debug: nbd2: nbd_create: opening handle libnbd: debug: nbd2: nbd_get_version: enter: libnbd: debug: nbd2: nbd_get_version: leave: ret=1.20.0 libnbd: debug: nbd2: nbd_close: closing handle libnbd: debug: nbd3: nbd_create: opening handle libnbd: debug: nbd3: nbd_get_package_name: enter: libnbd: debug: nbd3: nbd_get_package_name: leave: ret=libnbd libnbd: debug: nbd3: nbd_close: closing handle libnbd: debug: nbd4: nbd_create: opening handle libnbd: debug: nbd4: nbd_get_version: enter: libnbd: debug: nbd4: nbd_get_version: leave: ret=1.20.0 libnbd: debug: nbd4: nbd_close: closing handle libnbd: debug: nbd5: nbd_create: opening handle libnbd: debug: nbd5: nbd_set_handle_name: enter: handle_name="nbdsh" libnbd: debug: nbdsh: nbd_set_handle_name: leave: ret=0 libnbd: debug: nbdsh: nbd_connect_uri: enter: uri="nbd+unix://?socket=/tmp/nbdkitH89cdk/socket" libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=4 libnbd: debug: nbdsh: nbd_connect_uri: poll end: r=1 revents=4 libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=1 libnbd: debug: nbdsh: nbd_connect_uri: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=1 libnbd: debug: nbdsh: nbd_connect_uri: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_connect_uri: extended headers are not supported by this server libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=1 libnbd: debug: nbdsh: nbd_connect_uri: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_connect_uri: negotiated structured replies on this connection libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=1 libnbd: debug: nbdsh: nbd_connect_uri: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=1 libnbd: debug: nbdsh: nbd_connect_uri: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_connect_uri: exportsize: 16 eflags: 0xc1 libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=1 libnbd: debug: nbdsh: nbd_connect_uri: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=1 libnbd: debug: nbdsh: nbd_connect_uri: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_connect_uri: server block size constraints: min: 1 preferred: 65536 max: 4294967295 libnbd: debug: nbdsh: nbd_connect_uri: poll start: events=1 libnbd: debug: nbdsh: nbd_connect_uri: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_connect_uri: leave: ret=0 libnbd: debug: nbdsh: nbd_aio_pwrite: enter: buf=" 0000: 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 |1111111111111111| " count=16 offset=0 completion=NULL flags=0x0 libnbd: debug: nbdsh: nbd_aio_pwrite: leave: ret=1 libnbd: debug: nbdsh: nbd_aio_pwrite: enter: buf=" 0000: 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 |2222222222222222| " count=16 offset=0 completion=NULL flags=0x0 libnbd: debug: nbdsh: nbd_aio_pwrite: leave: ret=2 libnbd: debug: nbdsh: nbd_aio_in_flight: enter: libnbd: debug: nbdsh: nbd_aio_in_flight: leave: ret=2 libnbd: debug: nbdsh: nbd_poll: enter: timeout=-1 libnbd: debug: nbdsh: nbd_poll: poll start: events=1 libnbd: debug: nbdsh: nbd_poll: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_poll: leave: ret=1 libnbd: debug: nbdsh: nbd_aio_in_flight: enter: libnbd: debug: nbdsh: nbd_aio_in_flight: leave: ret=1 libnbd: debug: nbdsh: nbd_poll: enter: timeout=-1 libnbd: debug: nbdsh: nbd_poll: poll start: events=1 libnbd: debug: nbdsh: nbd_poll: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_poll: leave: ret=1 libnbd: debug: nbdsh: nbd_aio_in_flight: enter: libnbd: debug: nbdsh: nbd_aio_in_flight: leave: ret=0 libnbd: debug: nbdsh: nbd_pread: enter: buf= count=16 offset=0 flags=0x0 libnbd: debug: nbdsh: nbd_pread: poll start: events=1 libnbd: debug: nbdsh: nbd_pread: poll end: r=1 revents=1 libnbd: debug: nbdsh: nbd_pread: leave: ret=0 Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/lib/python3.12/site-packages/nbd.py", line 3986, in nbdsh.shell() File "/usr/lib/python3.12/site-packages/nbdsh.py", line 149, in shell do_snippet[act](arg) File "/usr/lib/python3.12/site-packages/nbdsh.py", line 140, in "command": lambda arg: exec(arg, d, d), ^^^^^^^^^^^^^^^ File "", line 32, in AssertionError sanity check bytearray(b'2222222222222222') 5.224142789840698 libnbd: debug: nbdsh: nbd_close: closing handle ++ _run_cleanup_hooks ++ local _status=1 _i ++ set +e ++ trap '' INT QUIT TERM EXIT ERR ++ echo ./test-blocksize-sharding.sh: run cleanup hooks: exit code 1 ./test-blocksize-sharding.sh: run cleanup hooks: exit code 1 ++ (( _i = 0 )) ++ (( _i < 1 )) ++ eval '"${_cleanup_hook0[@]}"' +++ rm -f blocksize-sharding.img blocksize-sharding.tmp ++ (( ++_i )) ++ (( _i < 1 )) ++ exit 1 FAIL test-blocksize-sharding.sh (exit status: 1)