Files
Ciro Santilli 0cd1a2b602 kernel module: fix fops... and move its documentation into README
Sometimes I wonder if anyone has ever run this tutorial, otherwise how
can such basic bugs persist for so long?

test_all.sh: crete
2018-06-29 08:47:32 +01:00

31 lines
395 B
Bash
Executable File

#!/bin/sh
set -e
# Setup
f=/sys/kernel/debug/lkmc_fops
insmod /fops.ko
# read
[ "$(cat "$f")" = abcd ]
# write
printf 01 > "$f"
[ "$(cat "$f")" = 01cd ]
# ENOSPC
printf abcd > "$f"
set +e
printf 12345 > "$f"
exit_status="$?"
set -e
[ "$exit_status" -eq 8 ]
[ "$(cat "$f")" = abcd ]
# seek
printf 1234 > "$f"
printf z | dd bs=1 of="$f" seek=2
[ "$(cat "$f")" = 12z4 ]
# Teardown
rmmod fops