2021-09-08 20:38:50 +08:00
|
|
|
#!/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
|
2021-09-08 20:38:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2021-09-08 20:38:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function run_examples()
|
|
|
|
{
|
|
|
|
for module in $(list_mod); do
|
2021-09-13 12:03:04 +08:00
|
|
|
echo "Running $module"
|
2021-09-08 20:38:50 +08:00
|
|
|
run_mod "$module"
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
build_example
|
2021-09-13 12:03:04 +08:00
|
|
|
run_examples
|