nhmk/.ci/build-n-run.sh

31 lines
613 B
Bash
Raw Normal View History

#!/usr/bin/env bash
function build_example()
{
make -C examples || exit 1
}
function list_mod()
{
2021-09-13 12:03:04 +08:00
# Filter out the modules specified in non-working
ls examples/*.ko | awk -F "[/|.]" '{print $2}' | grep -vFxf .ci/non-working
}
function run_mod()
{
2021-09-13 12:03:04 +08:00
# insert/remove twice to ensure resource allocations
( sudo insmod "examples/$1.ko" && sudo rmmod "$1" ) || exit 1
( sudo insmod "examples/$1.ko" && sudo rmmod "$1" ) || exit 1
}
function run_examples()
{
for module in $(list_mod); do
2021-09-13 12:03:04 +08:00
echo "Running $module"
run_mod "$module"
done
}
build_example
2021-09-13 12:03:04 +08:00
run_examples