On 12/12/18 10:33 PM, John Ferlan wrote:
On 12/12/18 9:04 AM, Michal Privoznik wrote:
> On 12/4/18 5:47 PM, John Ferlan wrote:
>> Similar to qemuxml2argv and storagevolxml2argv, let's create some
>> tests to ensure that the XML generates a consistent command line.
>>
>> Using the same list of pools as storagepoolxml2xmltest, start with
>> the file system tests (fs, netfs, netfs-cifs, netfs-gluster).
>>
>> Signed-off-by: John Ferlan <jferlan(a)redhat.com>
>> ---
>> tests/Makefile.am | 12 ++
>> tests/storagepoolxml2argvdata/pool-fs.argv | 1 +
>> .../pool-netfs-cifs.argv | 1 +
>> .../pool-netfs-gluster.argv | 1 +
>> tests/storagepoolxml2argvdata/pool-netfs.argv | 1 +
>> tests/storagepoolxml2argvtest.c | 171 ++++++++++++++++++
>> 6 files changed, 187 insertions(+)
>> create mode 100644 tests/storagepoolxml2argvdata/pool-fs.argv
>> create mode 100644 tests/storagepoolxml2argvdata/pool-netfs-cifs.argv
>> create mode 100644 tests/storagepoolxml2argvdata/pool-netfs-gluster.argv
>> create mode 100644 tests/storagepoolxml2argvdata/pool-netfs.argv
>> create mode 100644 tests/storagepoolxml2argvtest.c
>>
>> diff --git a/tests/Makefile.am b/tests/Makefile.am
>> index d7ec7e3a6f..bec0930c11 100644
>> --- a/tests/Makefile.am
>> +++ b/tests/Makefile.am
>> @@ -140,6 +140,7 @@ EXTRA_DIST = \
>> storagepoolschemadata \
>> storagepoolxml2xmlin \
>> storagepoolxml2xmlout \
>> + storagepoolxml2argvdata \
>> storagevolschemadata \
>> storagevolxml2argvdata \
>> storagevolxml2xmlin \
>> @@ -363,6 +364,7 @@ endif WITH_NWFILTER
>>
>> if WITH_STORAGE
>> test_programs += storagevolxml2argvtest
>> +test_programs += storagepoolxml2argvtest
>> test_programs += virstorageutiltest
>> endif WITH_STORAGE
>>
>> @@ -901,6 +903,16 @@ storagevolxml2argvtest_LDADD = \
>> ../src/libvirt_util.la \
>> $(LDADDS)
>>
>> +storagepoolxml2argvtest_SOURCES = \
>> + storagepoolxml2argvtest.c \
>> + testutils.c testutils.h
>> +storagepoolxml2argvtest_LDADD = \
>> + $(LIBXML_LIBS) \
>> + ../src/libvirt_driver_storage_impl.la \
>> + ../src/libvirt_conf.la \
>> + ../src/libvirt_util.la \
>> + $(LDADDS)
>> +
>> else ! WITH_STORAGE
>> EXTRA_DIST += storagevolxml2argvtest.c
>> EXTRA_DIST += virstorageutiltest.c
>> diff --git a/tests/storagepoolxml2argvdata/pool-fs.argv
b/tests/storagepoolxml2argvdata/pool-fs.argv
>> new file mode 100644
>> index 0000000000..4a94148114
>> --- /dev/null
>> +++ b/tests/storagepoolxml2argvdata/pool-fs.argv
>> @@ -0,0 +1 @@
>> +/usr/bin/mount -t ext3 /dev/sda6 /mnt
>
> Problem is, on my system (Gentoo), it is /usr/mount so this is failing
> for me.
>
> I wonder if we should have a placeholder here, say "MOUNT" and then
> replace it with actual location of 'mount' (taken from config.h) at runtime.
>
> Michal
>
If I add a call to virTestClearCommandPath(actualCmdline); just prior to
the if (virTestCompareToFile(actualCmdline, cmdline) < 0) *and* I modify
each of the .argv files to remove the leading path, then things work
just fine.
Ah, had no idea we have such nifty function.
Would you like to see or is the explanation good enough? IDC either way.
I believe you can place the function call at the right place and
regenerate the test outputs.
ACK series then.
Michal