[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240222155338.26836-1-kernel@valentinobst.de>
Date: Thu, 22 Feb 2024 16:53:38 +0100
From: Valentin Obst <kernel@...entinobst.de>
To: laura.nao@...labora.com
Cc: a.hindborg@...sung.com,
alex.gaynor@...il.com,
aliceryhl@...gle.com,
benno.lossin@...ton.me,
bjorn3_gh@...tonmail.com,
boqun.feng@...il.com,
gary@...yguo.net,
kernel@...labora.com,
linux-kernel@...r.kernel.org,
linux-kselftest@...r.kernel.org,
ojeda@...nel.org,
rust-for-linux@...r.kernel.org,
sergio.collado@...il.com,
shuah@...nel.org,
usama.anjum@...labora.com,
wedsonaf@...il.com,
Valentin Obst <kernel@...entinobst.de>
Subject: Re: [PATCH v2] kselftest: Add basic test for probing the rust sample modules
> 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..6fcc2cd83d89
> --- /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}"/../kselftest/ktap_helpers.sh
> +
> +rust_sample_modules=("rust_minimal" "rust_print")
> +
> +KSFT_PASS=0
> +KSFT_FAIL=1
> +KSFT_SKIP=4
Aren't those constants now defined in `ktap_helpers.sh` as well, i.e.,
could those be removed here?
- Best Valentin
> +
> +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}"
Powered by blists - more mailing lists