2002-07-24 19:47:36 +00:00
|
|
|
#! /usr/local/bin/php
|
|
|
|
<?php
|
2002-10-04 05:30:44 +00:00
|
|
|
// test whether CPU time is computed correctly across restarts
|
2002-07-24 19:47:36 +00:00
|
|
|
|
2002-10-04 05:30:44 +00:00
|
|
|
include_once("test.inc");
|
2002-07-24 19:47:36 +00:00
|
|
|
|
2002-10-04 05:30:44 +00:00
|
|
|
$project = new Project;
|
|
|
|
$user = new User();
|
|
|
|
$host = new Host($user);
|
|
|
|
$app = new App("uc_cpu");
|
|
|
|
$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->log_flags = "log_flags.xml";
|
|
|
|
$host->add_project($project);
|
|
|
|
$host->install();
|
|
|
|
|
|
|
|
echo "adding work\n";
|
|
|
|
|
|
|
|
$work = new Work($app);
|
|
|
|
$work->wu_template = "uccpu_wu";
|
|
|
|
$work->result_template = "uccpu_result";
|
2002-12-05 19:13:06 +00:00
|
|
|
$work->redundancy = 1;
|
2002-10-04 05:30:44 +00:00
|
|
|
array_push($work->input_files, "small_input");
|
|
|
|
$work->install($project);
|
|
|
|
|
2002-10-09 04:56:41 +00:00
|
|
|
$project->start_feeder();
|
2002-08-09 23:34:11 +00:00
|
|
|
$app_time = 0;
|
2003-02-12 19:53:46 +00:00
|
|
|
$host->run("-exit_after_app_start 400");
|
2002-10-04 05:30:44 +00:00
|
|
|
$app_time += $host->read_cpu_time_file("app.time");
|
|
|
|
$host->run("-exit_when_idle");
|
|
|
|
$project->stop();
|
|
|
|
|
2002-10-06 00:43:55 +00:00
|
|
|
$result->state = RESULT_STATE_DONE;
|
|
|
|
$project->check_results(1, $result);
|
2002-10-04 05:30:44 +00:00
|
|
|
$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'");
|
|
|
|
$result = mysql_fetch_object($x);
|
|
|
|
$db_time = $result->cpu_time;
|
|
|
|
|
|
|
|
if (abs($app_time-$client_time) > .01) echo "time mismatch\n";
|
|
|
|
if (abs($app_time-$db_time) > .01) echo "time mismatch\n";
|
|
|
|
|
2002-07-24 19:47:36 +00:00
|
|
|
?>
|