Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1157)

Side by Side Diff: runtime/bin/process_test.cc

Issue 10544207: Revert "Test infrastructure: Change the intentionally crashing process_test.cc, to try and avoid ti… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move before while loop. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <stdio.h> 5 #include <stdio.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 /* 9 /*
10 * Run ./process_test <outstream> <echocount> <exitcode> <crash> 10 * Run ./process_test <outstream> <echocount> <exitcode> <crash>
(...skipping 14 matching lines...) Expand all
25 fprintf(stderr, "unknown outstream"); 25 fprintf(stderr, "unknown outstream");
26 exit(1); 26 exit(1);
27 } 27 }
28 28
29 int echo_counter = 0; 29 int echo_counter = 0;
30 int echo_count = atoi(argv[2]); 30 int echo_count = atoi(argv[2]);
31 int exit_code = atoi(argv[3]); 31 int exit_code = atoi(argv[3]);
32 int crash = atoi(argv[4]); 32 int crash = atoi(argv[4]);
33 33
34 if (crash == 1) { 34 if (crash == 1) {
35 abort(); 35 int* segfault = NULL;
36 *segfault = 1;
36 } 37 }
37 38
38 const int kLineSize = 128; 39 const int kLineSize = 128;
39 char line[kLineSize]; 40 char line[kLineSize];
40 41
41 while ((echo_count != echo_counter) && 42 while ((echo_count != echo_counter) &&
42 (fgets(line, kLineSize, stdin) != NULL)) { 43 (fgets(line, kLineSize, stdin) != NULL)) {
43 if (outstream == 0) { 44 if (outstream == 0) {
44 fprintf(stdout, "%s", line); 45 fprintf(stdout, "%s", line);
45 fflush(stdout); 46 fflush(stdout);
46 } else if (outstream == 1) { 47 } else if (outstream == 1) {
47 fprintf(stderr, "%s", line); 48 fprintf(stderr, "%s", line);
48 fflush(stderr); 49 fflush(stderr);
49 } else if (outstream == 2) { 50 } else if (outstream == 2) {
50 fprintf(stdout, "%s", line); 51 fprintf(stdout, "%s", line);
51 fprintf(stderr, "%s", line); 52 fprintf(stderr, "%s", line);
52 fflush(stdout); 53 fflush(stdout);
53 fflush(stderr); 54 fflush(stderr);
54 } 55 }
55 echo_counter++; 56 echo_counter++;
56 } 57 }
57 58
58 return exit_code; 59 return exit_code;
59 } 60 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698