Re: [PATCH v2] kvm-unit-test: fix script output abnormal

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

 



On 19/09/2018 19:19, Peng Hao wrote:
> ./run_tests.sh
> )ASS apic-split (50 tests;
> )ASS ioapic-split (19 tests;
> )ASS apic (50 tests;
> )ASS ioapic (19 tests;
> )ASS smptest (1 tests;
> )ASS smptest3 (1 tests;
> 
> The problem come from commit 0f4f2acb2c880607518cb740a6aa06acafd05855
> (x86: io: force carriage return on \n put to serial port). It maybe output
> well in real hardware, but it let outputs to file with '\r'.
> 
> Changes v1 --> v2:
> 	changes in scripts/runtime.bash can affect other arch.

I think v1 is better, we can just catch the \r with an optional match:

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index a31ae91..3f5f3e2 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -8,7 +8,8 @@ FAIL() { echo -ne "\e[31mFAIL\e[0m"; }
 
 extract_summary()
 {
-    tail -3 | grep '^SUMMARY: ' | sed 's/^SUMMARY: /(/;s/$/)/'
+    local cr=$'\r'
+    tail -3 | grep '^SUMMARY: ' | sed 's/^SUMMARY: /(/;s/'"$cr"'\{0,1\}$/)/'
 }
 
 # We assume that QEMU is going to work if it tried to load the kernel

(also added some portability stuff for non-GNU sed).

Paolo



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux