Changeset 50661ab in mainline
- Timestamp:
- 2006-12-11T19:00:04Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f272cb8
- Parents:
- 319e60e
- Location:
- kernel
- Files:
-
- 6 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/Makefile
r319e60e r50661ab 214 214 # 215 215 216 if neq ($(CONFIG_TEST),)216 ifeq ($(CONFIG_TEST),y) 217 217 DEFS += -DCONFIG_TEST 218 218 CFLAGS += -Itest/ 219 219 GENERIC_SOURCES += \ 220 220 test/test.c \ 221 test/atomic/atomic1.c 221 test/atomic/atomic1.c \ 222 test/btree/btree1.c \ 223 test/debug/mips1.c \ 224 test/fault/fault1.c \ 225 test/fpu/fpu1.c 222 226 endif 223 227 -
kernel/generic/src/console/cmd.c
r319e60e r50661ab 841 841 } 842 842 843 #ifdef CONFIG_TEST 843 844 /** Command for printing kernel tests list. 844 845 * … … 852 853 853 854 for (test = tests; test->name != NULL; test++) 854 printf("%s\t%s\n", test->name, test->desc); 855 855 printf("%s\t\t%s%s\n", test->name, test->desc, (test->safe ? "" : " (unsafe)")); 856 857 printf("*\t\tRun all safe tests\n"); 856 858 return 1; 857 859 } … … 865 867 int cmd_test(cmd_arg_t *argv) 866 868 { 867 bool fnd = false;868 869 test_t *test; 869 870 870 for (test = tests; test->name != NULL; test++) { 871 if (strcmp(test->name, argv->buffer) == 0) { 872 fnd = true; 873 test->entry(); 874 break; 871 if (strcmp(argv->buffer, "*") == 0) { 872 for (test = tests; test->name != NULL; test++) { 873 if (test->safe) { 874 printf("\n%s\t\t%s\n\n", test->name, test->desc); 875 test->entry(); 876 } 875 877 } 876 } 877 878 if (!fnd) 879 printf("Unknown test.\n"); 880 881 return 1; 882 } 878 } else { 879 bool fnd = false; 880 881 for (test = tests; test->name != NULL; test++) { 882 if (strcmp(test->name, argv->buffer) == 0) { 883 fnd = true; 884 test->entry(); 885 break; 886 } 887 } 888 889 if (!fnd) 890 printf("Unknown test.\n"); 891 } 892 893 return 1; 894 } 895 #endif 883 896 884 897 /** @} -
kernel/kernel.config
r319e60e r50661ab 123 123 124 124 # Benchmark tests 125 ! [CONFIG_TEST !=] CONFIG_BENCH (y/n)125 ! [CONFIG_TEST=y] CONFIG_BENCH (y/n) -
kernel/test/atomic/atomic1.c
r319e60e r50661ab 64 64 printf("Time: %.*d cycles\n", sizeof(dt) * 2, dt); 65 65 #endif 66 return;67 66 } -
kernel/test/btree/btree1.c
r319e60e r50661ab 32 32 #include <debug.h> 33 33 34 #ifdef CONFIG_BENCH 35 #include <arch/cycle.h> 36 #endif 37 34 38 void *data = (void *) 0xdeadbeef; 35 39 36 void test (void)40 void test_btree1(void) 37 41 { 42 #ifdef CONFIG_BENCH 43 uint64_t t0 = get_cycle(); 44 #endif 38 45 btree_t t; 39 46 int i; … … 157 164 158 165 btree_print(&t); 166 #ifdef CONFIG_BENCH 167 uint64_t dt = get_cycle() - t0; 168 printf("Time: %.*d cycles\n", sizeof(dt) * 2, dt); 169 #endif 159 170 } -
kernel/test/debug/mips1.c
r319e60e r50661ab 39 39 40 40 41 void test (void)41 void test_mips1(void) 42 42 { 43 #ifdef mips32 43 44 printf("MIPS debug test #1\n"); 44 45 … … 48 49 49 50 printf("Test passed.\n"); 51 #else 52 printf("This test is availaible only on MIPS32 platform.\n"); 53 #endif 50 54 } -
kernel/test/fault/fault1.c
r319e60e r50661ab 39 39 40 40 41 void test (void)41 void test_fault1(void) 42 42 { 43 43 -
kernel/test/fpu/fpu1.c
r319e60e r50661ab 39 39 #include <arch/arch.h> 40 40 41 #ifdef CONFIG_BENCH 42 #include <arch/cycle.h> 43 #endif 44 45 #if (defined(ia32) || defined(amd64) || defined(ia64) || defined(ia32xen)) 46 41 47 #define THREADS 150*2 42 48 #define ATTEMPTS 100 … … 149 155 } 150 156 151 void test(void) 152 { 157 void test_fpu1(void) 158 { 159 #ifdef CONFIG_BENCH 160 uint64_t t0 = get_cycle(); 161 #endif 153 162 thread_t *t; 154 163 int i; … … 176 185 177 186 printf("Test passed.\n"); 178 } 187 #ifdef CONFIG_BENCH 188 uint64_t dt = get_cycle() - t0; 189 printf("Time: %.*d cycles\n", sizeof(dt) * 2, dt); 190 #endif 191 } 192 193 #else 194 195 void test_fpu1(void) 196 { 197 printf("This test is available only on Intel/AMD platforms."); 198 } 199 200 #endif -
kernel/test/test.c
r319e60e r50661ab 39 39 "atomic1", 40 40 "Test atomic operations", 41 &test_atomic1 41 &test_atomic1, 42 true 43 }, 44 { 45 "btree1", 46 "Test B-tree operations", 47 &test_btree1, 48 true 49 }, 50 { 51 "mips1", 52 "MIPS debug test", 53 &test_mips1, 54 true 55 }, 56 { 57 "fault1", 58 "Write to NULL (maybe page fault)", 59 &test_fault1, 60 false 61 }, 62 { 63 "fpu1", 64 "Intel FPU test", 65 &test_fpu1, 66 true 42 67 }, 43 68 {NULL, NULL, NULL} -
kernel/test/test.h
r319e60e r50661ab 43 43 char * desc; 44 44 function entry; 45 bool safe; 45 46 } test_t; 46 47 47 48 extern void test_atomic1(void); 49 extern void test_btree1(void); 50 extern void test_mips1(void); 51 extern void test_fault1(void); 52 extern void test_fpu1(void); 48 53 49 54 extern test_t tests[];
Note:
See TracChangeset
for help on using the changeset viewer.