Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
svn path=/trunk/boinc/; revision=1610
  • Loading branch information
eheien committed Jun 28, 2003
1 parent cc284ff commit 6d02766
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/upper_case.C
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
// -cpu_time: app will chew up some CPU cycles after each character,
// used for testing CPU time reporting
// -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,
// and writes its state to disk every so often
Expand Down Expand Up @@ -70,7 +71,7 @@ char the_char[10];
double xPos=0, yPos=0;
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;
APP_INIT_DATA uc_aid;

Expand Down Expand Up @@ -163,6 +164,7 @@ int main(int argc, char **argv) {
if (!strcmp(argv[i], "-run_slow")) run_slow = 1;
if (!strcmp(argv[i], "-cpu_time")) cpu_time = 1;
if (!strcmp(argv[i], "-signal")) raise_signal = 1;
if (!strcmp(argv[i], "-exit")) random_exit = 1;
}
in = fopen(resolved_name, "r");
boinc_resolve_filename(CHECKPOINT_FILE, resolved_name, sizeof(resolved_name));
Expand Down Expand Up @@ -210,11 +212,16 @@ int main(int argc, char **argv) {
boinc_sleep(1.);
}

#ifdef SIGNAL_H
#ifdef HAVE_SIGNAL_H
if (raise_signal) {
raise(SIGHUP);
}
#endif
if (random_exit) {
if ((random()%20) == 0) {
exit(-10);
}
}

if (boinc_time_to_checkpoint()) {
retval = do_checkpoint(out, nchars);
Expand All @@ -230,6 +237,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "APP: upper_case flush failed %d\n", retval);
exit(1);
}
if (random_exit) exit(-10);
fprintf(stderr, "APP: upper_case ending, wrote %d chars\n", nchars);
double cur_cpu;
int cur_mem;
Expand Down
10 changes: 10 additions & 0 deletions test/uc_exit_wu
Original file line number Diff line number Diff line change
@@ -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 changes: 10 additions & 0 deletions test/uc_sig_wu
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 6d02766

Please sign in to comment.