fix .sh typo on kernel module test that accept the module as first argument

This commit is contained in:
Ciro Santilli
2025-05-09 16:27:29 +01:00
parent dd8cef4d24
commit 6513e99438
7 changed files with 18 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ set -e
# Setup
f=/sys/kernel/debug/lkmc_fops
mod="${1:-fops.ko}"
[ $# -gt 1] && shift
[ $# -gt 1 ] && shift
insmod "$mod" "$@"
# read

View File

@@ -1,5 +1,5 @@
#!/bin/sh
set -e
set -eux
# Helpers
odraw() (
@@ -9,7 +9,7 @@ odraw() (
# Setup
f=/sys/kernel/debug/lkmc_memfile
mod="${1:-memfile.ko}"
[ $# -gt 1] && shift
[ $# -gt 1 ] && shift
insmod "$mod" "$@"
# Starts off empty

View File

@@ -4,7 +4,7 @@ set -eux
name=scull
mod="${1:-$name.ko}"
[ $# -gt 1] && shift
[ $# -gt 1 ] && shift
insmod "$mod" "$@"
major="$(awk "\$2==\"$name\" {print \$1}" /proc/devices)"

View File

@@ -2,7 +2,7 @@
set -e
f=/sys/kernel/debug/lkmc_seq_file
mod="${1:-seq_file.ko}"
[ $# -gt 1] && shift
[ $# -gt 1 ] && shift
insmod "$mod" "$@"
[ "$(cat "$f")" = "$(printf '0\n1\n2\n')" ]
[ "$(cat "$f")" = "$(printf '0\n1\n2\n')" ]

View File

@@ -2,7 +2,7 @@
set -e
f=/sys/kernel/debug/lkmc_seq_file_single_open
mod="${1:-seq_file_single_open.ko}"
[ $# -gt 1] && shift
[ $# -gt 1 ] && shift
insmod "$mod" "$@"
[ "$(cat "$f")" = "$(printf 'ab\ncd\n')" ]
[ "$(dd if="$f" bs=1 count=3 skip=1)" = "$(printf "b\nc\n")" ]