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

[Libguestfs] [PATCH 3/6] v2v:test:win: actually check the eventual layout

v2v/test-v2v-windows-conversion.sh used to query if the expected
directories and filed were present in the VM upon conversion; however it
would ignore the results of that query.

That lead to the test passing even though the checks failed.

To fix it, parse the output of guestfish and verify that all is-file and
is-dir commands return the expected "true".

While doing so, keep in mind that the exit status of a pipeline is that
of the last command, so make sure to check the exit status of guestfish
too via $PIPESTATUS (yes it's bash-specific but the scripts are run with
bash only anyway).

Signed-off-by: Roman Kagan <rkagan virtuozzo com>
 v2v/test-v2v-windows-conversion.sh | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/v2v/test-v2v-windows-conversion.sh b/v2v/test-v2v-windows-conversion.sh
index eef6f57..916699d 100755
--- a/v2v/test-v2v-windows-conversion.sh
+++ b/v2v/test-v2v-windows-conversion.sh
@@ -67,12 +67,23 @@ test -f $d/windows.xml
 test -f $d/windows-sda
 # Test some aspects of the target disk image.
 guestfish --ro -a $d/windows-sda -i <<EOF
+  trace 1
   is-dir "/Program Files/Red Hat/Firstboot"
   is-file "/Program Files/Red Hat/Firstboot/firstboot.bat"
   is-dir "/Program Files/Red Hat/Firstboot/scripts"
   is-dir "/Windows/Drivers/VirtIO"
+  trace 0
+} | {
+    ret=0
+    while read r; do
+        [ "$r" = "true" ] || ret=1
+    done
+    exit $ret
+(( PIPESTATUS[0] == 0 ))
 # We also update the Registry several times, for firstboot, and (ONLY
 # if the virtio-win drivers are installed locally) the critical device

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