[Concept,08/15] test: Shorten the encrypt_passphrase parameter for FsHelper

Message ID 20251111124131.1198930-9-sjg@u-boot.org
State New
Headers
Series luks: Provide support for LUKSv2 |

Commit Message

Simon Glass Nov. 11, 2025, 12:41 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

This is very long and the 'encrypt' part is implied by the passphrase.
Shorten it to just 'passphrase'.

Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 doc/usage/luks.rst         |  2 +-
 test/py/img/common.py      |  2 +-
 test/py/tests/fs_helper.py | 14 +++++++-------
 3 files changed, 9 insertions(+), 9 deletions(-)
  

Patch

diff --git a/doc/usage/luks.rst b/doc/usage/luks.rst
index a87abe140db..24be8d1ea81 100644
--- a/doc/usage/luks.rst
+++ b/doc/usage/luks.rst
@@ -232,7 +232,7 @@  See ``test/py/tests/fs_helper.py`` for the ``FsHelper`` class::
     # Create encrypted filesystem
     with FsHelper(config, 'ext4', 30, 'test',
                   part_mb=60,
-                  encrypt_passphrase='mypassword') as fsh:
+                  passphrase='mypassword') as fsh:
         # Add files to fsh.srcdir
         with open(os.path.join(fsh.srcdir, 'hello.txt'), 'w') as f:
             f.write('Hello from LUKS!\n')
diff --git a/test/py/img/common.py b/test/py/img/common.py
index 3b3fdb2734b..f5a7fcba804 100644
--- a/test/py/img/common.py
+++ b/test/py/img/common.py
@@ -82,7 +82,7 @@  def setup_extlinux_image(config, log, devnum, basename, vmlinux, initrd, dtbdir,
 
     ext4 = FsHelper(config, 'ext4', max(1, part2_size - 30), prefix=basename,
                     part_mb=part2_size,
-                    encrypt_passphrase='test' if use_fde else None,
+                    passphrase='test' if use_fde else None,
                     luks_version=use_fde if use_fde else 2)
     ext4.setup()
 
diff --git a/test/py/tests/fs_helper.py b/test/py/tests/fs_helper.py
index 914de09e381..4812d3f053b 100644
--- a/test/py/tests/fs_helper.py
+++ b/test/py/tests/fs_helper.py
@@ -41,7 +41,7 @@  class FsHelper:
         To create an encrypted LUKS2 partition (default):
 
             with FsHelper(ubman.config, 'ext4', 10, 'mmc1',
-                          encrypt_passphrase='test') as fsh:
+                          passphrase='test') as fsh:
                 # create files in the fsh.srcdir directory
                 fsh.mk_fs()  # Creates and encrypts the filesystem with LUKS2
                 ...
@@ -49,7 +49,7 @@  class FsHelper:
         To create an encrypted LUKS1 partition:
 
             with FsHelper(ubman.config, 'ext4', 10, 'mmc1',
-                          encrypt_passphrase='test', luks_version=1) as fsh:
+                          passphrase='test', luks_version=1) as fsh:
                 # create files in the fsh.srcdir directory
                 fsh.mk_fs()  # Creates and encrypts the filesystem with LUKS1
                 ...
@@ -59,7 +59,7 @@  class FsHelper:
             default value but can be overwritten
     """
     def __init__(self, config, fs_type, size_mb, prefix, part_mb=None,
-                 encrypt_passphrase=None, luks_version=2):
+                 passphrase=None, luks_version=2):
         """Set up a new object
 
         Args:
@@ -71,7 +71,7 @@  class FsHelper:
             part_mb (int, optional): Size of partition in MB. If None, defaults
                 to size_mb. This can be used to make the partition larger than
                 the filesystem, to create space for disk-encryption metadata
-            encrypt_passphrase (str, optional): If provided, encrypt the
+            passphrase (str, optional): If provided, encrypt the
                 filesystem with LUKS using this passphrase
             luks_version (int): LUKS version to use (1 or 2). Defaults to 2.
         """
@@ -85,7 +85,7 @@  class FsHelper:
         self.partition_mb = part_mb if part_mb is not None else size_mb
         self.prefix = prefix
         self.quiet = True
-        self.encrypt_passphrase = encrypt_passphrase
+        self.passphrase = passphrase
         self.luks_version = luks_version
 
         # Use a default filename; the caller can adjust it
@@ -159,8 +159,8 @@  class FsHelper:
                     shell=True)
 
         # Encrypt the filesystem if requested
-        if self.encrypt_passphrase:
-            self.encrypt_luks(self.encrypt_passphrase)
+        if self.passphrase:
+            self.encrypt_luks(self.passphrase)
 
     def setup(self):
         """Set up the srcdir ready to receive files"""