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 <jfehlig@suse.com>:
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 <cmdline> 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 <cmdline>, but the reverse maps <cmdline> 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