On Fri, Nov 03, 2023 at 03:44:44PM -0500, Eric Blake wrote:
On Fri, Nov 03, 2023 at 08:32:41PM +0000, Richard W.M. Jones wrote:
It's better to update the 'b' pointer and the 'offset' using the calculated increment 'n', rather than using '8-o' which might be larger than the remainder of the buffer. Previously we could create a dangling pointer beyond the end of the output buffer, and this should not matter, but it's best not to do this if we can easily avoid it.
Also improve the test by replacing qemu-io with nbdsh. It is able to make non-aligned requests so we can now test those. --- plugins/pattern/pattern.c | 4 +- tests/test-pattern.sh | 129 ++++++++++++++++++++++---------------- 2 files changed, 77 insertions(+), 56 deletions(-)
+ +# Run nbdkit-pattern-plugin. Use a disk > 4G so we can test 2G and 4G +# boundaries. +nbdkit pattern 5G --run 'nbdsh -u "$uri" -c -' <<EOF + +# Generate the expected pattern in the given range. +# This only works for 8-byte aligned ranges. +def generated_expected(start,end):
I think Python prefers a space after that comma.
FWIW, rather than reviewing code style, I can recommend just feeding any python code through 'black'. It is an opinionated python code formatter intended to bring a consistent style to all python programs. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|