]> git.ipfire.org Git - thirdparty/linux.git/commit - scripts/rust_is_available_test.py
kbuild: rust_is_available: add test suite
authorMiguel Ojeda <ojeda@kernel.org>
Fri, 16 Jun 2023 00:16:31 +0000 (02:16 +0200)
committerMiguel Ojeda <ojeda@kernel.org>
Wed, 9 Aug 2023 23:18:34 +0000 (01:18 +0200)
commit0bb1c9282e2cb38d199347d1d96b77f208b64810
treeb9138b81d9fd265c08400dc8ffebf9b36ccd4500
parentbc60c930a43c7c984c80e99282f0d4f7193f3986
kbuild: rust_is_available: add test suite

The `rust_is_available.sh` script runs for everybody compiling the
kernel, even if not using Rust. Therefore, it is important to ensure
that the script is correct to avoid breaking people's compilation.

In addition, the script needs to be able to handle a set of subtle
cases, including parsing version strings of different tools.

Therefore, maintenance of this script can be greatly eased with
a set of tests.

Thus add a test suite to cover hopefully most of the setups that
the script may encounter in the wild. Extra setups can be easily
added later on if missing.

The script currently covers all the branches of the shell script,
including several ways in which they may be entered.

Python is used for this script, since the script under test
does not depend on Rust, thus hopefully making it easier for others
to use if the need arises.

Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
Link: https://lore.kernel.org/r/20230616001631.463536-12-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
scripts/rust_is_available_test.py [new file with mode: 0755]