Skip to content

Commit 58e3c64

Browse files
authored
Merge pull request #5670 from BOINC/dpa_app_test3
2 parents 53f624d + 74da41e commit 58e3c64

File tree

2 files changed

+28
-10
lines changed

2 files changed

+28
-10
lines changed

client/app_test.cpp

+24-10
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,26 @@
2222
// To use this framework:
2323
// edit this file to describe your application:
2424
// 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'
3036
// (or you can use an existing BOINC data directory,
3137
// in which case the client will also run jobs that are there)
3238
// make a directory test/slots/app_test
3339
// The client will run the test job there.
3440
// 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
3845
// when the job is done, the client won't clean out the slot dir.
3946
// You can examine the contents of the slot dir,
4047
// and examine the output files in the test dir.
@@ -45,6 +52,10 @@
4552
#include "client_state.h"
4653
#include "log_flags.h"
4754

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+
4859
static PROJECT* make_project() {
4960
PROJECT *proj = new PROJECT;
5061
strcpy(proj->project_name, "test project");
@@ -92,6 +103,10 @@ static FILE_REF* make_file(
92103
}
93104

94105
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+
}
95110
APP_VERSION *av = new APP_VERSION;
96111
strcpy(av->app_name, "test_av");
97112
strcpy(av->api_version, "8.0");
@@ -132,8 +147,7 @@ static RESULT* make_result(APP_VERSION *av, WORKUNIT* wu) {
132147
return res;
133148
}
134149

135-
// app_test_init() sets up data structures
136-
// (project, app, app version, WU, result)
150+
// app_test_init() sets up above data structures
137151
// so that the client runs a test job.
138152
//
139153
void CLIENT_STATE::app_test_init() {

client/cs_cmdline.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ void CLIENT_STATE::parse_cmdline(int argc, char** argv) {
129129
} else if (ARG(allow_remote_gui_rpc)) {
130130
cc_config.allow_remote_gui_rpc = true;
131131
} else if (ARG(app_test)) {
132+
if (i+1 >= argc) {
133+
fprintf(stderr, "usage: boinc --app_test exec-file\n");
134+
exit(1);
135+
}
132136
app_test = true;
133137
app_test_file = argv[++i];
134138
} else if (ARG(attach_project)) {

0 commit comments

Comments
 (0)