From: Lucas De Marchi Date: Sat, 21 Feb 2015 17:09:12 +0000 (-0200) Subject: testsuite: port arch-specific tests to module-playground X-Git-Tag: v20~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=77fdc66429a85763fd3e2022462d1be758d903ec;p=thirdparty%2Fkmod.git testsuite: port arch-specific tests to module-playground Rename modinfo_jonsmodules() to test_modinfo_signature(): now this test is responsible only for the signed modules. The other tests use specific flags to modinfo in order to print only one field, so we can filter out those fields that are expect to change if the module is recompiled. --- diff --git a/testsuite/populate-modules.sh b/testsuite/populate-modules.sh index b61cbfa0..938433d5 100755 --- a/testsuite/populate-modules.sh +++ b/testsuite/populate-modules.sh @@ -37,6 +37,9 @@ map=( ["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/block/cciss.ko"]="mod-fake-cciss.ko" ["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/hpsa.ko"]="mod-fake-hpsa.ko" ["test-depmod/modules-order-compressed/lib/modules/4.4.4/kernel/drivers/scsi/scsi_mod.ko"]="mod-fake-scsi-mod.ko" + ["test-modinfo/mod-simple-i386.ko"]="mod-simple-i386.ko" + ["test-modinfo/mod-simple-x86_64.ko"]="mod-simple-x86_64.ko" + ["test-modinfo/mod-simple-sparc64.ko"]="mod-simple-sparc64.ko" ) gzip_array=( diff --git a/testsuite/rootfs-pristine/test-modinfo/correct-author.txt b/testsuite/rootfs-pristine/test-modinfo/correct-author.txt new file mode 100644 index 00000000..b74c9bf5 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/correct-author.txt @@ -0,0 +1,3 @@ +Lucas De Marchi +Lucas De Marchi +Lucas De Marchi diff --git a/testsuite/rootfs-pristine/test-modinfo/correct-depends.txt b/testsuite/rootfs-pristine/test-modinfo/correct-depends.txt new file mode 100644 index 00000000..b28b04f6 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/correct-depends.txt @@ -0,0 +1,3 @@ + + + diff --git a/testsuite/rootfs-pristine/test-modinfo/correct-description.txt b/testsuite/rootfs-pristine/test-modinfo/correct-description.txt new file mode 100644 index 00000000..e69de29b diff --git a/testsuite/rootfs-pristine/test-modinfo/correct-filename.txt b/testsuite/rootfs-pristine/test-modinfo/correct-filename.txt new file mode 100644 index 00000000..bcd47c04 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/correct-filename.txt @@ -0,0 +1,3 @@ +/mod-simple-i386.ko +/mod-simple-x86_64.ko +/mod-simple-sparc64.ko diff --git a/testsuite/rootfs-pristine/test-modinfo/correct-license.txt b/testsuite/rootfs-pristine/test-modinfo/correct-license.txt new file mode 100644 index 00000000..f79931d6 --- /dev/null +++ b/testsuite/rootfs-pristine/test-modinfo/correct-license.txt @@ -0,0 +1,4 @@ +LGPL +LGPL +LGPL + diff --git a/testsuite/rootfs-pristine/test-modinfo/correct-parm.txt b/testsuite/rootfs-pristine/test-modinfo/correct-parm.txt new file mode 100644 index 00000000..e69de29b diff --git a/testsuite/rootfs-pristine/test-modinfo/correct.txt b/testsuite/rootfs-pristine/test-modinfo/correct.txt index 4a7a4ac1..92ff247b 100644 --- a/testsuite/rootfs-pristine/test-modinfo/correct.txt +++ b/testsuite/rootfs-pristine/test-modinfo/correct.txt @@ -1,31 +1,3 @@ -filename: /ext4-i686.ko -license: GPL -description: Fourth Extended Filesystem -author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others -srcversion: A80608676B83D55514B450E -depends: mbcache,jbd2 -vermagic: 2.6.32-220.el6.i686 SMP mod_unload modversions 686 -filename: /ext4-ppc64.ko -license: GPL -description: Fourth Extended Filesystem -author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others -srcversion: 670806A855D5836BE150B41 -depends: jbd2,mbcache -vermagic: 2.6.32-220.el6.ppc64 SMP mod_unload modversions -filename: /ext4-s390x.ko -license: GPL -description: Fourth Extended Filesystem -author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others -srcversion: 670806A855D5836BE150B41 -depends: mbcache,jbd2 -vermagic: 2.6.32-220.el6.s390x SMP mod_unload modversions -filename: /ext4-x86_64.ko -license: GPL -description: Fourth Extended Filesystem -author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others -srcversion: A80608676B83D55514B450E -depends: mbcache,jbd2 -vermagic: 2.6.32-220.el6.x86_64 SMP mod_unload modversions filename: /ext4-x86_64-sha1.ko license: GPL description: Fourth Extended Filesystem diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-i686.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-i686.ko deleted file mode 100644 index e5d2fb75..00000000 Binary files a/testsuite/rootfs-pristine/test-modinfo/ext4-i686.ko and /dev/null differ diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-ppc64.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-ppc64.ko deleted file mode 100644 index cb02ed4e..00000000 Binary files a/testsuite/rootfs-pristine/test-modinfo/ext4-ppc64.ko and /dev/null differ diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-s390x.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-s390x.ko deleted file mode 100644 index 74c3799b..00000000 Binary files a/testsuite/rootfs-pristine/test-modinfo/ext4-s390x.ko and /dev/null differ diff --git a/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64.ko b/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64.ko deleted file mode 100644 index ae96eefe..00000000 Binary files a/testsuite/rootfs-pristine/test-modinfo/ext4-x86_64.ko and /dev/null differ diff --git a/testsuite/test-modinfo.c b/testsuite/test-modinfo.c index 317629c3..9a57ea4d 100644 --- a/testsuite/test-modinfo.c +++ b/testsuite/test-modinfo.c @@ -25,21 +25,47 @@ #include "testsuite.h" -static noreturn int modinfo_jonsmodules(const struct test *t) +static const char *progname = ABS_TOP_BUILDDIR "/tools/modinfo"; + +#define DEFINE_MODINFO_TEST(_field) \ +static noreturn int test_modinfo_##_field(const struct test *t) \ +{ \ + const char *const args[] = { \ + progname, "-F", #_field ,\ + "/mod-simple-i386.ko", "/mod-simple-x86_64.ko", "/mod-simple-sparc64.ko", \ + NULL, \ + }; \ + test_spawn_prog(progname, args); \ + exit(EXIT_FAILURE); \ +} \ +DEFINE_TEST(test_modinfo_##_field, \ + .description = "check " #_field " output of modinfo for different architectures", \ + .config = { \ + [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modinfo/", \ + }, \ + .output = { \ + .out = TESTSUITE_ROOTFS "test-modinfo/correct-" #_field ".txt", \ + }) + +DEFINE_MODINFO_TEST(filename); +DEFINE_MODINFO_TEST(author); +DEFINE_MODINFO_TEST(license); +DEFINE_MODINFO_TEST(description); +DEFINE_MODINFO_TEST(parm); +DEFINE_MODINFO_TEST(depends); + +static noreturn int test_modinfo_signature(const struct test *t) { - const char *progname = ABS_TOP_BUILDDIR "/tools/modinfo"; const char *const args[] = { progname, - "/ext4-i686.ko", "/ext4-ppc64.ko", "/ext4-s390x.ko", - "/ext4-x86_64.ko", "/ext4-x86_64-sha1.ko", - "/ext4-x86_64-sha256.ko", + "/ext4-x86_64-sha1.ko", "/ext4-x86_64-sha256.ko", NULL, }; test_spawn_prog(progname, args); exit(EXIT_FAILURE); } -DEFINE_TEST(modinfo_jonsmodules, +DEFINE_TEST(test_modinfo_signature, .description = "check if output for modinfo is correct for i686, ppc64, s390x and x86_64", .config = { [TC_ROOTFS] = TESTSUITE_ROOTFS "test-modinfo/",