summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:20:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-28 09:20:55 +0000
commitc2c09589f14ac77fd4e29ca36483dfd80c439074 (patch)
treee102666aaa612a28c16dcd4097466764e97ba96a /test
parentInitial commit. (diff)
downloaddkms-c2c09589f14ac77fd4e29ca36483dfd80c439074.tar.xz
dkms-c2c09589f14ac77fd4e29ca36483dfd80c439074.zip
Adding upstream version 3.0.10.upstream/3.0.10upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test')
-rw-r--r--test/README1
-rw-r--r--test/dkms_dependencies_test-1.0/Makefile3
-rw-r--r--test/dkms_dependencies_test-1.0/dkms.conf12
-rw-r--r--test/dkms_emptyver_test/Makefile7
-rw-r--r--test/dkms_emptyver_test/dkms.conf12
-rw-r--r--test/dkms_emptyver_test/dkms_emptyver_test.c21
-rw-r--r--test/dkms_failing_test-1.0/Makefile3
-rw-r--r--test/dkms_failing_test-1.0/dkms.conf10
-rw-r--r--test/dkms_multiver_test/1.0/Makefile7
-rw-r--r--test/dkms_multiver_test/1.0/dkms.conf5
-rw-r--r--test/dkms_multiver_test/1.0/dkms_multiver_test.c23
-rw-r--r--test/dkms_multiver_test/2.0/Makefile7
-rw-r--r--test/dkms_multiver_test/2.0/dkms.conf5
-rw-r--r--test/dkms_multiver_test/2.0/dkms_multiver_test.c23
-rw-r--r--test/dkms_nover_test/Makefile7
-rw-r--r--test/dkms_nover_test/dkms.conf12
-rw-r--r--test/dkms_nover_test/dkms_nover_test.c20
-rw-r--r--test/dkms_test-1.0/Makefile7
-rw-r--r--test/dkms_test-1.0/dkms.conf12
-rw-r--r--test/dkms_test-1.0/dkms_test.c23
-rw-r--r--test/framework/bad_cert_file_path.conf3
-rw-r--r--test/framework/bad_key_file_path.conf1
-rw-r--r--test/framework/bad_sign_file_path.conf1
-rw-r--r--test/framework/hijacking.conf3
-rw-r--r--test/framework/temp_key_cert.conf2
-rw-r--r--test/framework/variables_in_path.conf3
26 files changed, 233 insertions, 0 deletions
diff --git a/test/README b/test/README
new file mode 100644
index 0000000..0d4d6b9
--- /dev/null
+++ b/test/README
@@ -0,0 +1 @@
+A sample module and framework files to test dkms.
diff --git a/test/dkms_dependencies_test-1.0/Makefile b/test/dkms_dependencies_test-1.0/Makefile
new file mode 100644
index 0000000..1fc2962
--- /dev/null
+++ b/test/dkms_dependencies_test-1.0/Makefile
@@ -0,0 +1,3 @@
+all:
+ @echo ERROR: This module should never build.
+ @exit 1
diff --git a/test/dkms_dependencies_test-1.0/dkms.conf b/test/dkms_dependencies_test-1.0/dkms.conf
new file mode 100644
index 0000000..0218890
--- /dev/null
+++ b/test/dkms_dependencies_test-1.0/dkms.conf
@@ -0,0 +1,12 @@
+
+PACKAGE_NAME="dkms_dependencies_test"
+PACKAGE_VERSION="1.0"
+BUILT_MODULE_NAME="dkms_dependencies_test"
+
+BUILD_DEPENDS="dkms_failing_test"
+
+MAKE="make all"
+
+AUTOINSTALL="yes"
+
+DEST_MODULE_LOCATION="/kernel/extra"
diff --git a/test/dkms_emptyver_test/Makefile b/test/dkms_emptyver_test/Makefile
new file mode 100644
index 0000000..c3bb9b3
--- /dev/null
+++ b/test/dkms_emptyver_test/Makefile
@@ -0,0 +1,7 @@
+obj-m += dkms_emptyver_test.o
+
+all:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+
+clean:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
diff --git a/test/dkms_emptyver_test/dkms.conf b/test/dkms_emptyver_test/dkms.conf
new file mode 100644
index 0000000..50dd08e
--- /dev/null
+++ b/test/dkms_emptyver_test/dkms.conf
@@ -0,0 +1,12 @@
+
+PACKAGE_NAME="dkms_emptyver_test"
+PACKAGE_VERSION="1.0"
+BUILT_MODULE_NAME="dkms_emptyver_test"
+
+# MAKE="make -C /lib/modules/${kernelver}/build SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules"
+# CLEAN="make -C /lib/modules/${kernelver}/build SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build M=$PWD clean"
+
+AUTOINSTALL="yes"
+
+DEST_MODULE_LOCATION="/kernel/extra"
+
diff --git a/test/dkms_emptyver_test/dkms_emptyver_test.c b/test/dkms_emptyver_test/dkms_emptyver_test.c
new file mode 100644
index 0000000..a65e693
--- /dev/null
+++ b/test/dkms_emptyver_test/dkms_emptyver_test.c
@@ -0,0 +1,21 @@
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("A Simple dkms test module with empty version");
+
+static int __init dkms_test_init(void)
+{
+ printk(KERN_INFO "DKMS Test Module - Loaded\n");
+ return 0;
+}
+
+static void __exit dkms_test_cleanup(void)
+{
+ printk(KERN_INFO "Cleaning up after dkms test module.\n");
+}
+
+module_init(dkms_test_init);
+module_exit(dkms_test_cleanup);
+MODULE_VERSION("");
diff --git a/test/dkms_failing_test-1.0/Makefile b/test/dkms_failing_test-1.0/Makefile
new file mode 100644
index 0000000..a311d81
--- /dev/null
+++ b/test/dkms_failing_test-1.0/Makefile
@@ -0,0 +1,3 @@
+all:
+ @echo ERROR: This module fails to build.
+ @exit 1"
diff --git a/test/dkms_failing_test-1.0/dkms.conf b/test/dkms_failing_test-1.0/dkms.conf
new file mode 100644
index 0000000..753728a
--- /dev/null
+++ b/test/dkms_failing_test-1.0/dkms.conf
@@ -0,0 +1,10 @@
+
+PACKAGE_NAME="dkms_failing_test"
+PACKAGE_VERSION="1.0"
+BUILT_MODULE_NAME="dkms_failing_test"
+
+MAKE="make all"
+
+AUTOINSTALL="yes"
+
+DEST_MODULE_LOCATION="/kernel/extra"
diff --git a/test/dkms_multiver_test/1.0/Makefile b/test/dkms_multiver_test/1.0/Makefile
new file mode 100644
index 0000000..b40b45d
--- /dev/null
+++ b/test/dkms_multiver_test/1.0/Makefile
@@ -0,0 +1,7 @@
+obj-m += dkms_multiver_test.o
+
+all:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+
+clean:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
diff --git a/test/dkms_multiver_test/1.0/dkms.conf b/test/dkms_multiver_test/1.0/dkms.conf
new file mode 100644
index 0000000..949d30f
--- /dev/null
+++ b/test/dkms_multiver_test/1.0/dkms.conf
@@ -0,0 +1,5 @@
+PACKAGE_NAME="dkms_multiver_test"
+PACKAGE_VERSION="1.0"
+BUILT_MODULE_NAME="dkms_multiver_test"
+
+DEST_MODULE_LOCATION="/kernel/extra"
diff --git a/test/dkms_multiver_test/1.0/dkms_multiver_test.c b/test/dkms_multiver_test/1.0/dkms_multiver_test.c
new file mode 100644
index 0000000..4a45be5
--- /dev/null
+++ b/test/dkms_multiver_test/1.0/dkms_multiver_test.c
@@ -0,0 +1,23 @@
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#define DKMS_TEST_VER "1.0"
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("A Simple dkms multiver test module");
+
+static int __init dkms_test_init(void)
+{
+ printk(KERN_INFO "DKMS MultiVer Test Module -%s Loaded\n",DKMS_TEST_VER);
+ return 0;
+}
+
+static void __exit dkms_test_cleanup(void)
+{
+ printk(KERN_INFO "Cleaning up after dkms multiver test module.\n");
+}
+
+module_init(dkms_test_init);
+module_exit(dkms_test_cleanup);
+MODULE_VERSION(DKMS_TEST_VER);
diff --git a/test/dkms_multiver_test/2.0/Makefile b/test/dkms_multiver_test/2.0/Makefile
new file mode 100644
index 0000000..b40b45d
--- /dev/null
+++ b/test/dkms_multiver_test/2.0/Makefile
@@ -0,0 +1,7 @@
+obj-m += dkms_multiver_test.o
+
+all:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+
+clean:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
diff --git a/test/dkms_multiver_test/2.0/dkms.conf b/test/dkms_multiver_test/2.0/dkms.conf
new file mode 100644
index 0000000..204f949
--- /dev/null
+++ b/test/dkms_multiver_test/2.0/dkms.conf
@@ -0,0 +1,5 @@
+PACKAGE_NAME="dkms_multiver_test"
+PACKAGE_VERSION="2.0"
+BUILT_MODULE_NAME="dkms_multiver_test"
+
+DEST_MODULE_LOCATION="/kernel/extra"
diff --git a/test/dkms_multiver_test/2.0/dkms_multiver_test.c b/test/dkms_multiver_test/2.0/dkms_multiver_test.c
new file mode 100644
index 0000000..775aeba
--- /dev/null
+++ b/test/dkms_multiver_test/2.0/dkms_multiver_test.c
@@ -0,0 +1,23 @@
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#define DKMS_TEST_VER "2.0"
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("A Simple dkms multiver test module");
+
+static int __init dkms_test_init(void)
+{
+ printk(KERN_INFO "DKMS MultiVer Test Module -%s Loaded\n",DKMS_TEST_VER);
+ return 0;
+}
+
+static void __exit dkms_test_cleanup(void)
+{
+ printk(KERN_INFO "Cleaning up after dkms multiver test module.\n");
+}
+
+module_init(dkms_test_init);
+module_exit(dkms_test_cleanup);
+MODULE_VERSION(DKMS_TEST_VER);
diff --git a/test/dkms_nover_test/Makefile b/test/dkms_nover_test/Makefile
new file mode 100644
index 0000000..284ba54
--- /dev/null
+++ b/test/dkms_nover_test/Makefile
@@ -0,0 +1,7 @@
+obj-m += dkms_nover_test.o
+
+all:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+
+clean:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
diff --git a/test/dkms_nover_test/dkms.conf b/test/dkms_nover_test/dkms.conf
new file mode 100644
index 0000000..aa56d10
--- /dev/null
+++ b/test/dkms_nover_test/dkms.conf
@@ -0,0 +1,12 @@
+
+PACKAGE_NAME="dkms_nover_test"
+PACKAGE_VERSION="1.0"
+BUILT_MODULE_NAME="dkms_nover_test"
+
+# MAKE="make -C /lib/modules/${kernelver}/build SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules"
+# CLEAN="make -C /lib/modules/${kernelver}/build SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build M=$PWD clean"
+
+AUTOINSTALL="yes"
+
+DEST_MODULE_LOCATION="/kernel/extra"
+
diff --git a/test/dkms_nover_test/dkms_nover_test.c b/test/dkms_nover_test/dkms_nover_test.c
new file mode 100644
index 0000000..77acc62
--- /dev/null
+++ b/test/dkms_nover_test/dkms_nover_test.c
@@ -0,0 +1,20 @@
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("A Simple dkms test module with no version");
+
+static int __init dkms_test_init(void)
+{
+ printk(KERN_INFO "DKMS Test Module - Loaded\n");
+ return 0;
+}
+
+static void __exit dkms_test_cleanup(void)
+{
+ printk(KERN_INFO "Cleaning up after dkms test module.\n");
+}
+
+module_init(dkms_test_init);
+module_exit(dkms_test_cleanup);
diff --git a/test/dkms_test-1.0/Makefile b/test/dkms_test-1.0/Makefile
new file mode 100644
index 0000000..c6c2d32
--- /dev/null
+++ b/test/dkms_test-1.0/Makefile
@@ -0,0 +1,7 @@
+obj-m += dkms_test.o
+
+all:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
+
+clean:
+ make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
diff --git a/test/dkms_test-1.0/dkms.conf b/test/dkms_test-1.0/dkms.conf
new file mode 100644
index 0000000..21d8a18
--- /dev/null
+++ b/test/dkms_test-1.0/dkms.conf
@@ -0,0 +1,12 @@
+
+PACKAGE_NAME="dkms_test"
+PACKAGE_VERSION="1.0"
+BUILT_MODULE_NAME="dkms_test"
+
+# MAKE="make -C /lib/modules/${kernelver}/build SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules"
+# CLEAN="make -C /lib/modules/${kernelver}/build SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build M=$PWD clean"
+
+AUTOINSTALL="yes"
+
+DEST_MODULE_LOCATION="/kernel/extra"
+
diff --git a/test/dkms_test-1.0/dkms_test.c b/test/dkms_test-1.0/dkms_test.c
new file mode 100644
index 0000000..93d0098
--- /dev/null
+++ b/test/dkms_test-1.0/dkms_test.c
@@ -0,0 +1,23 @@
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#define DKMS_TEST_VER "1.0"
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("A Simple dkms test module");
+
+static int __init dkms_test_init(void)
+{
+ printk(KERN_INFO "DKMS Test Module -%s Loaded\n",DKMS_TEST_VER);
+ return 0;
+}
+
+static void __exit dkms_test_cleanup(void)
+{
+ printk(KERN_INFO "Cleaning up after dkms test module.\n");
+}
+
+module_init(dkms_test_init);
+module_exit(dkms_test_cleanup);
+MODULE_VERSION(DKMS_TEST_VER);
diff --git a/test/framework/bad_cert_file_path.conf b/test/framework/bad_cert_file_path.conf
new file mode 100644
index 0000000..34e1094
--- /dev/null
+++ b/test/framework/bad_cert_file_path.conf
@@ -0,0 +1,3 @@
+# The key file will be generated by openssl. Use a temporary path to avoid corrupting the default private key file on the system
+mok_signing_key="/tmp/dkms_test_private_key"
+mok_certificate="/no/such/path.crt"
diff --git a/test/framework/bad_key_file_path.conf b/test/framework/bad_key_file_path.conf
new file mode 100644
index 0000000..8f46b8d
--- /dev/null
+++ b/test/framework/bad_key_file_path.conf
@@ -0,0 +1 @@
+mok_signing_key="/no/such/path.key"
diff --git a/test/framework/bad_sign_file_path.conf b/test/framework/bad_sign_file_path.conf
new file mode 100644
index 0000000..4ef51d2
--- /dev/null
+++ b/test/framework/bad_sign_file_path.conf
@@ -0,0 +1 @@
+sign_file="/no/such/file"
diff --git a/test/framework/hijacking.conf b/test/framework/hijacking.conf
new file mode 100644
index 0000000..476baa6
--- /dev/null
+++ b/test/framework/hijacking.conf
@@ -0,0 +1,3 @@
+do_status() {
+ echo "do_status() is hijacked!"
+}
diff --git a/test/framework/temp_key_cert.conf b/test/framework/temp_key_cert.conf
new file mode 100644
index 0000000..9bde615
--- /dev/null
+++ b/test/framework/temp_key_cert.conf
@@ -0,0 +1,2 @@
+mok_signing_key="/tmp/dkms_test_private_key"
+mok_certificate="/tmp/dkms_test_certificate"
diff --git a/test/framework/variables_in_path.conf b/test/framework/variables_in_path.conf
new file mode 100644
index 0000000..87213e6
--- /dev/null
+++ b/test/framework/variables_in_path.conf
@@ -0,0 +1,3 @@
+sign_file="/lib/modules/${kernelver}/build/scripts/sign-file"
+mok_signing_key="/tmp/dkms_test_dir_${kernelver}/key"
+mok_certificate="/tmp/dkms_test_dir_${kernelver}/cert"