Many BOINC features involve multiple projects and/or multiple hosts. It would be prohibitively complex to do automated testing on multiple physical hosts. Fortunately the BOINC architecture makes it possible for multiple projects and (virtual) hosts to reside on a single physical host. So the testing framework uses this approach.
The framework lets you write scripts with any of the following attributes:
boinc_projects/ proj1/ cgi/ download/ html_ops/ html_user/ keys/ upload/ proj2/ ...where proj1, proj2 etc. are the names of the projects in your scripts.
Similarly, each virtual host has various files that must be kept separate. You must designate a "BOINC hosts" directory on your test host. The framework will create subdirectories as follows:
boinc_hosts/ host1/ projects/ slots/ client_state.xml log_flags.xml host2/ ...where host1, host2 etc. are the names of the hosts in your scripts.
class Project { // represents a project var $name; // defaults to "test"; override if needed function add_user($user); // add a User to project's DB function add_app($app); // add an application function add_app_version($app_version); // add an app version function install(); // set up directories and DB function start(); // start feeder function stop(); // stop feeder function check_results_done(); // verify that all results are in state DONE function compare_file($out, $correct); // verify that a result file // matches a known-correct file } class User { // represents an account on a project var $name; // override if needed var $email_addr; var $authenticator; } class Host { // represents a (virtual) host function Host($user); function add_project($project); function install(); function run($flags); } class App { // represents an application function App($name); } class App_Version { // represents an application version var $version; // defaults to 1 var $exec_name; // name of executable; default to app name function App_Version($app); } class Work { // represents a workunit and some results var $wu_template; // name of workunit template file var $result_template; // name of result template file var $nresults; // number of results for this WU var $input_files; // array of input file names function Work($project, $app); function install(); // install in DB and directories }A test script instantiates one or more instances of these classes, links them as needed, installs them, starts the projects, runs the hosts. It then checks the final state (typically, that results are done and result files are correct).
setenv BOINC_PROJECTS_DIR /home/david/boinc_projects # BOINC projects directory setenv BOINC_HOSTS_DIR /home/david/boinc_hosts # BOINC hosts directory setenv BOINC_USER_NAME david # prepended to web error log entries setenv BOINC_SRC_DIR /home/david/boinc_cvs/boinc # BOINC source directory setenv BOINC_CGI_DIR /home/david/cgi-bin # path of a CGI directory setenv BOINC_CGI_URL http://localhost/cgi-bin # URL of that directory setenv BOINC_HTML_DIR /home/david/html # path of a web-page directory setenv BOINC_HTML_URL http://localhost # URL of that directory setenv BOINC_KEY_DIR /home/david/boinc_keys # path of some pre-generated security keys setenv BOINC_PLATFORM i686-pc-linux-gnu # platform name of this machine
#! /usr/local/bin/php <?php include_once("test.inc"); $project = new Project; $user = new User(); $host = new Host($user); $app = new App("upper_case"); $app_version = new App_Version($app); $project->add_user($user); $project->add_app($app); $project->add_app_version($app_version); $project->install(); // must install projects before adding to hosts $host->add_project($project); $host->install(); echo "adding work\n"; $work = new Work($project, $app); $work->wu_template = "uc_wu"; $work->result_template = "uc_result"; $work->nresults = 2; array_push($work->input_files, "input"); $work->install(); $project->start(); $host->run("-exit_when_idle"); $project->stop(); $project->check_results_done(); $project->compare_file("uc_wu_0_0", "uc_correct_output"); $project->compare_file("uc_wu_1_0", "uc_correct_output"); ?>
The apps directory contains the following test applications:
The test directory contains PHP scripts, together with XML templates and sample input files, for initializing and testing the entire system:
These scripts use functions defined in the PHP include file init.inc. You can use these functions to easily write test scripts for your own applications.