|
22 | 22 | // To use this framework:
|
23 | 23 | // edit this file to describe your application:
|
24 | 24 | // input/output files, attributes, etc.
|
25 |
| -// NOTE: currently it's set up for the 'uc2' app, |
26 |
| -// which reads 'in' and writes 'out' (logical names). |
27 |
| -// The job uses physical names 'infile' and 'outfile'. |
28 |
| -// build the BOINC client |
29 |
| -// make a 'test' directory |
| 25 | +// NOTE: currently it's set up for an app that: |
| 26 | +// - is a native BOINC app (i.e. uses the BOINC library) |
| 27 | +// - has 1 input file: |
| 28 | +// logical name 'in' and physical name 'infile' |
| 29 | +// - has 1 output file: |
| 30 | +// logical name 'out' and physical name 'outfile' |
| 31 | +// - has the command line 'in out' (i.e. the logical file names) |
| 32 | +// To change these, edit app_test_init() below |
| 33 | +// |
| 34 | +// build the BOINC client with these changes |
| 35 | +// make a BOINC data directory, say 'test' |
30 | 36 | // (or you can use an existing BOINC data directory,
|
31 | 37 | // in which case the client will also run jobs that are there)
|
32 | 38 | // make a directory test/slots/app_test
|
33 | 39 | // The client will run the test job there.
|
34 | 40 | // Clean it out between runs.
|
35 |
| -// put the executable file and input file(s) in the test directory |
36 |
| -// (which acts as the project directory) |
37 |
| -// in the test directory, run boinc --app_test |
| 41 | +// the test directory acts as the project directory. In it, put |
| 42 | +// - the executable file |
| 43 | +// - the input file(s) with physical names |
| 44 | +// in the test directory, run boinc --app_test exec_filename |
38 | 45 | // when the job is done, the client won't clean out the slot dir.
|
39 | 46 | // You can examine the contents of the slot dir,
|
40 | 47 | // and examine the output files in the test dir.
|
|
45 | 52 | #include "client_state.h"
|
46 | 53 | #include "log_flags.h"
|
47 | 54 |
|
| 55 | +// The following functions create client data structures |
| 56 | +// (PROJECT, APP, APP_VERSION, WORKUNIT, RESULT, FILE_REF, FILE_INFO) |
| 57 | +// for the test app and job. |
| 58 | + |
48 | 59 | static PROJECT* make_project() {
|
49 | 60 | PROJECT *proj = new PROJECT;
|
50 | 61 | strcpy(proj->project_name, "test project");
|
@@ -92,6 +103,10 @@ static FILE_REF* make_file(
|
92 | 103 | }
|
93 | 104 |
|
94 | 105 | static APP_VERSION* make_app_version(APP *app, const char* exec_name) {
|
| 106 | + if (!boinc_file_exists(exec_name)) { |
| 107 | + fprintf(stderr, "%s doesn't exist\n", exec_name); |
| 108 | + exit(1); |
| 109 | + } |
95 | 110 | APP_VERSION *av = new APP_VERSION;
|
96 | 111 | strcpy(av->app_name, "test_av");
|
97 | 112 | strcpy(av->api_version, "8.0");
|
@@ -132,8 +147,7 @@ static RESULT* make_result(APP_VERSION *av, WORKUNIT* wu) {
|
132 | 147 | return res;
|
133 | 148 | }
|
134 | 149 |
|
135 |
| -// app_test_init() sets up data structures |
136 |
| -// (project, app, app version, WU, result) |
| 150 | +// app_test_init() sets up above data structures |
137 | 151 | // so that the client runs a test job.
|
138 | 152 | //
|
139 | 153 | void CLIENT_STATE::app_test_init() {
|
|
0 commit comments