prefs.xml"); } function copy_to_download_dir($f) { global $BOINC_DOWNLOAD_DIR; PassThru("cp $f $BOINC_DOWNLOAD_DIR"); } function add_user($prefs_file) { global $BOINC_EMAIL; global $BOINC_MASTER_URL; $cmd = "../tools/add user -email_addr $BOINC_EMAIL -user_name David -web_password foobar -authenticator 3f7b90793a0175ad0bda68684e8bd136 "; if ($prefs_file) { PassThru("sed -e s/BOINC_MASTER_URL/$BOINC_MASTER_URL/ $prefs_file > prefs_temp.xml"); $cmd = $cmd." -prefs_file prefs_temp.xml"; } PassThru($cmd); } function add_prefs($file) { global $BOINC_EMAIL; PassThru("../tools/add prefs -email_addr $BOINC_EMAIL -prefs_file $file"); } function add_platform($platform) { global $BOINC_PLATFORM; if( $platform ) { PassThru("../tools/add platform -platform_name $platform"); } else { PassThru("../tools/add platform -platform_name $BOINC_PLATFORM"); } } function add_core_client_message($message, $priority, $platform) { global $BOINC_DOWNLOAD_DIR; global $BOINC_UPLOAD_DIR; global $BOINC_PLATFORM; global $BOINC_KEY_DIR; if( $platform == null ) { $plat = $BOINC_PLATFORM; } else { $plat = $platform; } PassThru("../tools/add app -app_name core_client -version ".VERSION); $cmd = "../tools/add app_version -app_name core_client -platform_name $plat -version ".VERSION." -download_dir $BOINC_DOWNLOAD_DIR -download_url $BOINC_DOWNLOAD_URL -message '$message' -message_priority '$priority' -code_sign_keyfile $BOINC_KEY_DIR/code_sign_private -exec_dir ../client -exec_files ".CORE_CLIENT; //echo "$cmd\n"; PassThru($cmd); PassThru("cp ../client/".CORE_CLIENT." $BOINC_DOWNLOAD_DIR"); } function add_core_client($platform) { add_core_client_message("", "", $platform); } function add_app($name, $platform, $exec_name) { PassThru("../tools/add app -app_name $name -version ".VERSION); add_app_version( $name, $platform, $exec_name ); } function add_app_version($name, $platform, $exec_name) { global $BOINC_DOWNLOAD_DIR; global $BOINC_PLATFORM; global $BOINC_DOWNLOAD_URL; global $BOINC_KEY_DIR; if( $exec_name == null ) { $exec_name = $name; } if( $platform == null ) { $plat = $BOINC_PLATFORM; } else { $plat = $platform; } $cmd = "../tools/add app_version -app_name $name -platform_name $plat -version ".VERSION." -download_dir $BOINC_DOWNLOAD_DIR -download_url $BOINC_DOWNLOAD_URL -code_sign_keyfile $BOINC_KEY_DIR/code_sign_private -exec_dir ../apps -exec_files $exec_name"; //echo "$cmd\n"; PassThru($cmd); PassThru("cp ../apps/$exec_name $BOINC_DOWNLOAD_DIR"); } function create_work($x) { global $BOINC_KEY_DIR; PassThru("../tools/create_work -keyfile $BOINC_KEY_DIR/upload_private $x"); } function create_keys() { global $BOINC_KEY_DIR; PassThru("../lib/crypt_prog -genkey 1024 $BOINC_KEY_DIR/upload_private $BOINC_KEY_DIR/upload_public"); PassThru("../lib/crypt_prog -genkey 1024 $BOINC_KEY_DIR/code_sign_private $BOINC_KEY_DIR/code_sign_public"); } function run_client($args) { PassThru("../client/".CORE_CLIENT." $args"); } function start_feeder() { PassThru("cd ../sched; feeder -asynch > feeder_out"); } function stop_feeder() { $f = fopen("../sched/feeder_trigger", "w"); fputs($f, "\n"); fclose($f); } function compare_file($out, $correct) { global $BOINC_UPLOAD_DIR; PassThru("diff $BOINC_UPLOAD_DIR/$out $correct", $retval); if ($retval) { echo "File mismatch: $out $correct\n"; } else { echo "Files match: $out $correct\n"; } } function check_results_done() { db_init(); $result = mysql_query("select * from result where state<>4"); while ($x = mysql_fetch_object($result)) { echo "result $x->id is not done\n"; } } function num_wus_left() { db_init(); $numwus = mysql_query("select count(*) as nres from result where state<>4"); $result = mysql_fetch_object($numwus); return $result->nres; } function compare_files($out, $correct) { PassThru("diff $out $correct", $retval); if ($retval) { echo "File mismatch: $out $correct\n"; } else { echo "Files match: $out $correct\n"; } } function run_api_test() { PassThru("../api/api_test"); } function clean_api() { PassThru("rm -f counter app_to_core.xml core_to_app.xml foobar"); } function get_time($file_name) { $time_file = fopen($file_name, "r"); if($time_file == NULL) return 0; fscanf($time_file, "%f", $app_time); PassThru("rm -f ".$file_name); return $app_time; } function compare_time($app_time) { $epsilon = 0.0001; db_init(); $data = mysql_query("select cpu_time from result where name = 'uccpu_wu_0'"); $result = mysql_fetch_object($data); $db_time = $result->cpu_time; $client_time = get_time("client_time"); if(abs($app_time - $client_time) > $epsilon) { printf("Time mismatch: app %f client %f\n", $app_time, $client_time); } else { printf("Client time %f matches app time %f\n", $client_time, $app_time) ; } if(abs($db_time - $app_time) > $epsilon) { printf("Time mismatch: client %f server %f\n", $client_time, $db_time); } else { printf("Reported time %f matches client time %f\n", $db_time, $client_time); } PassThru("rm -f client_time app_time"); } ?>