Skip to contentSkip to conversation

qemu-iotests: Filter out DOS line endings

PATCH In review Kevin Wolf 4 participants 5 messages Feb 29, 2012 – Mar 2, 2012

lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

PATCH 1/1 qemu-iotests: Filter out DOS line endings

This one makes it possible to run qemu-iotests on a Windows build using Wine and get somewhat meaningful results.

---
 tests/qemu-iotests/common.filter |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
tests/qemu-iotests/common.filter +7 -1
index da77ede..fa26b62 100644
@@ -140,10 +140,16 @@ _filter_imgfmt()
     sed -e "s#$IMGFMT#IMGFMT#g"
 }
 
+# Removes \r from messages
+_filter_win32()
+{
+    sed -e 's/\r//g'
+}
+
 # sanitize qemu-io output
 _filter_qemu_io()
 {
-    sed -e "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* [EPTGMKiBbytes]*\/sec and [0-9/.inf]* ops\/sec)/X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
+    _filter_win32 | sed -e "s/[0-9]* ops\; [0-9/:. sec]* ([0-9/.inf]* [EPTGMKiBbytes]*\/sec and [0-9/.inf]* ops\/sec)/X ops\; XX:XX:XX.X (XXX YYY\/sec and XXX ops\/sec)/"
 }
 
 # make sure this script returns success
Signature · 1 line
1.7.6.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Kevin Wolf

This one makes it possible to run qemu-iotests on a Windows build using Wine and get somewhat meaningful results.

---
 tests/qemu-iotests/common.filter |    8 +++++++-

 1 files changed, 7 insertions(+), 1 deletions(-)

This and the other two qemu-iotests patches you posted along with it:

#2 lore raw
In reply to Kevin Wolf
Quoted 13 lines · Kevin Wolf

This one makes it possible to run qemu-iotests on a Windows build using Wine and get somewhat meaningful results.

---
 tests/qemu-iotests/common.filter |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
tests/qemu-iotests/common.filter +0 -0
index da77ede..fa26b62 100644

tests/qemu-iotests/common.filter _filter_imgfmt() · line 146

Quoted 7 lines
tests/qemu-iotests/common.filter +4 -0
@@ -140,10 +140,16 @@ _filter_imgfmt()
     sed -e "s#$IMGFMT#IMGFMT#g"
 }
 
+# Removes \r from messages
+_filter_win32()
+{
+    sed -e 's/\r//g'

POSIX does not require sed to recognize \r as a synonym for carriage return. You are better off using tr(1) (tr -d '\r') if all you want to do is strip carriage returns in a POSIX-compliant manner. Also be aware that on Solaris, you have to make sure you are using a PATH that first finds a POSIX-compliant tr.

Signature · 2 lines
Eric Blake   [email protected]    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
author
#3 lore raw

Am 29.02.2012 18:32, schrieb Eric Blake:

Quoted 17 lines · Kevin Wolf
Quoted 16 lines

This one makes it possible to run qemu-iotests on a Windows build using Wine and get somewhat meaningful results.

---
 tests/qemu-iotests/common.filter |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
tests/qemu-iotests/common.filter +0 -0
index da77ede..fa26b62 100644
@@ -140,10 +140,16 @@ _filter_imgfmt()
     sed -e "s#$IMGFMT#IMGFMT#g"
 }
 
Quoted 10 lines

tests/qemu-iotests/common.filter _filter_imgfmt() · line 146

Quoted 4 lines
tests/qemu-iotests/common.filter +4 -0
+# Removes \r from messages
+_filter_win32()
+{
+    sed -e 's/\r//g'

POSIX does not require sed to recognize \r as a synonym for carriage return. You are better off using tr(1) (tr -d '\r') if all you want to do is strip carriage returns in a POSIX-compliant manner. Also be aware that on Solaris, you have to make sure you are using a PATH that first finds a POSIX-compliant tr.

But who will run qemu-iotests on Wine on Solaris? Running it on Wine on Linux is already crazy enough. IIUC the sed call won't break anything, it may just not work and won't strip out the carriage returns. Well, bad luck, try a sane setup instead.

(I would see it different if this was ./configure, but it is a test case output filter)

Kevin

#4 lore raw

Il 01/03/2012 10:09, Kevin Wolf ha scritto:

Quoted 4 lines

But who will run qemu-iotests on Wine on Solaris? Running it on Wine on Linux is already crazy enough. IIUC the sed call won't break anything, it may just not work and won't strip out the carriage returns. Well, bad luck, try a sane setup instead.

It would strip "r"s. I also suggest using tr.

Paolo