Jim Meyering <jim(a)meyering.net> wrote:
Maybe you're talking about something else?
I proposed to add a trailing newline in the expected output
as well as in the code to generate the "actual" output.
This is the sort of change I was thinking of:
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
At first I thought that might be incomplete.
But it's all that's needed on the C side.
I ran this one-liner to append the missing newlines, and we're all set:
for i in $(find|grep '\.args$'); do echo >> $i;done
"make check" and "make syntax-check" both pass.
From b548c2f7caf311b7acfa2ebd839067f674d89a40 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 8 Aug 2008 16:18:57 +0200
Subject: [PATCH] tests: append a newline to expected-output files lacking NL-at-EOF
* tests/qemuxml2argvtest.c (testCompareXMLToArgvFiles): Adjust the
code that creates "actual" output, so that it too produces a
newline-terminated buffer.
* tests/qemuxml2argvdata/*.args: Append a newline to each, via:
for i in $(find|grep '\.args$'); do echo >> $i;done
---
.../qemuxml2argvdata/qemuxml2argv-boot-cdrom.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-boot-floppy.args | 2 +-
.../qemuxml2argv-boot-network.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-bootloader.args | 2 +-
.../qemuxml2argv-clock-localtime.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-clock-utc.args | 2 +-
.../qemuxml2argv-console-compat.args | 2 +-
.../qemuxml2argv-disk-cdrom-empty.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-disk-cdrom.args | 2 +-
.../qemuxml2argv-disk-drive-boot-cdrom.args | 2 +-
.../qemuxml2argv-disk-drive-boot-disk.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-disk-floppy.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-disk-many.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-disk-virtio.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-disk-xenvbd.args | 2 +-
.../qemuxml2argv-graphics-sdl.args | 2 +-
.../qemuxml2argv-graphics-vnc.args | 2 +-
.../qemuxml2argv-input-usbmouse.args | 2 +-
.../qemuxml2argv-input-usbtablet.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-input-xen.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-minimal.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-misc-acpi.args | 2 +-
.../qemuxml2argv-misc-no-reboot.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-net-user.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-net-virtio.args | 2 +-
.../qemuxml2argv-parallel-tcp.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-serial-dev.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-serial-file.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-serial-many.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-serial-pty.args | 2 +-
.../qemuxml2argv-serial-tcp-telnet.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-serial-tcp.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-serial-udp.args | 2 +-
.../qemuxml2argvdata/qemuxml2argv-serial-unix.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-serial-vc.args | 2 +-
tests/qemuxml2argvdata/qemuxml2argv-sound.args | 2 +-
tests/qemuxml2argvtest.c | 3 ++-
37 files changed, 38 insertions(+), 37 deletions(-)
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args
b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args
index 3f45b24..6c062ae 100644
--- a/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-boot-cdrom.args
@@ -1 +1 @@
-/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot d -cdrom
/dev/cdrom -net none -serial none -parallel none -usb
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot d -cdrom
/dev/cdrom -net none -serial none -parallel none -usb
...
[lots of generated changes elided]
...
--- a/tests/qemuxml2argvdata/qemuxml2argv-sound.args
+++ b/tests/qemuxml2argvdata/qemuxml2argv-sound.args
@@ -1 +1 @@
-/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -soundhw
pcspk,es1370,sb16
\ No newline at end of file
+/usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi -boot c -hda
/dev/HostVG/QEMUGuest1 -net none -serial none -parallel none -usb -soundhw
pcspk,es1370,sb16
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index d136a13..25465ae 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -53,7 +53,7 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *cmd,
int extra
goto fail;
tmp = argv;
- len = 0;
+ len = 1; /* for trailing newline */
while (*tmp) {
len += strlen(*tmp) + 1;
tmp++;
@@ -68,6 +68,7 @@ static int testCompareXMLToArgvFiles(const char *xml, const char *cmd,
int extra
strcat(actualargv, *tmp);
tmp++;
}
+ strcat(actualargv, "\n");
if (STRNEQ(expectargv, actualargv)) {
virtTestDifference(stderr, expectargv, actualargv);
--
1.6.0.rc2.2.g59bf