Changeset cbff4c2 in mainline
- Timestamp:
- 2009-06-03T19:31:07Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0c25c10
- Parents:
- 73878c1
- Location:
- uspace/app/tester
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/console/console1.c
r73878c1 rcbff4c2 29 29 #include <stdio.h> 30 30 #include <stdlib.h> 31 #include <io/stream.h> 31 #include <io/console.h> 32 #include <io/color.h> 33 #include <io/style.h> 32 34 #include <async.h> 33 35 #include "../tester.h" 34 35 #include <console.h>36 36 37 37 const char *color_name[] = { … … 51 51 52 52 printf("Style test: "); 53 console_set_style( STYLE_NORMAL);53 console_set_style(fphone(stdout), STYLE_NORMAL); 54 54 printf("normal "); 55 console_set_style( STYLE_EMPHASIS);55 console_set_style(fphone(stdout), STYLE_EMPHASIS); 56 56 printf("emphasized"); 57 console_set_style( STYLE_NORMAL);57 console_set_style(fphone(stdout), STYLE_NORMAL); 58 58 printf(".\n"); 59 59 … … 61 61 for (j = 0; j < 2; j++) { 62 62 for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) { 63 console_set_color( i, COLOR_WHITE,63 console_set_color(fphone(stdout), i, COLOR_WHITE, 64 64 j ? CATTR_BRIGHT : 0); 65 65 printf(" %s ", color_name[i]); 66 66 } 67 console_set_color( COLOR_BLACK, COLOR_WHITE, 0);67 console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0); 68 68 putchar('\n'); 69 69 } … … 72 72 for (j = 0; j < 2; j++) { 73 73 for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) { 74 console_set_color( COLOR_WHITE, i,74 console_set_color(fphone(stdout), COLOR_WHITE, i, 75 75 j ? CATTR_BRIGHT : 0); 76 76 printf(" %s ", color_name[i]); 77 77 } 78 console_set_color( COLOR_BLACK, COLOR_WHITE, 0);78 console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0); 79 79 putchar('\n'); 80 80 } … … 83 83 84 84 for (i = 0; i < 255; i += 16) { 85 console_set_rgb_color( 0xffffff, i << 16);85 console_set_rgb_color(fphone(stdout), 0xffffff, i << 16); 86 86 putchar('X'); 87 87 } 88 console_set_color( COLOR_BLACK, COLOR_WHITE, 0);88 console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0); 89 89 putchar('\n'); 90 90 91 91 for (i = 0; i < 255; i += 16) { 92 console_set_rgb_color( 0xffffff, i << 8);92 console_set_rgb_color(fphone(stdout), 0xffffff, i << 8); 93 93 putchar('X'); 94 94 } 95 console_set_color( COLOR_BLACK, COLOR_WHITE, 0);95 console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0); 96 96 putchar('\n'); 97 97 98 98 for (i = 0; i < 255; i += 16) { 99 console_set_rgb_color( 0xffffff, i);99 console_set_rgb_color(fphone(stdout), 0xffffff, i); 100 100 putchar('X'); 101 101 } 102 console_set_color( COLOR_BLACK, COLOR_WHITE, 0);102 console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0); 103 103 putchar('\n'); 104 104 -
uspace/app/tester/ipc/ping_pong.c
r73878c1 rcbff4c2 29 29 #include <stdio.h> 30 30 #include <stdlib.h> 31 #include <console.h>32 31 #include <sys/time.h> 32 #include <ipc/ns.h> 33 #include <async.h> 34 #include <errno.h> 33 35 #include "../tester.h" 34 36 35 #define DURATION_SECS 36 #define COUNT_GRANULARITY 37 #define DURATION_SECS 10 38 #define COUNT_GRANULARITY 100 37 39 38 char * 40 char *test_ping_pong(bool quiet) 39 41 { 40 int i; 41 int w, h; 42 struct timeval start, now; 43 long count; 44 45 printf("Pinging console server for %d seconds...\n", DURATION_SECS); 46 42 printf("Pinging ns server for %d seconds...\n", DURATION_SECS); 43 44 struct timeval start; 47 45 if (gettimeofday(&start, NULL) != 0) 48 46 return "Failed getting the time."; 49 50 count = 0;51 47 48 uint64_t count = 0; 49 52 50 while (true) { 51 struct timeval now; 53 52 if (gettimeofday(&now, NULL) != 0) 54 53 return "Failed getting the time."; 55 54 56 55 if (tv_sub(&now, &start) >= DURATION_SECS * 1000000L) 57 56 break; 58 59 for (i = 0; i < COUNT_GRANULARITY; i++) 60 console_get_size(&w, &h); 57 58 size_t i; 59 for (i = 0; i < COUNT_GRANULARITY; i++) { 60 int retval = async_req_0_0(PHONE_NS, NS_PING); 61 62 if (retval != EOK) 63 return "Failed to send ping message."; 64 } 65 61 66 count += COUNT_GRANULARITY; 62 67 } 63 64 printf("Completed %l d round trips in %d seconds, %ld RT/s.\n", count,65 DURATION_SECS, count / DURATION_SECS);66 68 69 printf("Completed %lu round trips in %u seconds, %lu RT/s.\n", 70 count, DURATION_SECS, count / DURATION_SECS); 71 67 72 return NULL; 68 73 } -
uspace/app/tester/tester.c
r73878c1 rcbff4c2 131 131 list_tests(); 132 132 printf("> "); 133 fflush(stdout); 133 134 134 135 c = getchar();
Note:
See TracChangeset
for help on using the changeset viewer.