Fix 'make check' errors
v4 cover Fix 'make check' errors
Various tests can be run using 'make check', 'make qcheck' and 'make tcheck'. These have become broken and need fixing to be useful again.
Running 'make qcheck' fails on the binman test to check the version numbers of the tools are found as expected. Update the code for the tools that have been updated and no longer have their version numbers found by the code.
There are also failures in buildman. First add code to understand 'gcc -E' as an alternative to cpp. Second add the code to accept an empty CROSS_COMPILE variable in the environment when testing that CROSS_COMPILE is not set by the toolchain selection.
dtoc was not achieving 100% code coverage so add a new test to rectify that.
Disable event_dump tests that are broken on newer versions of binutils.
Build mkeficapsule in the tree that is used for testing the tools.
'make tcheck' was not achieving 100% code coverage and needs to know the location of the built tools to resolve.
'make check' tests of the file system had errors due to ext4 file systems being created with an orphaned file but were marked clean.
---
Changes in v4:
- Drop patch removing setting of DTC environment variable
- Add error checking to use of fsck.ext4
- Minor updates from review comments
- Link to v3: https://patch.msgid.link/[email protected]
Changes in v3:
- Split fix of test_basic tests into two.
- Just remove the empty arg from lzma_alone version check instead of messing with run_cmd_result() and move this commit to become 2/15
- Add explanation and error log to commit message of 9/15
- Update commit to accept more preprocessor possibilities. 13/15
- Update the commit message for 11/15 and remove the change of PATH that fails to address this same issue.
- In 4/15 update the buildman test to cope if DTC is set externally.
- In 8/15 minor update to test file
- Add 5/15 and 6/15 to insulate binman and buildman tests from a DTC variable being set externally
- Picked up tags and trimmed Cc list
- Link to v2: https://patch.msgid.link/[email protected]
Changes in v2:
- Added commit 7/12 to address intermittent failure for binman to get version string from lzma_alone.
- Added commit 8/12 to address a test failure due to the build tree not containing the built version of mkeficapsule and using the system version instead.
- Dropped a space from the beginning of a line in a new file in 5/12 to quiet checkpatch warning and remove most of the content as not needed for test as suggested by Simon Glass.
- Fix 'make tcheck' binman code coverage test by passing in location of tools built from this tree in 9/12.
- Fix typo in tools/Kconfig for TOOLS_MKEFICAPSULE config item in 10/12
- Cope with CPP="gcc -E" in buildman in 11/12
- Ensure fsck can be run and use it to force clean ext4 file systems on creation to remove orphaned file. 12/12
- Picked up some rb tags from Simon Glass
- Link to v1: https://patch.msgid.link/[email protected]
To: [email protected]
To: Kory Maincent <[email protected]>
To: Linus Walleij <[email protected]>
To: Ilias Apalodimas <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Andrew Goodbody <[email protected]>
Cc: Anshul Dalal <[email protected]>
Cc: Alexey Charkov <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: Mattijs Korpershoek <[email protected]>
Cc: Carlo Caione <[email protected]>
Cc: Yao Zi <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Quentin Schulz <[email protected]>
Cc: Marek Vasut <[email protected]>
---
Andrew Goodbody (14):
binman: btool: lz4: Update version regex
binman: bintool: Do not add empty argument
binman: btool: lzma_alone: Update version function
buildman: Use mock environment to ignore DTC variable
binman: Use mock environment to ignore DTC variable
buildman: Cope with empty CROSS_COMPILE in tests
dtoc: test: Fix coverage by adding test
test: Disable running event_dump test for make check
test: Build mkeficapsule in tree used by tests
test: Pass location of built tools to binman code coverage test
tools: Fix typo in name of command mkeficapsule
buildman: Cope with CPP="gcc -E"
test: Fix test_basic file system tests
test: Ensure ext4 file system is truly clean on creation
configs/sandbox_spl_defconfig | 1 + test/py/tests/fs_helper.py | 6 ++++++ test/py/tests/test_fs/fstest_helpers.py | 12 +++++++++--- test/run | 9 +++++---- tools/Kconfig | 2 +- tools/binman/btool/lz4.py | 2 +- tools/binman/btool/lzma_alone.py | 2 +- tools/binman/ftest.py | 16 ++++++++++++---- tools/buildman/boards.py | 4 ++-- tools/buildman/func_test.py | 11 +++++++++-- tools/buildman/test.py | 12 ++++++------ tools/dtoc/test/dtoc_test_include.dts | 13 +++++++++++++ tools/dtoc/test/newinclude/dtoc_test_include_file.dtsi | 7 +++++++ tools/dtoc/test_fdt.py | 7 +++++++ 14 files changed, 80 insertions(+), 24 deletions(-)
---
base-commit: d1caced3a435607435cb7969e34499051a4ac1e6
change-id: 20261029-qcheck_fix-af97ed0d895b
Best regards,
Signature · 1 line
Andrew Goodbody <[email protected]>
PATCH v4 1/14 binman: btool: lz4: Update version regex
With the update to lz4 v1.10.x the version string has changed format. Previously the string looked like
"*** LZ4 command line interface 64-bits v1.9.2, by Yann Collet ***" and now it is
"*** lz4 v1.10.0 64-bit multithread, by Yann Collet ***" The ',' following the version number is no longer present so remove it from the regex used to match the version number. The regex will now match the version number in both of the forms so will continue to work with older versions of lz4 as well as newer ones.
--- tools/binman/btool/lz4.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/btool/lz4.py +1 -1
@@ -76,7 +76,7 @@ class Bintoollz4(bintool.Bintool): man lz4 """ def __init__(self, name): - super().__init__(name, 'lz4 compression', r'.* (v[0-9.]*),.*') + super().__init__(name, 'lz4 compression', r'.* (v[0-9.]*).*') def compress(self, indata): """Compress data with lz4
Signature · 1 line
2.47.3
PATCH v4 2/14 binman: bintool: Do not add empty argument
In reply to Andrew GoodbodyIf lzma_alone is invoked with an empty argument it will emit a message to stderr. When 'combined' is used to examine the output of this command the content is not deterministic in that stdout and stderr may appear out of order on occasions. To prevent this situation do not add an argument list to the command when it is empty. In this situation no error message is emitted only the usage and this is always sent to only stdout or only to stderr depending on the version of lzma_alone.
--- tools/binman/btool/lzma_alone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/btool/lzma_alone.py +1 -1
@@ -116,7 +116,7 @@ class Bintoollzma_alone(bintool.Bintool): Returns: str: Version number of lzma_alone """ - out = self.run_cmd_result('', raise_on_error=False).stderr.strip() + out = self.run_cmd_result(raise_on_error=False).stderr.strip() lines = out.splitlines() if not lines: return super().version()
Signature · 1 line
2.47.3
PATCH v4 3/14 binman: btool: lzma_alone: Update version function
In reply to Andrew Goodbodylzma_alone 24.08 now prints its version string to stdout instead of stderr which means the current version function will not find it as it only looks in stderr. Instead look in 'combined' which contains both stdout and stderr and so will work with older and newer versions of lzma_alone.
--- tools/binman/btool/lzma_alone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/binman/btool/lzma_alone.py +1 -1
@@ -116,7 +116,7 @@ class Bintoollzma_alone(bintool.Bintool): Returns: str: Version number of lzma_alone """ - out = self.run_cmd_result(raise_on_error=False).stderr.strip() + out = self.run_cmd_result(raise_on_error=False).combined.strip() lines = out.splitlines() if not lines: return super().version()
Signature · 1 line
2.47.3
PATCH v4 4/14 buildman: Use mock environment to ignore DTC variable
In reply to Andrew GoodbodyWhen testing the toolchain setting of DTC in buildman, use a mock environment to avoid making changes to the environment and give the test more control over the environment in use. This avoids test failures due to being passed an unexpected value for DTC.
--- tools/buildman/test.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/buildman/test.py +4 -4
@@ -1012,8 +1012,10 @@ class TestBuild(unittest.TestCase): def test_skip_dtc(self): """Test skipping building the dtc tool""" - old_path = os.getenv('PATH') - try: + local_env = os.environ.copy() + if 'DTC' in local_env: + del local_env['DTC'] + with unittest.mock.patch.dict('os.environ', local_env, clear=True): os.environ['PATH'] = self.base_dir # Check a missing tool
@@ -1038,8 +1040,6 @@ class TestBuild(unittest.TestCase): toolchain = self.toolchains.Select('arm') env = build.make_environment(toolchain) self.assertNotIn(b'DTC', env) - finally: - os.environ['PATH'] = old_path def testHomedir(self): """Test using ~ in a toolchain or toolchain-prefix section"""
Signature · 1 line
2.47.3
PATCH v4 5/14 binman: Use mock environment to ignore DTC variable
In reply to Andrew GoodbodyIf the environment contains the DTC variable and it is set to a relative path this can cause the tests testFitFdtListDir and testFitFdtListDirDefault to fail as they change the current working directory so that the value of DTC no longer points to a valid dtc binary and so the tests fail. Instead create a mock environment that has the DTC variable removed from it just for the duration of the test.
--- tools/binman/ftest.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
tools/binman/ftest.py +12 -4
@@ -7984,18 +7984,26 @@ fdt fdtmap Extract the devicetree blob from the fdtmap def testFitFdtListDir(self): """Test an image with an FIT with FDT images using fit,fdt-list-dir""" old_dir = os.getcwd() + local_env = os.environ.copy() + if 'DTC' in local_env: + local_env.pop('DTC') try: - os.chdir(self._indir) - self.CheckFitFdt('fit/fdt_dir.dts', False) + with unittest.mock.patch.dict('os.environ', local_env, clear=True): + os.chdir(self._indir) + self.CheckFitFdt('fit/fdt_dir.dts', False) finally: os.chdir(old_dir) def testFitFdtListDirDefault(self): """Test an FIT fit,fdt-list-dir where the default DT in is a subdir""" old_dir = os.getcwd() + local_env = os.environ.copy() + if 'DTC' in local_env: + local_env.pop('DTC') try: - os.chdir(self._indir) - self.CheckFitFdt('fit/fdt_dir.dts', False, + with unittest.mock.patch.dict('os.environ', local_env, clear=True): + os.chdir(self._indir) + self.CheckFitFdt('fit/fdt_dir.dts', False, default_dt='rockchip/test-fdt2') finally: os.chdir(old_dir)
Signature · 1 line
2.47.3
PATCH v4 6/14 buildman: Cope with empty CROSS_COMPILE in tests
In reply to Andrew GoodbodyWhen the buildman tests are run through the Makefile with eg 'make qcheck' the Makefile will export an empty CROSS_COMPILE variable into the environment. Add the code to the test that will accept this as OK.
--- tools/buildman/test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/buildman/test.py +2 -2
@@ -656,7 +656,7 @@ class TestBuild(unittest.TestCase): tc = self.toolchains.Select('sandbox') env = tc.MakeEnvironment(False) - self.assertTrue(b'CROSS_COMPILE' not in env) + self.assertTrue(b'CROSS_COMPILE' not in env or env[b'CROSS_COMPILE'] == b'') # Test config with ccache wrapper bsettings.setup(None)
@@ -668,7 +668,7 @@ class TestBuild(unittest.TestCase): tc = self.toolchains.Select('sandbox') env = tc.MakeEnvironment(False) - self.assertTrue(b'CROSS_COMPILE' not in env) + self.assertTrue(b'CROSS_COMPILE' not in env or env[b'CROSS_COMPILE'] == b'') def testPrepareOutputSpace(self): def _Touch(fname):
Signature · 1 line
2.47.3
PATCH v4 7/14 dtoc: test: Fix coverage by adding test
In reply to Andrew GoodbodyUse of 'indir' in EnsureCompiled() was not being tested and resulted in less than 100% code coverage. Add a test and supporting files that depends on the use of 'indir' by placing an included file in a new directory. The dts file will fail to compile if the new directory is not added to the search path with the use of 'indir'.
--- tools/dtoc/test/dtoc_test_include.dts | 13 +++++++++++++ tools/dtoc/test/newinclude/dtoc_test_include_file.dtsi | 7 +++++++ tools/dtoc/test_fdt.py | 7 +++++++ 3 files changed, 27 insertions(+)
tools/dtoc/test/dtoc_test_include.dts new file +13 -0
@@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test device tree file for dtoc + * + * Copyright 2017 Google, Inc + */ + +/dts-v1/; + +#include "dtoc_test_include_file.dtsi" + +/ { +};
tools/dtoc/test/newinclude/dtoc_test_include_file.dtsi new file +7 -0
@@ -0,0 +1,7 @@ +// SPDX-License-Identifier: GPL-2.0-only + +/ { + new_node { + intval = <2>; + }; +};
tools/dtoc/test_fdt.py +7 -0
@@ -1105,6 +1105,13 @@ class TestFdtUtil(unittest.TestCase): finally: tools.outdir = old_outdir + def test_ensure_compiled_indir(self): + """Test providing directory as indir""" + indir = os.path.dirname(find_dtb_file('dtoc_test_include.dts')) + indir = os.path.join(indir, 'newinclude') + dtb = fdt_util.EnsureCompiled(find_dtb_file('dtoc_test_include.dts'), indir=[indir]) + self.assertEqual(dtb, fdt_util.EnsureCompiled(dtb)) + def test_get_phandle_name_offset(self): val = fdt_util.GetPhandleNameOffset(self.node, 'missing') self.assertIsNone(val)
Signature · 1 line
2.47.3
PATCH v4 8/14 test: Disable running event_dump test for make check
In reply to Andrew GoodbodyThe event dump script does not work on more recent versions of binutils so disable it from running for the moment.
This is a known issue and was already addressed in CI last year.
commit 9420160a0d14 ("CI: Move to Ubuntu 24.04 'Noble' as the base")
The error is that in recent versions of binutils addr2line cannot get the source reference for static functions. Whether the information is missing from the debug data or is just a failure of addr2line is not known.
Below is the error log from running the test.
__________________________________________________________ test_event_dump ___________________________________________________________ test/py/tests/test_event_dump.py:26: in test_event_dump
assert re.match(expect, out, re.MULTILINE) is not None
E AssertionError: assert None is not None
E + where None = <function match at 0x7f0798574e00>('.*Event type Id Source location\n-------------------- ----------------------...check .*arch/sandbox/cpu/start.c:.*\nEVT_TEST h_adder_simple .*test/common/event.c:', 'Event type Id Source location\n-------------------- ------------------------...pt_check build-sandbox/../arch/sandbox/cpu/start.c:61\nEVT_TEST h_adder_simple :?\n', re.MULTILINE)
E + where <function match at 0x7f0798574e00> = re.match
E + and re.MULTILINE = re.MULTILINE
-------------------------------------------------------- Captured stdout call --------------------------------------------------------
+scripts/event_dump.py /home/andrew/src/work/u-boot/build-sandbox/u-boot
Event type Id Source location
-------------------- ------------------------------ ------------------------------
EVT_DM_PRE_REMOVE dm_mdio_mux_parent_pre_remove :?
EVT_FT_FIXUP bootmeth_vbe_ft_fixup :?
EVT_FT_FIXUP bootmeth_vbe_simple_ft_fixup :?
EVT_LAST_STAGE_INIT alloc_write_acpi_tables :?
EVT_LAST_STAGE_INIT efi_block_device_create :?
EVT_LAST_STAGE_INIT install_smbios_table :?
EVT_LAST_STAGE_INIT tpm_evt_autostart :?
EVT_MISC_INIT_F sandbox_early_getopt_check build-sandbox/../arch/sandbox/cpu/start.c:61
EVT_TEST h_adder_simple :?====================================================== short test summary info ======================================================= FAILED test/py/tests/test_event_dump.py::test_event_dump - AssertionError: assert None is not None ========================= 1 failed, 1151 passed, 170 skipped, 345 deselected, 1 xfailed in 147.30s (0:02:27) =========================
--- test/run | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
test/run +3 -2
@@ -15,8 +15,9 @@ run_test() { # Select test attributes ut_mark_expr=test_ut +mark_expr="not event_dump" if [ "$1" = "quick" ]; then - mark_expr="not slow" + mark_expr="not slow and not event_dump" ut_mark_expr="test_ut and not slow" skip=--skip-net-tests fi
@@ -32,7 +33,7 @@ if [ "$1" = "parallel" ]; then para="-n${jobs} -q" prompt="Building and..." skip=--skip-net-tests - mark_expr="not slow and not bootstd and not spi_flash" + mark_expr="not slow and not bootstd and not spi_flash and not event_dump" ut_mark_expr="test_ut and not slow and not bootstd and not spi_flash" echo "Note: test log is garbled with parallel tests" fi
Signature · 1 line
2.47.3
PATCH v4 9/14 test: Build mkeficapsule in tree used by tests
In reply to Andrew GoodbodySince the commit to only build mkeficapsule when needed rather than by default, the build tree build-sandbox_spl no longer contains the built version of mkeficapsule and this can lead to a binman test failure. Add the config line to the defconfig so that mkeficapsule is built and the tests will now work. 'make savedefconfig' was used to generate the new defconfig file.
Building mkeficapsule in sandbox_spl is needed because that is the tree used to run binman tests due to it being built for both 'make qcheck' and also 'make tcheck'. The sandbox tree, which already builds mkeficapsule, is not built for 'make tcheck' and building it would just add extra time to the run.
--- configs/sandbox_spl_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/sandbox_spl_defconfig +1 -0
@@ -242,3 +242,4 @@ CONFIG_UNIT_TEST=y CONFIG_SPL_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y +CONFIG_TOOLS_MKEFICAPSULE=y
Signature · 1 line
2.47.3
PATCH v4 10/14 test: Pass location of built tools to binman code coverage test
In reply to Andrew GoodbodyWhen running binman for code coverage tests and invoked by 'make tcheck' some tests can fail if they use system installed versions of tools instead of ones built from the tree under test. Use the toolpath option to point at the locally built tools so that these built versions are chosen before system ones and to match the prior invocation of binman. Drop the change to PATH which did not work as it put the TOOLS_DIR at the end not the start.
--- test/run | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
test/run +2 -2
@@ -93,8 +93,8 @@ run_test "dtoc" ./tools/dtoc/dtoc -t # Code-coverage tests cannot run in parallel, so skip them in that case if [ -z "${para}" ]; then - export PATH=$PATH:${TOOLS_DIR} - run_test "binman code coverage" ./tools/binman/binman test -T + run_test "binman code coverage" ./tools/binman/binman \ + --toolpath ${TOOLS_DIR} test -T run_test "dtoc code coverage" ./tools/dtoc/dtoc -T run_test "fdt code coverage" ./tools/dtoc/test_fdt -T fi
Signature · 1 line
2.47.3
PATCH v4 11/14 tools: Fix typo in name of command mkeficapsule
In reply to Andrew GoodbodyThe description for the config item TOOLS_MKEFICAPSULE has a typo, fix it. efimkcapsule -> mkeficapsule
--- tools/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/Kconfig +1 -1
@@ -107,7 +107,7 @@ config TOOLS_SHA512 Enable SHA512 support in the tools builds config TOOLS_MKEFICAPSULE - bool "Build efimkcapsule command" + bool "Build mkeficapsule command" default y if EFI_HAVE_CAPSULE_SUPPORT help This command allows users to create a UEFI capsule file and,
Signature · 1 line
2.47.3
PATCH v4 12/14 buildman: Cope with CPP="gcc -E"
In reply to Andrew GoodbodyAllow the use of "gcc -E" as an alternative to "cpp" when set in the environment as the value of CPP. Accept it as a valid command for running the preprocessor and adjust the test to not depend on a fixed number of arguments. Also split it into parts for constructing the command list so that the validation for running a command does not fail when it tries to find an executable named "gcc -E".
As well as -E accept --preprocess. Also accept clang instead of gcc.
--- tools/buildman/boards.py | 4 ++-- tools/buildman/func_test.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-)
tools/buildman/boards.py +2 -2
@@ -12,6 +12,7 @@ import glob import multiprocessing import os import re +import shlex import sys import tempfile import time
@@ -244,8 +245,7 @@ class KconfigScanner: temp = None if b'#include' in tools.read_file(defconfig): - cmd = [ - os.getenv('CPP', 'cpp'), + cmd = shlex.split(os.getenv('CPP', 'cpp')) + [ '-nostdinc', '-P', '-I', self._srctree, '-undef',
tools/buildman/func_test.py +9 -2
@@ -378,7 +378,12 @@ class TestFunctional(unittest.TestCase): def _HandleCommandCpp(self, args): # args ['-nostdinc', '-P', '-I', '/tmp/tmp7f17xk_o/src', '-undef', # '-x', 'assembler-with-cpp', fname] - fname = args[7] + # If 'gcc -E' is defined as the preprocessor then the args list will + # have an additional item, '-E', at the beginning which changes the + # number of items in the argument list. In order to guarantee picking + # up the filename use -1 as the position which will always be the last + # item + fname = args[-1] buf = io.StringIO() for line in tools.read_file(fname, False).splitlines(): if line.startswith('#include'):
@@ -424,7 +429,9 @@ class TestFunctional(unittest.TestCase): return self._HandleCommandObjcopy(args) elif cmd.endswith( 'size'): return self._HandleCommandSize(args) - elif cmd.endswith( 'cpp'): + elif cmd.endswith('cpp') \ + or ((cmd.endswith(('gcc', 'clang'))) \ + and ('-E' in pipe_list[0] or '--preprocess' in pipe_list[0])): return self._HandleCommandCpp(args) if not result:
Signature · 1 line
2.47.3
PATCH v4 13/14 test: Fix test_basic file system tests
In reply to Andrew GoodbodyEnsure that /sbin is on the path so that distributions that do not have it will still be able to successfully run these tests that need fsck.
--- test/py/tests/test_fs/fstest_helpers.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
test/py/tests/test_fs/fstest_helpers.py +9 -3
@@ -3,15 +3,21 @@ # Author: JJ Hiblot <[email protected]> # +import os from subprocess import check_call, CalledProcessError def assert_fs_integrity(fs_type, fs_img): + # Some distributions do not add /sbin to the default PATH, where fsck lives + local_env = os.environ.copy() + if '/sbin' not in local_env["PATH"].split(os.pathsep): + local_env["PATH"] += os.pathsep + '/sbin' + try: if fs_type == 'ext4': - check_call('fsck.ext4 -n -f %s' % fs_img, shell=True) + check_call('fsck.ext4 -n -f %s' % fs_img, shell=True, env=local_env) elif fs_type == 'exfat': - check_call('fsck.exfat -n %s' % fs_img, shell=True) + check_call('fsck.exfat -n %s' % fs_img, shell=True, env=local_env) elif fs_type in ['fat12', 'fat16', 'fat32']: - check_call('fsck.fat -n %s' % fs_img, shell=True) + check_call('fsck.fat -n %s' % fs_img, shell=True, env=local_env) except CalledProcessError: raise
Signature · 1 line
2.47.3
PATCH v4 14/14 test: Ensure ext4 file system is truly clean on creation
In reply to Andrew GoodbodyForce a run of fsck on the newly created ext4 file system to remove the orphaned file that is present despite being marked clean. If this is not done the integrity tests will fail as they will detect the presence of this orphaned file.
--- test/py/tests/fs_helper.py | 6 ++++++ 1 file changed, 6 insertions(+)
test/py/tests/fs_helper.py +6 -0
@@ -268,6 +268,12 @@ def mk_fs(config, fs_type, size, prefix, src_dir=None, fs_img=None, quiet=False) shell=True).decode() if 'metadata_csum' in sb_content: check_call(f'tune2fs -O ^metadata_csum {fs_img}', shell=True) + # Cannot use check_call here as it will return an exit code of 1 + # as it modifies the file system. The -f is needed as although the + # fs is marked clean, it is not really. + ret = call(f'fsck.ext4 -f -y {fs_img}', shell=True) + if ret not in (0, 1): + raise CalledProcessError(ret, f'fsck.ext4 -f -y {fs_img}') elif fs_lnxtype == 'vfat' and src_dir: flags = f"-smpQ{'' if quiet else 'v'}" check_call(f'mcopy -i {fs_img} {flags} {src_dir}/* ::/',
Signature · 1 line
2.47.3