Skip to contentSkip to conversation

Adjust the premature_failure check

PATCH New Lukáš Doktor 3 participants 4 messages Jun 1, 2016 – Jun 13, 2016 KVM

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Adjust the premature_failure check

Hello guys,

The a51bab13689b8eeeb6d1cc614fd56a4e86718ed4 change is not compatible with qemu-system-ppc64. Please find the fix attached.

Sample outputs are (Czech locale):

    $ qemu-system-x86_64 -kernel  _NO_FILE_4Uhere_
    qemu: could not load kernel '_NO_FILE_4Uhere_': No such file or directory
    $ qemu-system-aarch64 -kernel  _NO_FILE_4Uhere_  -machine virt
    _NO_FILE_4Uhere_: Adres?? nebo soubor neexistuje
    qemu: could not load kernel '_NO_FILE_4Uhere_'
    $ qemu-system-ppc64 -kernel  _NO_FILE_4Uhere_
    _NO_FILE_4Uhere_: No such file or directory
    qemu: error loading _NO_FILE_4Uhere_: Failed to load ELF

Changes:

v2: Check for line containing one of the failure messages
and the dummy file name.
v2: Use the full qemu output, not just the last_line

Kind regards,
Lukáš

#1 lore raw

PATCH 1/1 scripts/runtime: Adjust the premature_failure check

The premature_failure check fails on qemu-system-ppc64 as it uses different message. This patch modifies the condition so it works (hopefully) for all archs. (tested on x86_64, ppc64, aarch64)

---
 scripts/runtime.bash | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/runtime.bash +3 -3
index 6c4c800..0503cf0 100644
@@ -15,14 +15,14 @@ extract_summary()
 premature_failure()
 {
     local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
-    local last_line=$(tail -1 <<< "$log")
 
-    echo "$last_line" | grep -qi "could not load kernel" &&
+    echo "$log" | grep "_NO_FILE_4Uhere_" |
+        grep -q -e "could not load kernel" -e "error loading" &&
         return 1
 
     RUNTIME_log_stderr <<< "$log"
 
-    echo "$last_line"
+    echo "$log"
     return 0
 }
 
Signature · 1 line
2.5.5
Reviewed-by on v1 1/1
#2 lore raw

Re: [kvm-unit-tests PATCH] scripts/runtime: Adjust the premature_failure check

Quoted 21 lines · Lukáš Doktor

The premature_failure check fails on qemu-system-ppc64 as it uses different message. This patch modifies the condition so it works (hopefully) for all archs. (tested on x86_64, ppc64, aarch64)

---
 scripts/runtime.bash | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
scripts/runtime.bash +1 -2
index 6c4c800..0503cf0 100644
@@ -15,14 +15,14 @@ extract_summary()
 premature_failure()
 {
     local log="$(eval $(get_cmdline _NO_FILE_4Uhere_) 2>&1)"
-    local last_line=$(tail -1 <<< "$log")
 
-    echo "$last_line" | grep -qi "could not load kernel" &&
+    echo "$log" | grep "_NO_FILE_4Uhere_" |

scripts/runtime.bash extract_summary() · line 28

Quoted 10 lines
scripts/runtime.bash +2 -1
+        grep -q -e "could not load kernel" -e "error loading" &&
         return 1
 
     RUNTIME_log_stderr <<< "$log"
 
-    echo "$last_line"
+    echo "$log"
     return 0
 }