All of lore.kernel.org
 help / color / mirror / Atom feed
From: Valentin Obst <kernel@valentinobst.de>
To: laura.nao@collabora.com
Cc: a.hindborg@samsung.com, alex.gaynor@gmail.com,
	aliceryhl@google.com, benno.lossin@proton.me,
	bjorn3_gh@protonmail.com, boqun.feng@gmail.com, gary@garyguo.net,
	kernel@collabora.com, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, ojeda@kernel.org,
	rust-for-linux@vger.kernel.org, sergio.collado@gmail.com,
	shuah@kernel.org, usama.anjum@collabora.com, wedsonaf@gmail.com,
	Valentin Obst <kernel@valentinobst.de>
Subject: Re: [PATCH v2] kselftest: Add basic test for probing the rust sample modules
Date: Thu, 22 Feb 2024 16:53:38 +0100	[thread overview]
Message-ID: <20240222155338.26836-1-kernel@valentinobst.de> (raw)
In-Reply-To: <20240222151009.461264-1-laura.nao@collabora.com>

> 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}"

  reply	other threads:[~2024-02-22 15:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22 15:10 [PATCH v2] kselftest: Add basic test for probing the rust sample modules Laura Nao
2024-02-22 15:53 ` Valentin Obst [this message]
2024-02-22 16:37   ` Laura Nao

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=20240222155338.26836-1-kernel@valentinobst.de \
    --to=kernel@valentinobst.de \
    --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=sergio.collado@gmail.com \
    --cc=shuah@kernel.org \
    --cc=usama.anjum@collabora.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.