From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Laura Nao <laura.nao@collabora.com>,
Miguel Ojeda <ojeda@kernel.org>,
Alex Gaynor <alex.gaynor@gmail.com>,
Wedson Almeida Filho <wedsonaf@gmail.com>,
Shuah Khan <shuah@kernel.org>
Cc: "Muhammad Usama Anjum" <usama.anjum@collabora.com>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <benno.lossin@proton.me>,
"Andreas Hindborg" <a.hindborg@samsung.com>,
"Alice Ryhl" <aliceryhl@google.com>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, kernel@collabora.com
Subject: Re: [PATCH] kselftest: Add basic test for probing the rust sample modules
Date: Sat, 30 Dec 2023 13:19:47 +0500 [thread overview]
Message-ID: <ce75321b-da1f-457a-abc5-982c0e95fff6@collabora.com> (raw)
In-Reply-To: <20231215132132.169628-1-laura.nao@collabora.com>
On 12/15/23 6:21 PM, Laura Nao wrote:
> Add new basic kselftest that checks if the available rust sample modules
> can be added and removed correctly.
>
> Signed-off-by: Laura Nao <laura.nao@collabora.com>
Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
Tested-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> MAINTAINERS | 1 +
> tools/testing/selftests/Makefile | 1 +
> tools/testing/selftests/rust/.gitignore | 1 +
> tools/testing/selftests/rust/Makefile | 8 ++++
> .../selftests/rust/test_probe_samples.sh | 42 +++++++++++++++++++
> 5 files changed, 53 insertions(+)
> create mode 100644 tools/testing/selftests/rust/.gitignore
> create mode 100644 tools/testing/selftests/rust/Makefile
> create mode 100755 tools/testing/selftests/rust/test_probe_samples.sh
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e2c6187a3ac8..acf283a5d2c0 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -18847,6 +18847,7 @@ F: Documentation/rust/
> F: rust/
> F: samples/rust/
> F: scripts/*rust*
> +F: tools/testing/selftests/rust/
> K: \b(?i:rust)\b
>
> RXRPC SOCKETS (AF_RXRPC)
> diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
> index 3b2061d1c1a5..26140426c849 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -74,6 +74,7 @@ TARGETS += riscv
> TARGETS += rlimits
> TARGETS += rseq
> TARGETS += rtc
> +TARGETS += rust
> TARGETS += seccomp
> TARGETS += sgx
> TARGETS += sigaltstack
> diff --git a/tools/testing/selftests/rust/.gitignore b/tools/testing/selftests/rust/.gitignore
> new file mode 100644
> index 000000000000..e3c5c04d1b19
> --- /dev/null
> +++ b/tools/testing/selftests/rust/.gitignore
> @@ -0,0 +1 @@
> +ktap_helpers.sh
> diff --git a/tools/testing/selftests/rust/Makefile b/tools/testing/selftests/rust/Makefile
> new file mode 100644
> index 000000000000..ccaa50f35b5b
> --- /dev/null
> +++ b/tools/testing/selftests/rust/Makefile
> @@ -0,0 +1,8 @@
> +
> +TEST_PROGS += test_probe_samples.sh
> +TEST_GEN_FILES := ktap_helpers.sh
> +
> +include ../lib.mk
> +
> +$(OUTPUT)/ktap_helpers.sh:
> + cp $(top_srcdir)/tools/testing/selftests/dt/ktap_helpers.sh $@
> diff --git a/tools/testing/selftests/rust/test_probe_samples.sh b/tools/testing/selftests/rust/test_probe_samples.sh
> new file mode 100755
> index 000000000000..a46550543f73
> --- /dev/null
> +++ b/tools/testing/selftests/rust/test_probe_samples.sh
> @@ -0,0 +1,42 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# Copyright (c) 2023 Collabora Ltd
> +#
> +# This script tests whether the rust sample modules can
> +# be added and removed correctly.
> +#
> +
> +DIR="$(dirname "$(readlink -f "$0")")"
> +
> +source "${DIR}"/ktap_helpers.sh
> +
> +rust_sample_modules=("rust_minimal" "rust_print")
> +
> +KSFT_PASS=0
> +KSFT_FAIL=1
> +KSFT_SKIP=4
> +
> +ret="${KSFT_PASS}"
> +
> +ktap_print_header
> +
> +ktap_set_plan "${#rust_sample_modules[@]}"
> +
> +for sample in "${rust_sample_modules[@]}"; do
> + if ! /sbin/modprobe -n -q "$sample"; then
> + ktap_test_skip "module $sample is not found in /lib/modules/$(uname -r)"
> + continue
> + fi
> +
> + if /sbin/modprobe -q "$sample"; then
> + /sbin/modprobe -q -r "$sample"
> + ktap_test_pass "$sample"
> + else
> + ret="${KSFT_FAIL}"
> + ktap_test_fail "$sample"
> + fi
> +done
> +
> +ktap_print_totals
> +exit "${ret}"
--
BR,
Muhammad Usama Anjum
prev parent reply other threads:[~2023-12-30 8:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-15 13:21 [PATCH] kselftest: Add basic test for probing the rust sample modules Laura Nao
2023-12-17 23:22 ` Sergio González Collado
2023-12-21 19:46 ` Miguel Ojeda
2024-01-02 14:25 ` Laura Nao
2024-02-22 15:20 ` Laura Nao
2023-12-30 8:19 ` Muhammad Usama Anjum [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ce75321b-da1f-457a-abc5-982c0e95fff6@collabora.com \
--to=usama.anjum@collabora.com \
--cc=a.hindborg@samsung.com \
--cc=alex.gaynor@gmail.com \
--cc=aliceryhl@google.com \
--cc=benno.lossin@proton.me \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=gary@garyguo.net \
--cc=kernel@collabora.com \
--cc=laura.nao@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=wedsonaf@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).