File: test_probe_samples.sh

package info (click to toggle)
linux 6.12.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,673,568 kB
  • sloc: ansic: 25,888,630; asm: 268,782; sh: 136,481; python: 64,809; makefile: 55,668; perl: 38,052; xml: 19,270; cpp: 5,893; yacc: 4,923; lex: 2,939; awk: 1,592; sed: 28; ruby: 25
file content (41 lines) | stat: -rwxr-xr-x 948 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/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")")"

KTAP_HELPERS="${DIR}/../kselftest/ktap_helpers.sh"
if [ -e "$KTAP_HELPERS" ]; then
    source "$KTAP_HELPERS"
else
    echo "$KTAP_HELPERS file not found [SKIP]"
    exit 4
fi

rust_sample_modules=("rust_minimal" "rust_print")

ktap_print_header

for sample in "${rust_sample_modules[@]}"; do
    if ! /sbin/modprobe -n -q "$sample"; then
        ktap_skip_all "module $sample is not found in /lib/modules/$(uname -r)"
        exit "$KSFT_SKIP"
    fi
done

ktap_set_plan "${#rust_sample_modules[@]}"

for sample in "${rust_sample_modules[@]}"; do
    if /sbin/modprobe -q "$sample"; then
        /sbin/modprobe -q -r "$sample"
        ktap_test_pass "$sample"
    else
        ktap_test_fail "$sample"
    fi
done

ktap_finished