mirror of https://github.com/BOINC/boinc.git
parent
d22d978e1e
commit
c521cc09a7
|
@ -42,13 +42,15 @@ int boinc_init_opengl() {
|
|||
HANDLE hThread;
|
||||
|
||||
// Create the graphics thread, passing it the graphics info
|
||||
hThread = CreateThread( NULL, 0, win_graphics_event_loop, &gi, CREATE_SUSPENDED, &threadId );
|
||||
hThread = CreateThread(
|
||||
NULL, 0, win_graphics_event_loop, &gi, CREATE_SUSPENDED, &threadId
|
||||
);
|
||||
|
||||
// Set it to idle priority
|
||||
SetThreadPriority (hThread, THREAD_PRIORITY_HIGHEST);
|
||||
SetThreadPriority(hThread, THREAD_PRIORITY_HIGHEST);
|
||||
|
||||
// Start the graphics thread
|
||||
ResumeThread( hThread );
|
||||
ResumeThread(hThread);
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE_CC__
|
||||
|
@ -59,14 +61,16 @@ int boinc_init_opengl() {
|
|||
entry_proc = NewThreadEntryUPP( mac_graphics_event_loop );
|
||||
|
||||
// Create the thread in a suspended state
|
||||
theErr = NewThread ( kCooperativeThread, entry_proc,
|
||||
(void *)(&gi), 0, kNewSuspend, NULL, &graphicsThreadID );
|
||||
theErr = NewThread (
|
||||
kCooperativeThread, entry_proc,
|
||||
(void *)(&gi), 0, kNewSuspend, NULL, &graphicsThreadID
|
||||
);
|
||||
if (theErr != noErr) return ERR_THREAD;
|
||||
|
||||
// In theory we could do customized scheduling or install thread disposal routines here
|
||||
|
||||
// Put the graphics event loop into the ready state
|
||||
SetThreadState( graphicsThreadID, kReadyThreadState, kNoThreadID );
|
||||
SetThreadState(graphicsThreadID, kReadyThreadState, kNoThreadID);
|
||||
|
||||
YieldToAnyThread();
|
||||
#endif
|
||||
|
@ -99,13 +103,13 @@ int write_graphics_file(FILE* f, GRAPHICS_INFO* gi) {
|
|||
int parse_graphics_file(FILE* f, GRAPHICS_INFO* gi) {
|
||||
char buf[256];
|
||||
while (fgets(buf, 256, f)) {
|
||||
if (match_tag(buf, "<graphics_info>")) continue;
|
||||
if (match_tag(buf, "</graphics_info>")) return 0;
|
||||
else if (parse_int(buf, "<graphics_xsize>", gi->xsize)) continue;
|
||||
else if (parse_int(buf, "<graphics_ysize>", gi->ysize)) continue;
|
||||
else if (parse_int(buf, "<graphics_mode>", gi->graphics_mode)) continue;
|
||||
else if (parse_double(buf, "<graphics_refresh_period>", gi->refresh_period)) continue;
|
||||
else fprintf(stderr, "parse_core_file: unrecognized %s", buf);
|
||||
else fprintf(stderr, "parse_graphics_file: unrecognized %s", buf);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -87,9 +87,11 @@ class Project { // represents a project
|
|||
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
|
||||
function check_results($n, $result); // check that there are n results
|
||||
// and that they match "result"
|
||||
// (for all fields that are defined)
|
||||
}
|
||||
|
||||
class User { // represents an account on a project
|
||||
|
@ -103,6 +105,8 @@ class Host { // represents a (virtual) host
|
|||
function add_project($project);
|
||||
function install();
|
||||
function run($flags);
|
||||
function check_file_present($project, $name);
|
||||
// check that a file exists
|
||||
}
|
||||
|
||||
class App { // represents an application
|
||||
|
@ -177,23 +181,27 @@ illustrates the use of the testing framework.
|
|||
$project->add_app_version($app_version);
|
||||
$project->install(); // must install projects before adding to hosts
|
||||
|
||||
$host->log_flags = "log_flags.xml";
|
||||
$host->add_project($project);
|
||||
$host->install();
|
||||
|
||||
echo "adding work\n";
|
||||
|
||||
$work = new Work($project, $app);
|
||||
$work = new Work($app);
|
||||
$work->wu_template = "uc_wu";
|
||||
$work->result_template = "uc_result";
|
||||
$work->nresults = 2;
|
||||
array_push($work->input_files, "input");
|
||||
$work->install();
|
||||
$work->install($project);
|
||||
|
||||
$project->start();
|
||||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
$project->check_results_done();
|
||||
$result->state = RESULT_STATE_DONE;
|
||||
$result->stderr_out = "APP: upper_case: starting, argc 1";
|
||||
$result->exit_status = 0;
|
||||
$project->check_results(2, $result);
|
||||
$project->compare_file("uc_wu_0_0", "uc_correct_output");
|
||||
$project->compare_file("uc_wu_1_0", "uc_correct_output");
|
||||
?>
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
//
|
||||
// See doc/test.html for details
|
||||
|
||||
define("RESULT_STATE_DONE", 4);
|
||||
|
||||
// get an enviroment variable, and abort script if missing
|
||||
//
|
||||
function get_env_var($name) {
|
||||
|
@ -239,11 +241,30 @@ class Project {
|
|||
fclose($f);
|
||||
}
|
||||
|
||||
function check_results_done() {
|
||||
function check_results($ntarget, $result) {
|
||||
$n = 0;
|
||||
db_open($this->db_name);
|
||||
$result = mysql_query("select * from result where state<>4");
|
||||
$result = mysql_query("select * from result");
|
||||
while ($x = mysql_fetch_object($result)) {
|
||||
echo "result $x->id is not done\n";
|
||||
$n++;
|
||||
if ($result->state != null) {
|
||||
if ($result->state != $x->state) {
|
||||
echo "ERROR: result $x->id: unexpected state $x->state\n";
|
||||
}
|
||||
}
|
||||
if ($result->stderr_out != null) {
|
||||
if (substr($result->stderr_out, $x->stderr_out)==0) {
|
||||
echo "ERROR: result $x->id: unexpected stderr_out $x->stderr_out\n";
|
||||
}
|
||||
}
|
||||
if ($result->exit_status != null) {
|
||||
if ($result->exit_status != $x->exit_status) {
|
||||
echo "ERROR: result $x->id: unexpected exit_status $x->exit_status\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($n != $ntarget) {
|
||||
echo "ERROR: expected $ntarget results, found $n.\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -351,6 +372,13 @@ class Host {
|
|||
return $app_time;
|
||||
}
|
||||
|
||||
function check_file_present($project, $filename) {
|
||||
$enc_url = replace($project->master_url, "/", "_");
|
||||
$path= "$this->host_dir/projects/$enc_url/$filename";
|
||||
if (!file_exists($path)) {
|
||||
echo "ERROR: file $path doesn't exist\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Work {
|
||||
|
|
|
@ -46,10 +46,11 @@
|
|||
$project1->stop();
|
||||
$project2->stop();
|
||||
|
||||
$project1->check_results_done();
|
||||
$result->state = RESULT_STATE_DONE;
|
||||
$project1->check_results(2, $result);
|
||||
$project1->compare_file("uc_wu_0_0", "uc_correct_output");
|
||||
$project1->compare_file("uc_wu_1_0", "uc_correct_output");
|
||||
$project2->check_results_done();
|
||||
$project2->check_results(2, $result);
|
||||
$project2->compare_file("uc_wu_0_0", "uc_correct_output");
|
||||
$project2->compare_file("uc_wu_1_0", "uc_correct_output");
|
||||
?>
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
$project->check_results_done();
|
||||
$result->state = RESULT_STATE_DONE;
|
||||
$project->check_results(2, $result);
|
||||
$project->compare_file("concat_wu_0_0", "concat_correct_output");
|
||||
$project->compare_file("concat_wu_1_0", "concat_correct_output");
|
||||
?>
|
||||
|
|
|
@ -33,6 +33,6 @@
|
|||
|
||||
echo "Now run the client manually; start and stop it a few times.\n";
|
||||
|
||||
//$project->check_results_done();
|
||||
//$project->check_results(1, $result);
|
||||
//$project->compare_file("ucs_wu_0_0", "uc_small_correct_output");
|
||||
?>
|
||||
|
|
|
@ -34,7 +34,5 @@
|
|||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
$x = $project->num_results_done();
|
||||
if ($x != 0) echo "Test failed\n";
|
||||
if ($x == 0) echo "Test succeeded\n";
|
||||
$project->check_results(0, $result);
|
||||
?>
|
||||
|
|
|
@ -32,16 +32,13 @@
|
|||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
$project->check_results_done();
|
||||
$result->state = RESULT_STATE_DONE;
|
||||
$project->check_results(2, $result);
|
||||
$project->compare_file("uc_wu_0_0", "uc_correct_output");
|
||||
$project->compare_file("uc_wu_1_0", "uc_correct_output");
|
||||
|
||||
// make sure result files are still there
|
||||
if (!$host->file_present($project, "uc_wu_0_0")) {
|
||||
echo "test failed\n";
|
||||
}
|
||||
if (!$host->file_present($project, "uc_wu_1_0")) {
|
||||
echo "test failed\n";
|
||||
}
|
||||
$host->check_file_present($project, "uc_wu_0_0");
|
||||
$host->check_file_present($project, "uc_wu_1_0");
|
||||
|
||||
?>
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
$project->check_results_done();
|
||||
$result->state = RESULT_STATE_DONE;
|
||||
$project->check_results(1, $result);
|
||||
$project->compare_file("uccpu_wu_0_0", "uc_small_correct_output");
|
||||
$client_time = $host->read_cpu_time_file("client_time");
|
||||
$x = mysql_query("select cpu_time from result where name='uccpu_wu_0'");
|
||||
|
|
|
@ -33,7 +33,10 @@
|
|||
$host->run("-exit_when_idle");
|
||||
$project->stop();
|
||||
|
||||
$project->check_results_done();
|
||||
$result->state = RESULT_STATE_DONE;
|
||||
$result->stderr_out = "APP: upper_case: starting, argc 1";
|
||||
$result->exit_status = 0;
|
||||
$project->check_results(2, $result);
|
||||
$project->compare_file("uc_wu_0_0", "uc_correct_output");
|
||||
$project->compare_file("uc_wu_1_0", "uc_correct_output");
|
||||
?>
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
//$project->stop();
|
||||
|
||||
//$project->check_results_done();
|
||||
//$project->check_results(2, $result);
|
||||
//$project->compare_file("uc_wu_0_0", "uc_correct_output");
|
||||
//$project->compare_file("uc_wu_1_0", "uc_correct_output");
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue