~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/riscv/kernel/tests/module_test/test_module_linking_main.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 /*
  3  * Copyright (C) 2023 Rivos Inc.
  4  */
  5 
  6 #include <linux/module.h>
  7 #include <linux/kernel.h>
  8 #include <linux/init.h>
  9 #include <kunit/test.h>
 10 
 11 MODULE_LICENSE("GPL");
 12 MODULE_DESCRIPTION("Test module linking");
 13 
 14 extern int test_set32(void);
 15 extern int test_set16(void);
 16 extern int test_set8(void);
 17 extern int test_set6(void);
 18 extern long test_sub64(void);
 19 extern int test_sub32(void);
 20 extern int test_sub16(void);
 21 extern int test_sub8(void);
 22 extern int test_sub6(void);
 23 
 24 #ifdef CONFIG_AS_HAS_ULEB128
 25 extern int test_uleb_basic(void);
 26 extern int test_uleb_large(void);
 27 #endif
 28 
 29 #define CHECK_EQ(lhs, rhs) KUNIT_ASSERT_EQ(test, lhs, rhs)
 30 
 31 void run_test_set(struct kunit *test);
 32 void run_test_sub(struct kunit *test);
 33 void run_test_uleb(struct kunit *test);
 34 
 35 void run_test_set(struct kunit *test)
 36 {
 37         int val32 = test_set32();
 38         int val16 = test_set16();
 39         int val8 = test_set8();
 40         int val6 = test_set6();
 41 
 42         CHECK_EQ(val32, 0);
 43         CHECK_EQ(val16, 0);
 44         CHECK_EQ(val8, 0);
 45         CHECK_EQ(val6, 0);
 46 }
 47 
 48 void run_test_sub(struct kunit *test)
 49 {
 50         int val64 = test_sub64();
 51         int val32 = test_sub32();
 52         int val16 = test_sub16();
 53         int val8 = test_sub8();
 54         int val6 = test_sub6();
 55 
 56         CHECK_EQ(val64, 0);
 57         CHECK_EQ(val32, 0);
 58         CHECK_EQ(val16, 0);
 59         CHECK_EQ(val8, 0);
 60         CHECK_EQ(val6, 0);
 61 }
 62 
 63 #ifdef CONFIG_AS_HAS_ULEB128
 64 void run_test_uleb(struct kunit *test)
 65 {
 66         int val_uleb = test_uleb_basic();
 67         int val_uleb2 = test_uleb_large();
 68 
 69         CHECK_EQ(val_uleb, 0);
 70         CHECK_EQ(val_uleb2, 0);
 71 }
 72 #endif
 73 
 74 static struct kunit_case __refdata riscv_module_linking_test_cases[] = {
 75         KUNIT_CASE(run_test_set),
 76         KUNIT_CASE(run_test_sub),
 77 #ifdef CONFIG_AS_HAS_ULEB128
 78         KUNIT_CASE(run_test_uleb),
 79 #endif
 80         {}
 81 };
 82 
 83 static struct kunit_suite riscv_module_linking_test_suite = {
 84         .name = "riscv_checksum",
 85         .test_cases = riscv_module_linking_test_cases,
 86 };
 87 
 88 kunit_test_suites(&riscv_module_linking_test_suite);
 89 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php