*** empty log message ***

svn path=/trunk/boinc/; revision=1610
This commit is contained in:
Eric Heien 2003-06-28 00:10:47 +00:00
parent cc284ffd81
commit 6d02766b90
3 changed files with 30 additions and 2 deletions

View File

@ -24,6 +24,7 @@
// -cpu_time: app will chew up some CPU cycles after each character, // -cpu_time: app will chew up some CPU cycles after each character,
// used for testing CPU time reporting // used for testing CPU time reporting
// -signal: app will raise SIGHUP signal (for testing signal handler) // -signal: app will raise SIGHUP signal (for testing signal handler)
// -exit: app will exit with status -10 (for testing exit handler)
// //
// This version does one char/second, // This version does one char/second,
// and writes its state to disk every so often // and writes its state to disk every so often
@ -70,7 +71,7 @@ char the_char[10];
double xPos=0, yPos=0; double xPos=0, yPos=0;
double xDelta=0.03, yDelta=0.07; double xDelta=0.03, yDelta=0.07;
int run_slow=0,cpu_time=0,raise_signal=0; int run_slow=0,cpu_time=0,raise_signal=0,random_exit=0;
time_t my_start_time; time_t my_start_time;
APP_INIT_DATA uc_aid; APP_INIT_DATA uc_aid;
@ -163,6 +164,7 @@ int main(int argc, char **argv) {
if (!strcmp(argv[i], "-run_slow")) run_slow = 1; if (!strcmp(argv[i], "-run_slow")) run_slow = 1;
if (!strcmp(argv[i], "-cpu_time")) cpu_time = 1; if (!strcmp(argv[i], "-cpu_time")) cpu_time = 1;
if (!strcmp(argv[i], "-signal")) raise_signal = 1; if (!strcmp(argv[i], "-signal")) raise_signal = 1;
if (!strcmp(argv[i], "-exit")) random_exit = 1;
} }
in = fopen(resolved_name, "r"); in = fopen(resolved_name, "r");
boinc_resolve_filename(CHECKPOINT_FILE, resolved_name, sizeof(resolved_name)); boinc_resolve_filename(CHECKPOINT_FILE, resolved_name, sizeof(resolved_name));
@ -210,11 +212,16 @@ int main(int argc, char **argv) {
boinc_sleep(1.); boinc_sleep(1.);
} }
#ifdef SIGNAL_H #ifdef HAVE_SIGNAL_H
if (raise_signal) { if (raise_signal) {
raise(SIGHUP); raise(SIGHUP);
} }
#endif #endif
if (random_exit) {
if ((random()%20) == 0) {
exit(-10);
}
}
if (boinc_time_to_checkpoint()) { if (boinc_time_to_checkpoint()) {
retval = do_checkpoint(out, nchars); retval = do_checkpoint(out, nchars);
@ -230,6 +237,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "APP: upper_case flush failed %d\n", retval); fprintf(stderr, "APP: upper_case flush failed %d\n", retval);
exit(1); exit(1);
} }
if (random_exit) exit(-10);
fprintf(stderr, "APP: upper_case ending, wrote %d chars\n", nchars); fprintf(stderr, "APP: upper_case ending, wrote %d chars\n", nchars);
double cur_cpu; double cur_cpu;
int cur_mem; int cur_mem;

10
test/uc_exit_wu Normal file
View File

@ -0,0 +1,10 @@
<file_info>
<number>0</number>
</file_info>
<workunit>
<file_ref>
<file_number>0</file_number>
<open_name>in</open_name>
</file_ref>
<command_line>-exit</command_line>
</workunit>

10
test/uc_sig_wu Normal file
View File

@ -0,0 +1,10 @@
<file_info>
<number>0</number>
</file_info>
<workunit>
<file_ref>
<file_number>0</file_number>
<open_name>in</open_name>
</file_ref>
<command_line>-signal</command_line>
</workunit>