[PATCH v2 24/25] nodedevmdevctltest: Use internal linewrapping and variable command path stripping

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove `nodedevCompareToFile` which was stripping the path to mdevctl
since it's no longer needed if we use the new features of
virCommandSetDryRun.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 ...19_36ea_4111_8f0a_8c9a70e21366-define.argv |  5 +++-
 ...019_36ea_4111_8f0a_8c9a70e21366-start.argv |  5 +++-
 ...39_495e_4243_ad9f_beb3f14c23d9-define.argv |  5 +++-
 ...d39_495e_4243_ad9f_beb3f14c23d9-start.argv |  5 +++-
 ...16_1ca8_49ac_b176_871d16c13076-define.argv |  5 +++-
 ...916_1ca8_49ac_b176_871d16c13076-start.argv |  5 +++-
 tests/nodedevmdevctldata/mdevctl-create.argv  |  4 ++-
 .../mdevctl-list-defined.argv                 |  5 +++-
 tests/nodedevmdevctldata/mdevctl-stop.argv    |  4 ++-
 .../nodedevmdevctldata/mdevctl-undefine.argv  |  4 ++-
 tests/nodedevmdevctltest.c                    | 29 +++++--------------
 11 files changed, 44 insertions(+), 32 deletions(-)

diff --git a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-define.argv b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-define.argv
index 118ec7a8da..b8bb276f9f 100644
--- a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-define.argv
+++ b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-define.argv
@@ -1,2 +1,5 @@
-$MDEVCTL_BINARY$ define -p 0000:00:02.0 --jsonfile /dev/stdin \
+mdevctl \
+define \
+-p 0000:00:02.0 \
+--jsonfile /dev/stdin \
 --uuid=d069d019-36ea-4111-8f0a-8c9a70e21366
diff --git a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-start.argv b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-start.argv
index 129f438e4a..73a8046d84 100644
--- a/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-start.argv
+++ b/tests/nodedevmdevctldata/mdev_d069d019_36ea_4111_8f0a_8c9a70e21366-start.argv
@@ -1,2 +1,5 @@
-$MDEVCTL_BINARY$ start -p 0000:00:02.0 --jsonfile /dev/stdin \
+mdevctl \
+start \
+-p 0000:00:02.0 \
+--jsonfile /dev/stdin \
 --uuid=d069d019-36ea-4111-8f0a-8c9a70e21366
diff --git a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-define.argv b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-define.argv
index 773e98b963..bf8637ed57 100644
--- a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-define.argv
+++ b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-define.argv
@@ -1 +1,4 @@
-$MDEVCTL_BINARY$ define -p 0000:00:02.0 --jsonfile /dev/stdin
+mdevctl \
+define \
+-p 0000:00:02.0 \
+--jsonfile /dev/stdin
diff --git a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-start.argv b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-start.argv
index eb7262035e..eae63f7a7f 100644
--- a/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-start.argv
+++ b/tests/nodedevmdevctldata/mdev_d2441d39_495e_4243_ad9f_beb3f14c23d9-start.argv
@@ -1 +1,4 @@
-$MDEVCTL_BINARY$ start -p 0000:00:02.0 --jsonfile /dev/stdin
+mdevctl \
+start \
+-p 0000:00:02.0 \
+--jsonfile /dev/stdin
diff --git a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-define.argv b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-define.argv
index 773e98b963..bf8637ed57 100644
--- a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-define.argv
+++ b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-define.argv
@@ -1 +1,4 @@
-$MDEVCTL_BINARY$ define -p 0000:00:02.0 --jsonfile /dev/stdin
+mdevctl \
+define \
+-p 0000:00:02.0 \
+--jsonfile /dev/stdin
diff --git a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-start.argv b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-start.argv
index eb7262035e..eae63f7a7f 100644
--- a/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-start.argv
+++ b/tests/nodedevmdevctldata/mdev_fedc4916_1ca8_49ac_b176_871d16c13076-start.argv
@@ -1 +1,4 @@
-$MDEVCTL_BINARY$ start -p 0000:00:02.0 --jsonfile /dev/stdin
+mdevctl \
+start \
+-p 0000:00:02.0 \
+--jsonfile /dev/stdin
diff --git a/tests/nodedevmdevctldata/mdevctl-create.argv b/tests/nodedevmdevctldata/mdevctl-create.argv
index 802109340c..f19c9780dc 100644
--- a/tests/nodedevmdevctldata/mdevctl-create.argv
+++ b/tests/nodedevmdevctldata/mdevctl-create.argv
@@ -1 +1,3 @@
-$MDEVCTL_BINARY$ start -u 8a05ad83-3472-497d-8631-8142f31460e8
+mdevctl \
+start \
+-u 8a05ad83-3472-497d-8631-8142f31460e8
diff --git a/tests/nodedevmdevctldata/mdevctl-list-defined.argv b/tests/nodedevmdevctldata/mdevctl-list-defined.argv
index 72b5906e9e..f6199681fa 100644
--- a/tests/nodedevmdevctldata/mdevctl-list-defined.argv
+++ b/tests/nodedevmdevctldata/mdevctl-list-defined.argv
@@ -1 +1,4 @@
-$MDEVCTL_BINARY$ list --dumpjson --defined
+mdevctl \
+list \
+--dumpjson \
+--defined
diff --git a/tests/nodedevmdevctldata/mdevctl-stop.argv b/tests/nodedevmdevctldata/mdevctl-stop.argv
index 3dbaab671b..cc621191d6 100644
--- a/tests/nodedevmdevctldata/mdevctl-stop.argv
+++ b/tests/nodedevmdevctldata/mdevctl-stop.argv
@@ -1 +1,3 @@
-$MDEVCTL_BINARY$ stop -u e2451f73-c95b-4124-b900-e008af37c576
+mdevctl \
+stop \
+-u e2451f73-c95b-4124-b900-e008af37c576
diff --git a/tests/nodedevmdevctldata/mdevctl-undefine.argv b/tests/nodedevmdevctldata/mdevctl-undefine.argv
index 54717455f7..f1a59c5242 100644
--- a/tests/nodedevmdevctldata/mdevctl-undefine.argv
+++ b/tests/nodedevmdevctldata/mdevctl-undefine.argv
@@ -1 +1,3 @@
-$MDEVCTL_BINARY$ undefine -u d76a6b78-45ed-4149-a325-005f9abc5281
+mdevctl \
+undefine \
+-u d76a6b78-45ed-4149-a325-005f9abc5281
diff --git a/tests/nodedevmdevctltest.c b/tests/nodedevmdevctltest.c
index 48d4f9e818..27bdc67928 100644
--- a/tests/nodedevmdevctltest.c
+++ b/tests/nodedevmdevctltest.c
@@ -40,21 +40,6 @@ testCommandDryRunCallback(const char *const*args G_GNUC_UNUSED,
     *stdinbuf = g_strdup(input);
 }

-/* We don't want the result of the test to depend on the path to the mdevctl
- * binary on the developer's machine, so replace the path to mdevctl with a
- * placeholder string before comparing to the expected output */
-static int
-nodedevCompareToFile(const char *actual,
-                     const char *filename)
-{
-    g_autofree char *replacedCmdline = NULL;
-
-    replacedCmdline = virStringReplace(actual, MDEVCTL, "$MDEVCTL_BINARY$");
-
-    return virTestCompareToFile(replacedCmdline, filename);
-}
-
-
 typedef virCommand* (*MdevctlCmdFunc)(virNodeDeviceDef *, char **, char **);


@@ -87,14 +72,14 @@ testMdevctlStartOrDefine(const char *virt_type,
     if (!cmd)
         goto cleanup;

-    virCommandSetDryRun(dryRunToken, &buf, false, false, testCommandDryRunCallback, &stdinbuf);
+    virCommandSetDryRun(dryRunToken, &buf, true, true, testCommandDryRunCallback, &stdinbuf);
     if (virCommandRun(cmd, NULL) < 0)
         goto cleanup;

     if (!(actualCmdline = virBufferCurrentContent(&buf)))
         goto cleanup;

-    if (nodedevCompareToFile(actualCmdline, cmdfile) < 0)
+    if (virTestCompareToFileFull(actualCmdline, cmdfile, false) < 0)
         goto cleanup;

     if (virTestCompareToFile(stdinbuf, jsonfile) < 0)
@@ -159,14 +144,14 @@ testMdevctlUuidCommand(const char *uuid, GetStopUndefineCmdFunc func, const char
     if (!cmd)
         goto cleanup;

-    virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
+    virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL);
     if (virCommandRun(cmd, NULL) < 0)
         goto cleanup;

     if (!(actualCmdline = virBufferCurrentContent(&buf)))
         goto cleanup;

-    if (nodedevCompareToFile(actualCmdline, outfile) < 0)
+    if (virTestCompareToFileFull(actualCmdline, outfile, false) < 0)
         goto cleanup;

     ret = 0;
@@ -221,14 +206,14 @@ testMdevctlListDefined(const void *data G_GNUC_UNUSED)
     if (!cmd)
         goto cleanup;

-    virCommandSetDryRun(dryRunToken, &buf, false, false, NULL, NULL);
+    virCommandSetDryRun(dryRunToken, &buf, true, true, NULL, NULL);
     if (virCommandRun(cmd, NULL) < 0)
         goto cleanup;

     if (!(actualCmdline = virBufferCurrentContent(&buf)))
         goto cleanup;

-    if (nodedevCompareToFile(actualCmdline, cmdlinefile) < 0)
+    if (virTestCompareToFileFull(actualCmdline, cmdlinefile, false) < 0)
         goto cleanup;

     ret = 0;
@@ -270,7 +255,7 @@ testMdevctlParse(const void *data)
         virBufferAddStr(&xmloutbuf, devxml);
     }

-    if (nodedevCompareToFile(virBufferCurrentContent(&xmloutbuf), xmloutfile) < 0)
+    if (virTestCompareToFileFull(virBufferCurrentContent(&xmloutbuf), xmloutfile, false) < 0)
         goto cleanup;

     ret = 0;
-- 
2.30.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux