mirror of
https://github.com/AuxXxilium/kmod.git
synced 2024-11-23 23:10:53 +07:00
testsuite: port detect-loop test to module-playground
This commit is contained in:
parent
01af61dba4
commit
d9ab7abe1e
@ -9,6 +9,15 @@ obj-m += mod-foo-b.o
|
||||
obj-m += mod-foo-c.o
|
||||
obj-m += mod-foo.o
|
||||
|
||||
# mod-loop: create loops in dependencies:
|
||||
# 1) mod-loop-a -> mod-loop-b -> mod-loop-c -> mod-loop-a
|
||||
# 2) mod-loop-d -> mod-loop-e -> mod-loop-d
|
||||
obj-m += mod-loop-a.o
|
||||
obj-m += mod-loop-b.o
|
||||
obj-m += mod-loop-c.o
|
||||
obj-m += mod-loop-d.o
|
||||
obj-m += mod-loop-e.o
|
||||
|
||||
else
|
||||
# normal makefile
|
||||
KDIR ?= /lib/modules/`uname -r`/build
|
||||
|
25
testsuite/module-playground/mod-loop-a.c
Normal file
25
testsuite/module-playground/mod-loop-a.c
Normal file
@ -0,0 +1,25 @@
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/printk.h>
|
||||
|
||||
#include "mod-loop.h"
|
||||
|
||||
static int __init test_module_init(void)
|
||||
{
|
||||
printA();
|
||||
printB();
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(test_module_init);
|
||||
|
||||
void printA(void)
|
||||
{
|
||||
pr_warn("Hello, world A\n");
|
||||
}
|
||||
EXPORT_SYMBOL(printA);
|
||||
|
||||
MODULE_AUTHOR("Lucas De Marchi <lucas.demarchi@intel.com>");
|
||||
MODULE_LICENSE("LGPL");
|
25
testsuite/module-playground/mod-loop-b.c
Normal file
25
testsuite/module-playground/mod-loop-b.c
Normal file
@ -0,0 +1,25 @@
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/printk.h>
|
||||
|
||||
#include "mod-loop.h"
|
||||
|
||||
static int __init test_module_init(void)
|
||||
{
|
||||
printB();
|
||||
printC();
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(test_module_init);
|
||||
|
||||
void printB(void)
|
||||
{
|
||||
pr_warn("Hello, world B\n");
|
||||
}
|
||||
EXPORT_SYMBOL(printB);
|
||||
|
||||
MODULE_AUTHOR("Lucas De Marchi <lucas.demarchi@intel.com>");
|
||||
MODULE_LICENSE("LGPL");
|
25
testsuite/module-playground/mod-loop-c.c
Normal file
25
testsuite/module-playground/mod-loop-c.c
Normal file
@ -0,0 +1,25 @@
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/printk.h>
|
||||
|
||||
#include "mod-loop.h"
|
||||
|
||||
static int __init test_module_init(void)
|
||||
{
|
||||
printC();
|
||||
printA();
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(test_module_init);
|
||||
|
||||
void printC(void)
|
||||
{
|
||||
pr_warn("Hello, world C\n");
|
||||
}
|
||||
EXPORT_SYMBOL(printC);
|
||||
|
||||
MODULE_AUTHOR("Lucas De Marchi <lucas.demarchi@intel.com>");
|
||||
MODULE_LICENSE("LGPL");
|
25
testsuite/module-playground/mod-loop-d.c
Normal file
25
testsuite/module-playground/mod-loop-d.c
Normal file
@ -0,0 +1,25 @@
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/printk.h>
|
||||
|
||||
#include "mod-loop.h"
|
||||
|
||||
static int __init test_module_init(void)
|
||||
{
|
||||
printD();
|
||||
printE();
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(test_module_init);
|
||||
|
||||
void printD(void)
|
||||
{
|
||||
pr_warn("Hello, world D\n");
|
||||
}
|
||||
EXPORT_SYMBOL(printD);
|
||||
|
||||
MODULE_AUTHOR("Lucas De Marchi <lucas.demarchi@intel.com>");
|
||||
MODULE_LICENSE("LGPL");
|
25
testsuite/module-playground/mod-loop-e.c
Normal file
25
testsuite/module-playground/mod-loop-e.c
Normal file
@ -0,0 +1,25 @@
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/printk.h>
|
||||
|
||||
#include "mod-loop.h"
|
||||
|
||||
static int __init test_module_init(void)
|
||||
{
|
||||
printE();
|
||||
printD();
|
||||
|
||||
return 0;
|
||||
}
|
||||
module_init(test_module_init);
|
||||
|
||||
void printE(void)
|
||||
{
|
||||
pr_warn("Hello, world E\n");
|
||||
}
|
||||
EXPORT_SYMBOL(printE);
|
||||
|
||||
MODULE_AUTHOR("Lucas De Marchi <lucas.demarchi@intel.com>");
|
||||
MODULE_LICENSE("LGPL");
|
7
testsuite/module-playground/mod-loop.h
Normal file
7
testsuite/module-playground/mod-loop.h
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
void printA(void);
|
||||
void printB(void);
|
||||
void printC(void);
|
||||
void printD(void);
|
||||
void printE(void);
|
@ -11,6 +11,11 @@ map=(
|
||||
["test-depmod/search-order-simple/lib/modules/4.4.4/updates/"]="mod-simple.ko"
|
||||
["test-depmod/search-order-same-prefix/lib/modules/4.4.4/foo/"]="mod-simple.ko"
|
||||
["test-depmod/search-order-same-prefix/lib/modules/4.4.4/foobar/"]="mod-simple.ko"
|
||||
["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-a.ko"]="mod-loop-a.ko"
|
||||
["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-b.ko"]="mod-loop-b.ko"
|
||||
["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-c.ko"]="mod-loop-c.ko"
|
||||
["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-d.ko"]="mod-loop-d.ko"
|
||||
["test-depmod/detect-loop/lib/modules/4.4.4/kernel/mod-loop-e.ko"]="mod-loop-e.ko"
|
||||
["test-dependencies/lib/modules/4.0.20-kmod/kernel/fs/foo/"]="mod-foo-b.ko"
|
||||
["test-dependencies/lib/modules/4.0.20-kmod/kernel/"]="mod-foo-c.ko"
|
||||
["test-dependencies/lib/modules/4.0.20-kmod/kernel/lib/"]="mod-foo-a.ko"
|
||||
@ -23,6 +28,10 @@ for k in ${!map[@]}; do
|
||||
dst=${ROOTFS}/$k
|
||||
src=${MODULE_PLAYGROUND}/${map[$k]}
|
||||
|
||||
install -d $dst
|
||||
install -t $dst $src
|
||||
if test "${dst: -1}" = "/"; then
|
||||
install -d $dst
|
||||
install -t $dst $src
|
||||
else
|
||||
install -D $src $dst
|
||||
fi
|
||||
done
|
||||
|
@ -1,3 +1,3 @@
|
||||
depmod: ERROR: Found 5 modules in dependency cycles!
|
||||
depmod: ERROR: Cycle detected: moduleE -> moduleD -> moduleE
|
||||
depmod: ERROR: Cycle detected: moduleB -> moduleC -> moduleA -> moduleB
|
||||
depmod: ERROR: Cycle detected: mod_loop_d -> mod_loop_e -> mod_loop_d
|
||||
depmod: ERROR: Cycle detected: mod_loop_b -> mod_loop_c -> mod_loop_a -> mod_loop_b
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,5 +0,0 @@
|
||||
kernel//home/lucas/p/kmod/testsuite/module-playground/moduleA.ko
|
||||
kernel//home/lucas/p/kmod/testsuite/module-playground/moduleB.ko
|
||||
kernel//home/lucas/p/kmod/testsuite/module-playground/moduleC.ko
|
||||
kernel//home/lucas/p/kmod/testsuite/module-playground/moduleD.ko
|
||||
kernel//home/lucas/p/kmod/testsuite/module-playground/moduleE.ko
|
Loading…
Reference in New Issue
Block a user