On Mon, Aug 24, 2026 at 10:15:19AM +0200, Gabriele Monaco wrote:
> The rvgen kunit command generates .bak backup files and these can be
> checked in for selftests (make check). Clean targets like make disclean
> remove such files, leaving the tree dirty.
> 
> Switch to .old to preserve a clean tree after make disclean.
> 
> Reported-by: Kuan-Wei Chiu <[email protected]>
> Closes: https://lore.kernel.org/lkml/[email protected]
> Fixes: 7b6246294eb0 ("verification/rvgen: Add selftests for rvgen kunit")
> Signed-off-by: Gabriele Monaco <[email protected]>

Thanks for the quick fix!
The working tree now remains clean after running make distclean.

Tested-by: Kuan-Wei Chiu <[email protected]>

Regards,
Kuan-Wei

> ---
>  tools/verification/rvgen/rvgen/kunit.py                         | 2 +-
>  .../{test_bak_kunit_kunit.c.bak => test_bak_kunit_kunit.c.old}  | 0
>  2 files changed, 1 insertion(+), 1 deletion(-)
>  rename 
> tools/verification/rvgen/tests/golden/test_bak_kunit/{test_bak_kunit_kunit.c.bak
>  => test_bak_kunit_kunit.c.old} (100%)
> 
> diff --git a/tools/verification/rvgen/rvgen/kunit.py 
> b/tools/verification/rvgen/rvgen/kunit.py
> index ed2082d7d3bc..85973f918c9b 100644
> --- a/tools/verification/rvgen/rvgen/kunit.py
> +++ b/tools/verification/rvgen/rvgen/kunit.py
> @@ -173,7 +173,7 @@ EXPORT_SYMBOL_IF_KUNIT({struct_name});
>              for path in (header_file_path, kunit_c_file_path):
>                  if path.exists():
>                      try:
> -                        path.rename(path.with_suffix(path.suffix + ".bak"))
> +                        path.rename(path.with_suffix(path.suffix + ".old"))
>                      except OSError as e:
>                          raise KUnitError(f"Error backing up file {path}: 
> {e}") from e
>  
> diff --git 
> a/tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.bak
>  
> b/tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.old
> similarity index 100%
> rename from 
> tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.bak
> rename to 
> tools/verification/rvgen/tests/golden/test_bak_kunit/test_bak_kunit_kunit.c.old
> 
> base-commit: 0a0d1d55dad570724bf8c7ea83409639cfb4be9b
> -- 
> 2.55.0
> 

Reply via email to