Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4486 → Rev 4487

/trunk/uspace/app/tester/console/console1.c
28,12 → 28,12
 
#include <stdio.h>
#include <stdlib.h>
#include <io/stream.h>
#include <io/console.h>
#include <io/color.h>
#include <io/style.h>
#include <async.h>
#include "../tester.h"
 
#include <console.h>
 
const char *color_name[] = {
[COLOR_BLACK] = "black",
[COLOR_BLUE] = "blue",
50,21 → 50,21
int i, j;
 
printf("Style test: ");
console_set_style(STYLE_NORMAL);
console_set_style(fphone(stdout), STYLE_NORMAL);
printf("normal ");
console_set_style(STYLE_EMPHASIS);
console_set_style(fphone(stdout), STYLE_EMPHASIS);
printf("emphasized");
console_set_style(STYLE_NORMAL);
console_set_style(fphone(stdout), STYLE_NORMAL);
printf(".\n");
 
printf("Foreground color test:\n");
for (j = 0; j < 2; j++) {
for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
console_set_color(i, COLOR_WHITE,
console_set_color(fphone(stdout), i, COLOR_WHITE,
j ? CATTR_BRIGHT : 0);
printf(" %s ", color_name[i]);
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
}
 
71,11 → 71,11
printf("Background color test:\n");
for (j = 0; j < 2; j++) {
for (i = COLOR_BLACK; i <= COLOR_WHITE; i++) {
console_set_color(COLOR_WHITE, i,
console_set_color(fphone(stdout), COLOR_WHITE, i,
j ? CATTR_BRIGHT : 0);
printf(" %s ", color_name[i]);
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
}
 
82,24 → 82,24
printf("Now let's test RGB colors:\n");
 
for (i = 0; i < 255; i += 16) {
console_set_rgb_color(0xffffff, i << 16);
console_set_rgb_color(fphone(stdout), 0xffffff, i << 16);
putchar('X');
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
 
for (i = 0; i < 255; i += 16) {
console_set_rgb_color(0xffffff, i << 8);
console_set_rgb_color(fphone(stdout), 0xffffff, i << 8);
putchar('X');
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
 
for (i = 0; i < 255; i += 16) {
console_set_rgb_color(0xffffff, i);
console_set_rgb_color(fphone(stdout), 0xffffff, i);
putchar('X');
}
console_set_color(COLOR_BLACK, COLOR_WHITE, 0);
console_set_color(fphone(stdout), COLOR_BLACK, COLOR_WHITE, 0);
putchar('\n');
 
printf("[press a key]\n");
/trunk/uspace/app/tester/tester.c
130,6 → 130,7
list_tests();
printf("> ");
fflush(stdout);
c = getchar();
printf("%c\n", c);
/trunk/uspace/app/tester/ipc/ping_pong.c
28,41 → 28,46
 
#include <stdio.h>
#include <stdlib.h>
#include <console.h>
#include <sys/time.h>
#include <ipc/ns.h>
#include <async.h>
#include <errno.h>
#include "../tester.h"
 
#define DURATION_SECS 10
#define COUNT_GRANULARITY 100
#define DURATION_SECS 10
#define COUNT_GRANULARITY 100
 
char * test_ping_pong(bool quiet)
char *test_ping_pong(bool quiet)
{
int i;
int w, h;
struct timeval start, now;
long count;
 
printf("Pinging console server for %d seconds...\n", DURATION_SECS);
 
printf("Pinging ns server for %d seconds...\n", DURATION_SECS);
struct timeval start;
if (gettimeofday(&start, NULL) != 0)
return "Failed getting the time.";
 
count = 0;
 
uint64_t count = 0;
while (true) {
struct timeval now;
if (gettimeofday(&now, NULL) != 0)
return "Failed getting the time.";
 
if (tv_sub(&now, &start) >= DURATION_SECS * 1000000L)
break;
 
for (i = 0; i < COUNT_GRANULARITY; i++)
console_get_size(&w, &h);
size_t i;
for (i = 0; i < COUNT_GRANULARITY; i++) {
int retval = async_req_0_0(PHONE_NS, NS_PING);
if (retval != EOK)
return "Failed to send ping message.";
}
count += COUNT_GRANULARITY;
}
 
printf("Completed %ld round trips in %d seconds, %ld RT/s.\n", count,
DURATION_SECS, count / DURATION_SECS);
 
printf("Completed %lu round trips in %u seconds, %lu RT/s.\n",
count, DURATION_SECS, count / DURATION_SECS);
return NULL;
}