diff mbox series

tests: support mkfs.ext4 without metadata_csum

Message ID 20200804172833.17005-1-swarren@wwwdotorg.org
State Accepted
Commit cc886253704424f2a332dade72dc1853e78bca04
Delegated to: Tom Rini
Headers show
Series tests: support mkfs.ext4 without metadata_csum | expand

Commit Message

Stephen Warren Aug. 4, 2020, 5:28 p.m. UTC
From: Stephen Warren <swarren@nvidia.com>

Modify various test/py filesystem creation routines to support systems
that don't implement the metadata_csum ext4 feature.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
 test/py/tests/test_env.py         | 5 ++++-
 test/py/tests/test_fs/conftest.py | 6 ++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

Comments

Tom Rini Aug. 8, 2020, 12:31 p.m. UTC | #1
On Tue, Aug 04, 2020 at 11:28:33AM -0600, Stephen Warren wrote:

> From: Stephen Warren <swarren@nvidia.com>
> 
> Modify various test/py filesystem creation routines to support systems
> that don't implement the metadata_csum ext4 feature.
> 
> Signed-off-by: Stephen Warren <swarren@nvidia.com>

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

Patch

diff --git a/test/py/tests/test_env.py b/test/py/tests/test_env.py
index 86ec1b36d36e..2ae8f25381ea 100644
--- a/test/py/tests/test_env.py
+++ b/test/py/tests/test_env.py
@@ -416,7 +416,10 @@  def mk_env_ext4(state_test_env):
     else:
         try:
             u_boot_utils.run_and_log(c, 'dd if=/dev/zero of=%s bs=1M count=16' % persistent)
-            u_boot_utils.run_and_log(c, 'mkfs.ext4 -O ^metadata_csum %s' % persistent)
+            u_boot_utils.run_and_log(c, 'mkfs.ext4 %s' % persistent)
+            sb_content = u_boot_utils.run_and_log(c, 'tune2fs -l %s' % persistent)
+            if 'metadata_csum' in sb_content:
+                u_boot_utils.run_and_log(c, 'tune2fs -O ^metadata_csum %s' % persistent)
         except CalledProcessError:
             call('rm -f %s' % persistent, shell=True)
             raise
diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py
index ee82169c2a37..58e8cd46ee2c 100644
--- a/test/py/tests/test_fs/conftest.py
+++ b/test/py/tests/test_fs/conftest.py
@@ -149,8 +149,6 @@  def mk_fs(config, fs_type, size, id):
         mkfs_opt = '-F 16'
     elif fs_type == 'fat32':
         mkfs_opt = '-F 32'
-    elif fs_type == 'ext4':
-        mkfs_opt = '-O ^metadata_csum'
     else:
         mkfs_opt = ''
 
@@ -167,6 +165,10 @@  def mk_fs(config, fs_type, size, id):
             % (fs_img, count), shell=True)
         check_call('mkfs.%s %s %s'
             % (fs_lnxtype, mkfs_opt, fs_img), shell=True)
+        if fs_type == 'ext4':
+            sb_content = check_output('tune2fs -l %s' % fs_img, shell=True).decode()
+            if 'metadata_csum' in sb_content:
+                check_call('tune2fs -O ^metadata_csum %s' % fs_img, shell=True)
         return fs_img
     except CalledProcessError:
         call('rm -f %s' % fs_img, shell=True)