[libvirt] [PATCH]: file backed usb massstorage #3
Jim Meyering
jim at meyering.net
Fri Aug 8 13:26:38 UTC 2008
Chris Lalancette <clalance at redhat.com> wrote:
> Jim Meyering wrote:
>>> On Fri, Aug 08, 2008 at 02:07:49PM +0200, Jim Meyering wrote:
>>>> Guido Günther <agx at sigxcpu.org> wrote:
>>>>> >From a714b14a13f97b824c288fc40165ef9fe5fbaae0 Mon Sep 17 00:00:00 2001
>>>>> From: Guido Guenther <agx at sigxcpu.org>
>> ...
>>>> Please add a newline and split the long line:
>>>>
>>>> /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -no-acpi \
>>>> -boot c -hda /dev/HostVG/QEMUGuest1 -usbdevice disk:/tmp/usbdisk.img \
>>>> -net none -serial none -parallel none -usb
>>> No, this would break the test case, since its being compared against
>>> generated data in the format shown by the patch.
>>
>> Ahh... it looked like something to be executed (and maintained),
>> rather than merely expected output. So no need to split long lines.
>>
>> However, including a trailing newline might be worthwhile
>> (and adjust the code to emit the matching newline), since some editors
>> have a hard time modifying or creating a file with no newline at EOF.
>
> Heh. Unfortunately, that's not an option either. The tests just do a simple
> strcmp(), so if there is an extra trailing newline in the args file, the test
> will "fail". I ran into this before.
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
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);
More information about the libvir-list
mailing list