[PATCH v3 1/3] scsi-testsuite: filter away trailing spaces

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


The handling of trailing whitespace in the hexdumps that sg_raw
produces varied between releases.  Filter them away to avoid
spurious failures.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 001           |    2 +-
 001.out       |    8 ++++----
 002           |    2 +-
 002.out       |   10 +++++-----
 003           |    4 ++--
 003.out       |    8 ++++----
 004           |    8 ++++----
 004.out       |   16 ++++++++--------
 005           |    2 +-
 005.out       |   10 +++++-----
 006           |    2 +-
 006.out       |   10 +++++-----
 common.filter |   11 +++++++++++
 13 files changed, 52 insertions(+), 41 deletions(-)

diff --git a/001 b/001
index d173a6d..5362ed1 100755
--- a/001
+++ b/001
@@ -19,7 +19,7 @@ status=1	# failure is the default!
 
 _require_command sg_raw
 
-sg_raw -v $TEST_DEV 2 0 0 0 0 0
+execute_cdb 2 0 0 0 0 0
 
 # success, all done
 echo "*** done"
diff --git a/001.out b/001.out
index f80d1df..9d67b65 100644
--- a/001.out
+++ b/001.out
@@ -1,12 +1,12 @@
 QA output created by 001
-    cdb to send: 02 00 00 00 00 00 
-SCSI Status: Check Condition 
+    cdb to send: 02 00 00 00 00 00
+SCSI Status: Check Condition
 
 Sense Information:
  Fixed format, current;  Sense key: Illegal Request
  Additional sense: Invalid command operation code
  Raw sense data (in hex):
-        70 00 05 00 00 00 00 0a  00 00 00 00 20 00 00 00    
-        00 00                                               
+        70 00 05 00 00 00 00 0a  00 00 00 00 20 00 00 00
+        00 00
 
 *** done
diff --git a/002 b/002
index 37e938c..ff2b92c 100755
--- a/002
+++ b/002
@@ -22,7 +22,7 @@ status=1	# failure is the default!
 
 _require_command sg_raw
 
-sg_raw -r 255 -v $TEST_DEV 3 1 0 0 ff 0
+execute_cdb -r 255 3 1 0 0 ff 0
 
 # success, all done
 echo "*** done"
diff --git a/002.out b/002.out
index eb785a5..7d5b81d 100644
--- a/002.out
+++ b/002.out
@@ -1,13 +1,13 @@
 QA output created by 002
-    cdb to send: 03 01 00 00 ff 00 
-SCSI Status: Check Condition 
+    cdb to send: 03 01 00 00 ff 00
+SCSI Status: Check Condition
 
 Sense Information:
  Fixed format, current;  Sense key: Illegal Request
  Additional sense: Invalid field in cdb
  Raw sense data (in hex):
-        70 00 05 00 00 00 00 0a  00 00 00 00 24 00 00 00    
-        00 00                                               
+        70 00 05 00 00 00 00 0a  00 00 00 00 24 00 00 00
+        00 00
 
 Received 255 bytes of data:
  00     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
@@ -25,5 +25,5 @@ Received 255 bytes of data:
  c0     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
  d0     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
  e0     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
- f0     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00       ............... 
+ f0     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00       ...............
 *** done
diff --git a/003 b/003
index 2b537e3..558bb3a 100755
--- a/003
+++ b/003
@@ -18,8 +18,8 @@ status=1	# failure is the default!
 
 _require_command sg_raw
 
-sg_raw -v $TEST_DEV 3 0 0 0 0 0
-sg_raw -v $TEST_DEV 0x1a 0 1 0 0 0
+execute_cdb 3 0 0 0 0 0
+execute_cdb 0x1a 0 1 0 0 0
 
 # success, all done
 echo "*** done"
diff --git a/003.out b/003.out
index feca3e3..d5248ba 100644
--- a/003.out
+++ b/003.out
@@ -1,12 +1,12 @@
 QA output created by 003
-    cdb to send: 03 00 00 00 00 00 
-SCSI Status: Good 
+    cdb to send: 03 00 00 00 00 00
+SCSI Status: Good
 
 Sense Information:
 sense buffer empty
 
-    cdb to send: 1a 00 01 00 00 00 
-SCSI Status: Good 
+    cdb to send: 1a 00 01 00 00 00
+SCSI Status: Good
 
 Sense Information:
 sense buffer empty
diff --git a/004 b/004
index 0147cfe..f6f4b0d 100755
--- a/004
+++ b/004
@@ -19,16 +19,16 @@ status=1	# failure is the default!
 _require_command sg_raw
 
 # READ (10)
-sg_raw -v $TEST_DEV 0x28 0 0 0 0 0 0 0 0 0
+execute_cdb 0x28 0 0 0 0 0 0 0 0 0
 
 # WRITE (10)
-sg_raw -v $TEST_DEV 0x2a 0 0 0 0 0 0 0 0 0
+execute_cdb 0x2a 0 0 0 0 0 0 0 0 0
 
 # READ (16)
-sg_raw -v $TEST_DEV 0x88 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+execute_cdb 0x88 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 
 # WRITE (16)
-sg_raw -v $TEST_DEV 0x8a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+execute_cdb 0x8a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
 
 # success, all done
 echo "*** done"
diff --git a/004.out b/004.out
index 1948848..6b84e4e 100644
--- a/004.out
+++ b/004.out
@@ -1,24 +1,24 @@
 QA output created by 004
-    cdb to send: 28 00 00 00 00 00 00 00 00 00 
-SCSI Status: Good 
+    cdb to send: 28 00 00 00 00 00 00 00 00 00
+SCSI Status: Good
 
 Sense Information:
 sense buffer empty
 
-    cdb to send: 2a 00 00 00 00 00 00 00 00 00 
-SCSI Status: Good 
+    cdb to send: 2a 00 00 00 00 00 00 00 00 00
+SCSI Status: Good
 
 Sense Information:
 sense buffer empty
 
-    cdb to send: 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
-SCSI Status: Good 
+    cdb to send: 88 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+SCSI Status: Good
 
 Sense Information:
 sense buffer empty
 
-    cdb to send: 8a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
-SCSI Status: Good 
+    cdb to send: 8a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+SCSI Status: Good
 
 Sense Information:
 sense buffer empty
diff --git a/005 b/005
index b58a10a..7cf618f 100755
--- a/005
+++ b/005
@@ -18,7 +18,7 @@ status=1	# failure is the default!
 
 _require_command sg_raw
 
-sg_raw -v $TEST_DEV -r 54 0x12 0 1 0 36 0
+execute_cdb -r 54 0x12 0 1 0 36 0
 
 # success, all done
 echo "*** done"
diff --git a/005.out b/005.out
index 84c1519..05d62ab 100644
--- a/005.out
+++ b/005.out
@@ -1,17 +1,17 @@
 QA output created by 005
-    cdb to send: 12 00 01 00 36 00 
-SCSI Status: Check Condition 
+    cdb to send: 12 00 01 00 36 00
+SCSI Status: Check Condition
 
 Sense Information:
  Fixed format, current;  Sense key: Illegal Request
  Additional sense: Invalid field in cdb
  Raw sense data (in hex):
-        70 00 05 00 00 00 00 0a  00 00 00 00 24 00 00 00    
-        00 00                                               
+        70 00 05 00 00 00 00 0a  00 00 00 00 24 00 00 00
+        00 00
 
 Received 54 bytes of data:
  00     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
  10     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
  20     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
- 30     00 00 00 00 00 00                                   ......          
+ 30     00 00 00 00 00 00                                   ......
 *** done
diff --git a/006 b/006
index 7f54deb..ffe5cba 100755
--- a/006
+++ b/006
@@ -18,7 +18,7 @@ status=1	# failure is the default!
 
 _require_command sg_raw
 
-sg_raw -v $TEST_DEV -r 54 0x12 1 0xbf 0 36 0
+execute_cdb -r 54 0x12 1 0xbf 0 36 0
 
 # success, all done
 echo "*** done"
diff --git a/006.out b/006.out
index 9380007..eee97cf 100644
--- a/006.out
+++ b/006.out
@@ -1,17 +1,17 @@
 QA output created by 006
-    cdb to send: 12 01 bf 00 36 00 
-SCSI Status: Check Condition 
+    cdb to send: 12 01 bf 00 36 00
+SCSI Status: Check Condition
 
 Sense Information:
  Fixed format, current;  Sense key: Illegal Request
  Additional sense: Invalid field in cdb
  Raw sense data (in hex):
-        70 00 05 00 00 00 00 0a  00 00 00 00 24 00 00 00    
-        00 00                                               
+        70 00 05 00 00 00 00 0a  00 00 00 00 24 00 00 00
+        00 00
 
 Received 54 bytes of data:
  00     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
  10     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
  20     00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00    ................
- 30     00 00 00 00 00 00                                   ......          
+ 30     00 00 00 00 00 00                                   ......
 *** done
diff --git a/common.filter b/common.filter
index 060bb13..e565535 100644
--- a/common.filter
+++ b/common.filter
@@ -134,5 +134,16 @@ _filter_testdir()
     sed -e "s#$TEST_DEV#TEST_DEV#g"
 }
 
+# remove trailing whitespace, some versions of sg3_utils do that
+_filter_spaces()
+{
+    sed -e 's/ *$//'
+}
+
+execute_cdb()
+{
+    sg_raw -v $TEST_DEV "$@" 2>&1 | _filter_spaces
+}
+
 # make sure this script returns success
 /bin/true
-- 
1.7.9.3


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Photos]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

Add to Google Powered by Linux