Changeset 319e60e in mainline
- Timestamp:
- 2006-12-11T18:33:53Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 50661ab
- Parents:
- 134877d
- Location:
- kernel
- Files:
-
- 1 added
- 5 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile
r134877d r319e60e 216 216 ifneq ($(CONFIG_TEST),) 217 217 DEFS += -DCONFIG_TEST 218 GENERIC_SOURCES += test/$(CONFIG_TEST)/test.c 218 CFLAGS += -Itest/ 219 GENERIC_SOURCES += \ 220 test/test.c \ 221 test/atomic/atomic1.c 219 222 endif 220 223 -
kernel/generic/src/console/cmd.c
r134877d r319e60e 66 66 #include <ipc/irq.h> 67 67 68 #ifdef CONFIG_TEST 69 #include <test.h> 70 #endif 71 68 72 /* Data and methods for 'help' command. */ 69 73 static int cmd_help(cmd_arg_t *argv); … … 77 81 static cmd_info_t exit_info = { 78 82 .name = "exit", 79 .description = "Exit kconsole",83 .description = "Exit kconsole", 80 84 .argc = 0 81 85 }; … … 84 88 static cmd_info_t continue_info = { 85 89 .name = "continue", 86 .description = "Return console back to userspace.",90 .description = "Return console back to userspace.", 87 91 .func = cmd_continue, 88 92 .argc = 0 89 93 }; 94 95 #ifdef CONFIG_TEST 96 static int cmd_tests(cmd_arg_t *argv); 97 static cmd_info_t tests_info = { 98 .name = "tests", 99 .description = "Print available kernel tests.", 100 .func = cmd_tests, 101 .argc = 0 102 }; 103 104 static char test_buf[MAX_CMDLINE + 1]; 105 static int cmd_test(cmd_arg_t *argv); 106 static cmd_arg_t test_argv[] = { 107 { 108 .type = ARG_TYPE_STRING, 109 .buffer = test_buf, 110 .len = sizeof(test_buf) 111 } 112 }; 113 static cmd_info_t test_info = { 114 .name = "test", 115 .description = "Run kernel test.", 116 .func = cmd_test, 117 .argc = 1, 118 .argv = test_argv 119 }; 120 #endif 90 121 91 122 /* Data and methods for 'description' command. */ … … 378 409 &zones_info, 379 410 &zone_info, 411 #ifdef CONFIG_TEST 412 &tests_info, 413 &test_info, 414 #endif 380 415 NULL 381 416 }; … … 806 841 } 807 842 843 /** Command for printing kernel tests list. 844 * 845 * @param argv Ignored. 846 * 847 * return Always 1. 848 */ 849 int cmd_tests(cmd_arg_t *argv) 850 { 851 test_t *test; 852 853 for (test = tests; test->name != NULL; test++) 854 printf("%s\t%s\n", test->name, test->desc); 855 856 return 1; 857 } 858 859 /** Command for returning kernel tests 860 * 861 * @param argv Argument vector. 862 * 863 * return Always 1. 864 */ 865 int cmd_test(cmd_arg_t *argv) 866 { 867 bool fnd = false; 868 test_t *test; 869 870 for (test = tests; test->name != NULL; test++) { 871 if (strcmp(test->name, argv->buffer) == 0) { 872 fnd = true; 873 test->entry(); 874 break; 875 } 876 } 877 878 if (!fnd) 879 printf("Unknown test.\n"); 880 881 return 1; 882 } 883 808 884 /** @} 809 885 */ -
kernel/generic/src/main/kinit.c
r134877d r319e60e 70 70 #include <synch/waitq.h> 71 71 #include <synch/spinlock.h> 72 73 #ifdef CONFIG_TEST74 #include <test.h>75 #endif /* CONFIG_TEST */76 72 77 73 /** Kernel initialization thread. … … 155 151 interrupts_enable(); 156 152 157 #ifdef CONFIG_TEST158 test();159 printf("\nTest finished, please reboot.\n");160 #else /* CONFIG_TEST */161 162 153 count_t i; 163 154 for (i = 0; i < init.cnt; i++) { … … 195 186 } 196 187 } 197 #endif /* CONFIG_TEST */198 199 188 } 200 189 -
kernel/kernel.config
r134877d r319e60e 119 119 ## Run-time configuration directives 120 120 121 # Kernel test type 122 @ "" No test 123 @ "atomic/atomic1" Test of atomic operations. 124 @ "btree/btree1" B-tree test. 125 @ "synch/rwlock1" Read write test 1 126 @ "synch/rwlock2" Read write test 2 127 @ "synch/rwlock3" Read write test 3 128 @ "synch/rwlock4" Read write test 4 129 @ "synch/rwlock5" Read write test 5 130 @ "synch/semaphore1" Semaphore test 1 131 @ "synch/semaphore2" Sempahore test 2 132 @ [ARCH=ia32|ARCH=amd64|ARCH=ia64|ARCH=ia32xen] "fpu/fpu1" Intel FPU test 1 133 @ [ARCH=ia32|ARCH=amd64|ARCH=ia32xen] "fpu/sse1" Intel SSE test 1 134 @ [ARCH=mips32&MACHINE!=msim&MACHINE!=simics] "fpu/mips1" MIPS FPU test 1 135 @ "print/print1" Printf test 1 136 @ "thread/thread1" Thread test 1 137 @ "mm/mapping1" Mapping test 1 138 @ "mm/falloc1" Frame Allocation test 1 139 @ "mm/falloc2" Frame Allocation test 2 140 @ "mm/slab1" SLAB test1 - No CPU cache 141 @ "mm/slab2" SLAB test2 - SMP CPU cache 142 @ "fault/fault1" Write to NULL (maybe page fault) 143 @ "sysinfo" Sysinfo fill and dump test 144 @ [ARCH=ia64] "mm/purge1" Itanium TLB purge test 145 @ [ARCH=mips32] "debug/mips1" MIPS breakpoint-debug test 146 ! CONFIG_TEST (choice) 121 # Compile kernel tests 122 ! CONFIG_TEST (y/n) 147 123 148 # Benchmark test 149 ! [CONFIG_TEST!=] CONFIG_BENCH ( n/y)124 # Benchmark tests 125 ! [CONFIG_TEST!=] CONFIG_BENCH (y/n) -
kernel/test/atomic/atomic1.c
r134877d r319e60e 32 32 #include <debug.h> 33 33 34 void test(void) 34 #ifdef CONFIG_BENCH 35 #include <arch/cycle.h> 36 #endif 37 38 void test_atomic1(void) 35 39 { 40 #ifdef CONFIG_BENCH 41 uint64_t t0 = get_cycle(); 42 #endif 36 43 atomic_t a; 37 44 … … 52 59 ASSERT(atomic_get(&a) == 10); 53 60 54 printf("Test passed.\n"); 61 printf("Test passed.\n"); 62 #ifdef CONFIG_BENCH 63 uint64_t dt = get_cycle() - t0; 64 printf("Time: %.*d cycles\n", sizeof(dt) * 2, dt); 65 #endif 55 66 return; 56 67 } -
kernel/test/mm/slab2/test.c
r134877d r319e60e 38 38 #include <synch/mutex.h> 39 39 40 #ifdef CONFIG_BENCH 41 #include <arch/cycle.h> 42 #endif 43 40 44 #define ITEM_SIZE 256 41 45 … … 209 213 void test(void) 210 214 { 215 #ifdef CONFIG_BENCH 216 uint64_t t0 = get_cycle(); 217 #endif 218 211 219 printf("Running reclaim single-thread test .. pass1\n"); 212 220 totalmemtest(); … … 219 227 multitest(8192); 220 228 printf("All done.\n"); 221 } 229 230 #ifdef CONFIG_BENCH 231 uint64_t dt = get_cycle() - t0; 232 printf("Time: %.*d cycles\n", sizeof(dt) * 2, dt); 233 #endif 234 } -
kernel/test/test.h
r134877d r319e60e 1 1 /* 2 * Copyright (C) 200 1-2004 Jakub Jermar2 * Copyright (C) 2006 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup generic29 /** @addtogroup test 30 30 * @{ 31 31 */ … … 36 36 #define KERN_TEST_H_ 37 37 38 extern void test(void); 38 #include <arch/types.h> 39 #include <typedefs.h> 40 41 typedef struct { 42 char * name; 43 char * desc; 44 function entry; 45 } test_t; 46 47 extern void test_atomic1(void); 48 49 extern test_t tests[]; 39 50 40 51 #endif
Note:
See TracChangeset
for help on using the changeset viewer.