direct-io.hg

view tools/console/testsuite/console-domU.c @ 11330:3e54734e55f3

[IA64] Remove extraneous verbose output to clean up Fedora boot.

Signed-off-by: Aron Griffis <aron@hp.com>
author awilliam@xenbuild.aw
date Wed Aug 23 13:26:46 2006 -0600 (2006-08-23)
parents 06d84bf87159
children
line source
1 /* Written by Anthony Liguori <aliguori@us.ibm.com> */
3 #include <stdio.h>
4 #include <stdlib.h>
5 #include <time.h>
6 #include <termios.h>
7 #include <unistd.h>
9 static void canonicalize(char *buffer)
10 {
11 char *reader, *writer;
13 reader = writer = buffer;
15 while (*reader) {
16 *writer = *reader;
17 if (*reader != '\r') writer++;
18 reader++;
19 }
20 *writer = *reader;
21 }
23 int main(int argc, char **argv)
24 {
25 char buffer[4096];
26 char *line;
27 unsigned int seed;
28 size_t size;
29 int i;
30 int runs;
31 struct termios term;
33 tcgetattr(STDIN_FILENO, &term);
34 cfmakeraw(&term);
35 tcsetattr(STDIN_FILENO, TCSAFLUSH, &term);
37 tcgetattr(STDOUT_FILENO, &term);
38 cfmakeraw(&term);
39 tcsetattr(STDOUT_FILENO, TCSAFLUSH, &term);
41 printf("!!!XEN Test Begin!!!\n"); fflush(stdout);
42 line = fgets(buffer, sizeof(buffer), stdin);
43 if (line == NULL) {
44 printf("Failure\n"); fflush(stdout);
45 return 1;
46 }
48 canonicalize(line);
49 seed = strtoul(line, 0, 0);
51 printf("Seed Okay.\n"); fflush(stdout);
53 srandom(seed);
55 for (runs = (random() % 100000) + 4096; runs > 0; runs--) {
56 size = random() % 4096;
58 for (i = 0; i < size; i++) {
59 int ch;
60 int exp;
62 ch = fgetc(stdin);
63 exp = random() & 0xFF;
64 if (ch != exp) {
65 printf("Expected %d got %d\n",
66 exp, ch);
67 fflush(stdout);
68 }
69 printf("Got %d/%d good bytes\n", i, size);
70 }
72 printf("Okay.\n"); fflush(stdout);
73 }
75 return 0;
76 }