Re: [libvirt] [PATCH 1/1] tests: xmconfigtest: Add test for os.cmdline

2018-05-22 Thread filip aláč
It may be worth to take a look at files
test-paravirt-cmdline,cmdline-bogus-extra...etc.
in tests/xlconfigdata.
They look they are testing the same/similiar problem.
Feel free to to make v2, Thanks.


2018-05-22 1:57 GMT+02:00 Jim Fehlig :

> On 05/21/2018 05:57 AM, Filip Alac wrote:
>
>> Add test case for the os cmdline.
>> Check if:
>> 656151bf5dd299322dcf37d06d20534e667a1963
>> work as expected.
>>
>
> Thanks for taking up Cole's suggestion! I had added it to my todo list.
>
> To test the code you fixed in 656151bf, we need to check the following
>
> 1. no 'extra=' or 'root=' in xm.cfg
> 2. 'extra=' but no 'root=' in xm.cfg
> 3. 'root=' but no 'extra=' in xm.cfg
> 4. both 'root=' and 'extra=' in xm.cfg
>
> Since all of the existing xmconfig tests have no 'extra=' or 'root=',
> we've got 1 covered :-). We could be evil and test 2 by adding 'extra=' to
> an existing paravirt test, e.g. test-paravirt-vcpu. Perhaps less evil would
> be to add 'extra=' to all the existing paravirt tests, along with 
> in associated .xml file.
>
> 3 and 4 need handled a bit differently since the roundtrip xm.cfg to xml
> to xm.cfg tests will not pass when xm.cfg contains 'root='. The xm.cfg to
> xml conversion maps 'root=' to , but the reverse maps  to
> 'extra='. The easy solution is to only test the xm.cfg to xml conversion
> using the DO_TEST_FORMAT macro. E.g attached is a patch that tests xm.cfg
> to xml conversion of xm.cfg containing both 'extra=' and 'root='. We'd need
> a similar change for testing only 'root='.
>
> Do you have time to tweak the patch to test all conditions and submit a
> V2? If not I'll get to it.
>
> Regards,
> Jim
>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Re: [libvirt] [PATCH 1/1] tests: xmconfigtest: Add test for os.cmdline

2018-05-21 Thread Jim Fehlig

On 05/21/2018 05:57 AM, Filip Alac wrote:

Add test case for the os cmdline.
Check if:
656151bf5dd299322dcf37d06d20534e667a1963
work as expected.


Thanks for taking up Cole's suggestion! I had added it to my todo list.

To test the code you fixed in 656151bf, we need to check the following

1. no 'extra=' or 'root=' in xm.cfg
2. 'extra=' but no 'root=' in xm.cfg
3. 'root=' but no 'extra=' in xm.cfg
4. both 'root=' and 'extra=' in xm.cfg

Since all of the existing xmconfig tests have no 'extra=' or 'root=', we've got 
1 covered :-). We could be evil and test 2 by adding 'extra=' to an existing 
paravirt test, e.g. test-paravirt-vcpu. Perhaps less evil would be to add 
'extra=' to all the existing paravirt tests, along with  in associated 
.xml file.


3 and 4 need handled a bit differently since the roundtrip xm.cfg to xml to 
xm.cfg tests will not pass when xm.cfg contains 'root='. The xm.cfg to xml 
conversion maps 'root=' to , but the reverse maps  to 
'extra='. The easy solution is to only test the xm.cfg to xml conversion using 
the DO_TEST_FORMAT macro. E.g attached is a patch that tests xm.cfg to xml 
conversion of xm.cfg containing both 'extra=' and 'root='. We'd need a similar 
change for testing only 'root='.


Do you have time to tweak the patch to test all conditions and submit a V2? If 
not I'll get to it.


Regards,
Jim
>From 4e993de0a28c5863336df402e862fbeeb97fe305 Mon Sep 17 00:00:00 2001
From: Jim Fehlig 
Date: Fri, 18 May 2018 15:07:46 -0600
Subject: [PATCH] tests: add xmconfig test for cmdline conversion

Signed-off-by: Jim Fehlig 
---
 tests/xmconfigdata/test-paravirt-cmdline.cfg | 14 
 tests/xmconfigdata/test-paravirt-cmdline.xml | 34 
 tests/xmconfigtest.c |  1 +
 3 files changed, 49 insertions(+)

diff --git a/tests/xmconfigdata/test-paravirt-cmdline.cfg b/tests/xmconfigdata/test-paravirt-cmdline.cfg
new file mode 100644
index 00..a15d9b2532
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-cmdline.cfg
@@ -0,0 +1,14 @@
+name = "XenGuest1"
+uuid = "c7a5fdb0-cdaf-9455-926a-d65c16db1809"
+maxmem = 579
+memory = 394
+vcpus = 2
+localtime = 0
+on_poweroff = "destroy"
+on_reboot = "restart"
+on_crash = "restart"
+vif = [ "mac=00:16:3e:66:94:9c,bridge=br0,script=vif-bridge" ]
+bootloader = "/usr/bin/pygrub"
+root="/dev/xvda2"
+extra="3"
+disk = [ "phy:/dev/HostVG/XenGuest1,xvda,w" ]
diff --git a/tests/xmconfigdata/test-paravirt-cmdline.xml b/tests/xmconfigdata/test-paravirt-cmdline.xml
new file mode 100644
index 00..a18a3a3894
--- /dev/null
+++ b/tests/xmconfigdata/test-paravirt-cmdline.xml
@@ -0,0 +1,34 @@
+
+  XenGuest1
+  c7a5fdb0-cdaf-9455-926a-d65c16db1809
+  592896
+  403456
+  2
+  /usr/bin/pygrub
+  
+linux
+root=/dev/xvda2 3
+  
+  
+  destroy
+  restart
+  restart
+  
+
+  
+  
+  
+
+
+  
+  
+  
+
+
+  
+
+
+
+
+  
+
diff --git a/tests/xmconfigtest.c b/tests/xmconfigtest.c
index 6851fa73cd..21569f40b6 100644
--- a/tests/xmconfigtest.c
+++ b/tests/xmconfigtest.c
@@ -194,6 +194,7 @@ mymain(void)
 DO_TEST_FORMAT(name); \
 } while (0)
 
+DO_TEST_FORMAT("paravirt-cmdline");
 DO_TEST("paravirt-new-pvfb");
 DO_TEST("paravirt-new-pvfb-vncdisplay");
 DO_TEST("paravirt-net-e1000");
-- 
2.16.3

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list