mirror of
https://github.com/sysprog21/lkmpg.git
synced 2024-11-26 02:09:48 +08:00
Improve CI pipeline to automate module testing (#95)
The script executes insmod/rmmod twice with available kernel modules. Close #72
This commit is contained in:
parent
148fb013ee
commit
3fcbb8e182
30
.ci/build-n-run.sh
Executable file
30
.ci/build-n-run.sh
Executable file
|
@ -0,0 +1,30 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
function build_example()
|
||||||
|
{
|
||||||
|
make -C examples || exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
function list_mod()
|
||||||
|
{
|
||||||
|
#following list will contain all file names which are not specified in file non-working.
|
||||||
|
echo `ls examples/*.ko | awk -F "[/|.]" '{print $2}' | grep -vFxf .ci/non-working`
|
||||||
|
}
|
||||||
|
|
||||||
|
#test module 2 times
|
||||||
|
function run_mod()
|
||||||
|
{
|
||||||
|
( 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
|
||||||
|
echo "$module"
|
||||||
|
run_mod "$module"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
build_example
|
||||||
|
run_examples
|
3
.ci/non-working
Normal file
3
.ci/non-working
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
bottomhalf
|
||||||
|
intrpt
|
||||||
|
kbleds
|
5
.github/workflows/generate_doc.yaml
vendored
5
.github/workflows/generate_doc.yaml
vendored
|
@ -36,13 +36,14 @@ jobs:
|
||||||
tag_name: "latest"
|
tag_name: "latest"
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
||||||
coding_style:
|
validate:
|
||||||
runs-on: ubuntu-20.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: checkout code
|
- name: checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: style check
|
- name: validate coding style and functionality
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install -q -y clang-format-11
|
sudo apt-get install -q -y clang-format-11
|
||||||
sh .ci/check-format.sh
|
sh .ci/check-format.sh
|
||||||
|
bash .ci/build-n-run.sh
|
||||||
shell: bash
|
shell: bash
|
|
@ -3,8 +3,8 @@ obj-m += hello-2.o
|
||||||
obj-m += hello-3.o
|
obj-m += hello-3.o
|
||||||
obj-m += hello-4.o
|
obj-m += hello-4.o
|
||||||
obj-m += hello-5.o
|
obj-m += hello-5.o
|
||||||
obj-m += start.o
|
obj-m += startstop.o
|
||||||
obj-m += stop.o
|
startstop-objs := start.o stop.o
|
||||||
obj-m += chardev.o
|
obj-m += chardev.o
|
||||||
obj-m += procfs1.o
|
obj-m += procfs1.o
|
||||||
obj-m += procfs2.o
|
obj-m += procfs2.o
|
||||||
|
@ -30,6 +30,8 @@ obj-m += example_mutex.o
|
||||||
obj-m += bottomhalf.o
|
obj-m += bottomhalf.o
|
||||||
obj-m += ioctl.o
|
obj-m += ioctl.o
|
||||||
|
|
||||||
|
PWD := $(CURDIR)
|
||||||
|
|
||||||
all:
|
all:
|
||||||
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
$(MAKE) -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user