[libvirt] [PATCH] tests: Fix qemucapsfixreplies

Andrea Bolognani posted 1 patch 5 years, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20180619115551.27964-1-abologna@redhat.com
Test syntax-check passed
tests/qemucapsfixreplies | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
[libvirt] [PATCH] tests: Fix qemucapsfixreplies
Posted by Andrea Bolognani 5 years, 10 months ago
Since e6be524508d5 we include the executed command along
with the reply in *.replies files, which breaks the
renumbering logic implemented in qemucapsfixreplies.

Adapt the script so that it works with the new format.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
---
 tests/qemucapsfixreplies | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/qemucapsfixreplies b/tests/qemucapsfixreplies
index 4e3371a1f7..597f9ecd6e 100755
--- a/tests/qemucapsfixreplies
+++ b/tests/qemucapsfixreplies
@@ -8,7 +8,7 @@ if [ "$#" -ne 1 ] || [ "$1" = "--help" ] || [ ! -f "$1" ]; then
 fi
 
 awk -i inplace \
-    'BEGIN {count=1; pattern="libvirt-[0-9]+"}
+    'BEGIN {last=0; pattern="libvirt-[0-9]+"}
     {
         if (match($0, "libvirt-1[^0-9]")) {
             count=1;
@@ -16,7 +16,11 @@ awk -i inplace \
         if (match($0, pattern)) {
             str="libvirt-" count;
             sub(pattern, str, $0);
-            count++;
+            if (last != count) {
+                last=count;
+            } else {
+                count++;
+            }
         }
         print
     }' "$1"
-- 
2.17.1

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] tests: Fix qemucapsfixreplies
Posted by Pavel Hrdina 5 years, 10 months ago
On Tue, Jun 19, 2018 at 01:55:51PM +0200, Andrea Bolognani wrote:
> Since e6be524508d5 we include the executed command along
> with the reply in *.replies files, which breaks the
> renumbering logic implemented in qemucapsfixreplies.
> 
> Adapt the script so that it works with the new format.
> 
> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
> ---
>  tests/qemucapsfixreplies | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list