diff mbox series

[U-Boot,PATCHv3,09/13] test/py: Update test_fs to decode check_output calls

Message ID 20191024155928.28616-10-trini@konsulko.com
State Accepted
Commit d2b5240c9a0303e2d2ed3cd540d7e32b6f198664
Delegated to: Tom Rini
Headers show
Series Moving test/py to Python 3 | expand

Commit Message

Tom Rini Oct. 24, 2019, 3:59 p.m. UTC
The check_output function from the subprocess Python module by default
returns data as encoded bytes and leaves decoding to the application.
Given our uses of the call, it makes the most sense to immediately
decode the results.

Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
Signed-off-by: Tom Rini <trini@konsulko.com>
---
Changes in v2:
- New patch
---
 test/py/tests/test_fs/conftest.py | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

Tom Rini Nov. 1, 2019, 1:32 p.m. UTC | #1
On Thu, Oct 24, 2019 at 11:59:24AM -0400, Tom Rini wrote:

> The check_output function from the subprocess Python module by default
> returns data as encoded bytes and leaves decoding to the application.
> Given our uses of the call, it makes the most sense to immediately
> decode the results.
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> Tested-by: Stephen Warren <swarren@nvidia.com>
> Tested-by: Simon Glass <sjg@chromium.org> [on sandbox]
> Signed-off-by: Tom Rini <trini@konsulko.com>

Applied to u-boot/master, thanks!
diff mbox series

Patch

diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
index 354d17672fe4..1949f916197a 100644
--- a/test/py/tests/test_fs/conftest.py
+++ b/test/py/tests/test_fs/conftest.py
@@ -300,38 +300,38 @@  def fs_obj_basic(request, u_boot_config):
         # Generate the md5sums of reads that we will test against small file
         out = check_output(
             'dd if=%s bs=1M skip=0 count=1 2> /dev/null | md5sum'
-	    % small_file, shell=True)
+	    % small_file, shell=True).decode()
         md5val = [ out.split()[0] ]
 
         # Generate the md5sums of reads that we will test against big file
         # One from beginning of file.
         out = check_output(
             'dd if=%s bs=1M skip=0 count=1 2> /dev/null | md5sum'
-	    % big_file, shell=True)
+	    % big_file, shell=True).decode()
         md5val.append(out.split()[0])
 
         # One from end of file.
         out = check_output(
             'dd if=%s bs=1M skip=2499 count=1 2> /dev/null | md5sum'
-	    % big_file, shell=True)
+	    % big_file, shell=True).decode()
         md5val.append(out.split()[0])
 
         # One from the last 1MB chunk of 2GB
         out = check_output(
             'dd if=%s bs=1M skip=2047 count=1 2> /dev/null | md5sum'
-	    % big_file, shell=True)
+	    % big_file, shell=True).decode()
         md5val.append(out.split()[0])
 
         # One from the start 1MB chunk from 2GB
         out = check_output(
             'dd if=%s bs=1M skip=2048 count=1 2> /dev/null | md5sum'
-	    % big_file, shell=True)
+	    % big_file, shell=True).decode()
         md5val.append(out.split()[0])
 
         # One 1MB chunk crossing the 2GB boundary
         out = check_output(
             'dd if=%s bs=512K skip=4095 count=2 2> /dev/null | md5sum'
-	    % big_file, shell=True)
+	    % big_file, shell=True).decode()
         md5val.append(out.split()[0])
 
         umount_fs(mount_dir)
@@ -390,7 +390,7 @@  def fs_obj_ext(request, u_boot_config):
             % min_file, shell=True)
         out = check_output(
             'dd if=%s bs=1K 2> /dev/null | md5sum'
-            % min_file, shell=True)
+            % min_file, shell=True).decode()
         md5val = [ out.split()[0] ]
 
         # Calculate md5sum of Test Case 4
@@ -399,7 +399,7 @@  def fs_obj_ext(request, u_boot_config):
         check_call('dd if=%s of=%s bs=1K seek=5 count=20'
             % (min_file, tmp_file), shell=True)
         out = check_output('dd if=%s bs=1K 2> /dev/null | md5sum'
-            % tmp_file, shell=True)
+            % tmp_file, shell=True).decode()
         md5val.append(out.split()[0])
 
         # Calculate md5sum of Test Case 5
@@ -408,7 +408,7 @@  def fs_obj_ext(request, u_boot_config):
         check_call('dd if=%s of=%s bs=1K seek=5 count=5'
             % (min_file, tmp_file), shell=True)
         out = check_output('dd if=%s bs=1K 2> /dev/null | md5sum'
-            % tmp_file, shell=True)
+            % tmp_file, shell=True).decode()
         md5val.append(out.split()[0])
 
         # Calculate md5sum of Test Case 7
@@ -417,7 +417,7 @@  def fs_obj_ext(request, u_boot_config):
         check_call('dd if=%s of=%s bs=1K seek=20 count=20'
             % (min_file, tmp_file), shell=True)
         out = check_output('dd if=%s bs=1K 2> /dev/null | md5sum'
-            % tmp_file, shell=True)
+            % tmp_file, shell=True).decode()
         md5val.append(out.split()[0])
 
         check_call('rm %s' % tmp_file, shell=True)
@@ -582,11 +582,11 @@  def fs_obj_symlink(request, u_boot_config):
         # Generate the md5sums of reads that we will test against small file
         out = check_output(
             'dd if=%s bs=1M skip=0 count=1 2> /dev/null | md5sum'
-            % small_file, shell=True)
+            % small_file, shell=True).decode()
         md5val = [out.split()[0]]
         out = check_output(
             'dd if=%s bs=10M skip=0 count=1 2> /dev/null | md5sum'
-            % medium_file, shell=True)
+            % medium_file, shell=True).decode()
         md5val.extend([out.split()[0]])
 
         umount_fs(mount_dir)