#!/usr/local/bin/php -q <?php // $Id$ // tests whether command-line arg passing works include_once "test.inc"; test_msg("standard concat application"); $project = new Project(); $project->add_core_and_version(); $project->add_app_and_version("concat"); $user = new User(); $host = new Host($user); $project->add_user($user); $project->install(); // must install projects before adding to hosts $project->install_feeder(); $host->add_user($user, $project); $host->install(); $work = new Work($app); $work->wu_template = "concat_wu"; $work->result_template = "concat_result"; $work->redundancy = 2; array_push($work->input_files, "input"); array_push($work->input_files, "input"); $work->install($project); $project->start_servers(); $host->run("-exit_when_idle -skip_cpu_benchmarks"); $project->stop(); $result->server_state = RESULT_SERVER_STATE_OVER; $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");
/** * 更新資料 * * 如果有設定ID,則會進行更新(update),否則會進行新增(insert) * @return Generic_object */ public function update() { $pk = self::_get_pk($this->primary_key, $this->table_name); $id = $this->get_id(); $table_name = $this->table_name; if (FALSE === isset($id)) { $this->loaded = FALSE; } $data = self::_get_table_data($this->database_fields, $this->table_fields); $data = $this->_pre_update($data); if (count($data) > 0) { if (FALSE === $this->loaded) { $data = $this->_pre_insert($data); #假設這是一個新項目 if (self::_has_unique_restriction($this->unique_restriction) && (FALSE === self::_check_unique($this) or FALSE === self::_check_not_null($data, $this->not_null_field))) { test_msg('約束沒過 [' . get_class($this) . '] (_check_unique=' . self::_check_unique($this) . '; _check_not_null=' . self::_check_not_null($data, $this->not_null_field) . ')', $data); return $this; } $this->_do_insert($data, $table_name); $select_last_insert_data = $this->_filter_except_bind_fields($data); //然後取得新增的ID $query = $this->db->select_max($pk, 'count')->where($select_last_insert_data)->get($table_name); if ($query->num_rows() > 0) { $result = $query->row_array(); //$query->first_row('array', 0); $proposed_id = $result['count']; if ($proposed_id > 0) { $this->loaded = TRUE; $this->id = $proposed_id; } $this->_post_insert(); if ($this->use_cache) { $cache_cond = $this->_get_cache_cond(); set_cache($this, $cache_cond); } } } else { #更新原有項目 $this->_do_update($data, $table_name, $pk, $id); } //補齊原本資料中尚未擁有的資料 foreach ($this->table_fields as $field) { if (FALSE === isset($this->database_fields[$field])) { $this->reload(); break; } } } //if (count($data) > 0) $this->_post_update(); $this->deleted = FALSE; return $this; }
protected function _display_jsonp($object, $callback = NULL) { if (is_null($callback)) { return $object; } //test_msg($object['policy']['my_custom']); $json = kals_json_encode($object); $pos = stripos($callback, '='); // 取得 = 號的位置 //test_msg("_display_jsonp", gettype($callback)); if ($callback !== NULL && $callback !== "") { $callback_hash = $pos === false ? '' : substr($callback, $pos + 1); // 擷取 = 後面的字串 //echo "{$jsonp}({$json})"; // 輸出 $vars = array('callback_hash' => $callback_hash, 'json' => $json); send_js_header($this->output); } else { test_msg("_display_jsonp", "send_text_header"); $vars = array('callback_hash' => NULL, 'json' => $json); send_text_header($this->output); } $this->load->view($this->dir . 'display_jsonp', $vars); }
/** * 過濾CSS,把view的CSS處理掉 * @param String $path * @return String 過濾過的CSS檔案 */ private function _initialize_css($path) { $style = $this->load->view($this->dir . $path, NULL, TRUE); if (strpos($path, 'view/') !== FALSE) { $classname = $path; $classname = substr($classname, 0, -4); $classname = preg_replace('/[\\W|\\_]/', "-", $classname); /* $class_array1 = explode('}', $classname); foreach ($class_array1 AS $c_ary1) { $class_ary2 = explode('{', $c_ary1); if (count($class_ary2) > 0) { $selectors_list = $class_ary2[0]; } else { $selectors_list = $c_ary1; } $selectors = explode(',', $selectors_list); } */ $classname = strtolower($classname); $classname = '.kals-view.' . $classname . ' '; //test_msg($classname); // 如果是樣板的話 //preg_replace($style, $path, $style); //$style = preg_replace('/[\}|\,]*[\{|\,]/', "" .$classname+"\$0", $style); $parts = explode('}', $style); foreach ($parts as &$part) { if (empty($part) || strlen($part) === 0 || strpos($part, '{') === FALSE) { continue; } $part = trim($part); if (substr($part, 0, 1) == '@') { $media_parts = explode('{', $part); foreach ($media_parts as $media_index => $media_part) { $media_part = trim($media_part); if ($media_index > 0 && $media_index < count($media_parts) - 1 && substr($media_part, 0, 1) != '@') { $media_part = $classname . $media_part; $media_part = trim($media_part); } $media_parts[$media_index] = $media_part; } $part = implode("{", $media_parts); $part = trim($part); } $subParts = explode(',', $part); foreach ($subParts as &$subPart) { $subPart = trim($subPart); if (substr($part, 0, 1) != '@') { $subPart = $classname . ' ' . $subPart; $subPart = trim($subPart); } } $part = implode(', ', $subParts); $part = trim($part); } $style = implode("}\n", $parts); $style = trim($style); $style = str_replace(' ', ' ', $style); //if ($style != '') { // $style = $classname . $style; //} test_msg($style); } return $style; }
#!/usr/local/bin/php -q <?php // $Id$ // This tests whether upload resuming works correctly. $use_proxy_cgi = 1; include_once "test_uc.inc"; test_msg("upload resumes"); $project = new ProjectUC(); // TODO // start_proxy('exit 1 if ($nconnections ==1 && $bytes_transferred==ZZZ); if_done_kill(); if_done_ping();'); $project->start_servers_and_host(); $project->validate_all_and_stop(); test_done();
#!/usr/local/bin/php -q <?php // $Id$ // This tests whether the client handles multiple projects, // and whether CPU time is divided correctly between projects // The client should do work for project 2 5 times faster // than for project 1 include_once "test.inc"; test_msg("multiple projects with resource share"); $project1 = new Project(); $project2 = new Project(); $user = new User(); $host = new Host($user); $project1->add_core_and_version(); $project1->add_app_and_version("upper_case"); $project2->add_core_and_version(); $project2->add_app_and_version("upper_case"); $work = new Work(); $work->wu_template = "uc_wu"; $work->result_template = "uc_result"; $work->redundancy = 5; $work->delay_bound = 60; array_push($work->input_files, "input"); $project1->resource_share = 1; $project1->shmem_key = "0x12344321"; $project1->short_name = "Project1"; $project1->long_name = "Project1"; $project1->add_user($user); $project1->install(); // must install projects before adding to hosts $project1->install_feeder();
#!/usr/local/bin/php -q <?php // This tests whether the result abort mechanism is working include_once "test.inc"; test_msg("result abort mechanism (disk space limit)"); $project = new Project(); $project->add_app_and_version("upper_case"); $user = new User(); $project->add_user($user); $project->install(); // must install projects before adding to hosts $project->install_feeder(); $host = new Host(); $host->add_user($user, $project); $host->install(); $work = new Work(); $work->wu_template = "uc_wu"; $work->result_template = "abort_result"; $work->redundancy = 2; array_push($work->input_files, "input"); $work->install($project); $project->start_servers(); $host->run("-exit_when_idle -skip_cpu_benchmarks -sched_retry_delay_min 1 >& /dev/null"); $project->validate(2); $result->server_state = RESULT_SERVER_STATE_OVER; $project->check_results(2, $result); $project->assimilate(); $project->file_delete(); $project->stop(); test_done();
/** * Action範例 * * @param Array $data 由KALS_controller傳入的資料,組成是關連式的陣列 * * [Controller的JSON格式] * _data = { * "field": "value" * }; * * //取用範例 * _data["field]; //回傳value * * [Model的Array格式] * $data = array( * "field" => "value" * ); * * $data["field"]; //回傳value * * @return Array 要回傳給KALS_controller的資料 * 一樣是以關聯式陣列組成 * 取得各階級的USER 名單 */ public function get_stamps_list($stamps) { //$stamps = $stamps["stamps"]; //var_dump($stamps); //return array("test" => 1212); // ----------------------- // 取得現在的網頁ID, user_id $webpage = $this->get_current_webpage(); $webpage_id = $webpage->get_id(); //test_msg('web_id = ', $webpage_id); $user = $this->get_current_user(); $user_id = $user->get_id(); //return array("id"=>$webpage_id); //$webpage_id = 1573 //------------------------ //依條件查詢stamp_user_list $qualifier_tables = array(); $stamps_result = array(); foreach ($stamps as $stamp_index => $stamp) { $qualifier = $stamp["qualifier"]; //var_dump($qualifier); //show qualifer data //------------------------ // 查詢 foreach ($qualifier as $type => $rule) { //test_msg("key = ",$type); //test_msg("value = ",$rule); // type類型 if ($type === "topic_annotation_count") { //查詢的條件要全部都判斷出來! foreach ($rule as $rule_type => $rule_value) { // 取到最底層的count值 test_msg("rule_type = ", $rule_type); test_msg("rule_value =", $rule_value["count"]); $rule_count = $rule_value["count"]; //條件值取出後開始查詢 if ($rule_type === "_total") { $table = 'SELECT annotation.user_id FROM annotation JOIN webpage2annotation ON ( annotation.annotation_id = webpage2annotation.annotation_id ) JOIN type ON (annotation.annotation_type_id = type.type_id) WHERE webpage_id = ' . $webpage_id . ' AND annotation.topic_id IS NULL AND annotation.deleted = false GROUP BY annotation.user_id HAVING COUNT(annotation.annotation_id) >=' . $rule_count; } else { $table = "SELECT annotation.user_id\nFROM annotation JOIN webpage2annotation ON ( annotation.annotation_id = webpage2annotation.annotation_id ) JOIN type ON (annotation.annotation_type_id = type.type_id)\nWHERE webpage_id = '{$webpage_id}' AND annotation.topic_id IS NULL AND annotation.deleted = false AND type.name = '{$rule_type}'\n GROUP BY annotation.user_id\nHAVING COUNT(annotation.annotation_id) >='{$rule_count}'"; } //把查出來的表(array)塞到另一個arry中 array_push($qualifier_tables, $table); } } else { if ($type === "respond_annotation_count") { //同topic,查詢的條件要全部取出 foreach ($rule as $rule_type => $rule_value) { // 取到最底層的count值 test_msg("rule_type = ", $rule_type); test_msg("rule_value =", $rule_value["count"]); $rule_count = $rule_value["count"]; //取出條件後開始進行查詢 $table = "SELECT annotation.user_id\nFROM annotation JOIN webpage2annotation ON ( annotation.annotation_id = webpage2annotation.annotation_id ) JOIN type ON (annotation.annotation_type_id = type.type_id)\nWHERE webpage_id = '{$webpage_id}'\nAND annotation.topic_id IS NOT NULL \nAND annotation.deleted = false \nAND type.name = '{$rule_type}'\nGROUP BY annotation.user_id\nHAVING COUNT(annotation.annotation_id) >='{$rule_count}'"; //把查出來的表(array)塞到另一個arry中 array_push($qualifier_tables, $table); } //foreach ($rule AS $rule_type => $rule_value ){ } else { if ($type === "respond_to_user_count") { $respond_to_user_count = $rule["count"]; $table = 'SELECT respond_to.user_id FROM user_respond_to_count AS respond_to JOIN webpage ON (webpage.webpage_id = respond_to.webpage_id) WHERE respond_to.webpage_id = ' . $webpage_id . ' AND respond_to.count >= ' . $respond_to_user_count; //test_msg("user_count =", $user_count ); array_push($qualifier_tables, $table); } else { if ($type === "responded_user_count") { $responded_user_count = $rule["count"]; //test_msg("responded_user_count =", $rule["count"] ); $table = 'SELECT responded.user_id FROM user_responded_count AS responded JOIN webpage ON (webpage.webpage_id = responded.webpage_id) WHERE responded.webpage_id = ' . $webpage_id . 'AND responded.count >= ' . $responded_user_count; array_push($qualifier_tables, $table); } else { if ($type === "liked_count") { $liked_count = $rule["count"]; $table = 'SELECT annotation.user_id FROM annotation JOIN annotation2like_count ON ( annotation.annotation_id = annotation2like_count.annotation_id) JOIN webpage2annotation ON (annotation.annotation_id = webpage2annotation.annotation_id) WHERE webpage_id = ' . $webpage_id . 'AND like_count >=' . $liked_count; array_push($qualifier_tables, $table); } else { if ($type === "like_count") { $like_count = $rule["count"]; $table = 'SELECT annotation2like.user_id FROM annotation2like JOIN webpage2annotation ON (annotation2like.annotation_id = webpage2annotation.annotation_id) WHERE webpage_id = ' . $webpage_id . ' AND annotation2like.canceled = false GROUP BY annotation2like.user_id HAVING count(user_id) >=' . $like_count; array_push($qualifier_tables, $table); } else { if ($type === "like_to_users_count") { $like_to_user_count = $rule["count"]; $table = 'SELECT like_to.me AS user_id FROM (SELECT DISTINCT user_like_to.me, user_like_to.like_to_user FROM user_like_to JOIN webpage2annotation ON (user_like_to.annotation_id = webpage2annotation.annotation_id) WHERE webpage_id = ' . $webpage_id . ' ORDER BY user_like_to.me) AS like_to GROUP BY like_to.me HAVING count(like_to.me) >=' . $like_to_user_count; array_push($qualifier_tables, $table); } else { if ($type === "liked_users_count") { $liked_user_count = $rule["count"]; $table = 'SELECT liked.me AS user_id FROM (SELECT DISTINCT user_liked.me, user_liked.liked_user FROM user_liked JOIN webpage2annotation ON (user_liked.annotation_id = webpage2annotation.annotation_id) WHERE webpage_id = ' . $webpage_id . ' ORDER BY user_liked.me) AS liked GROUP BY liked.me HAVING count(liked.me) >=' . $liked_user_count; array_push($qualifier_tables, $table); } else { if ($type === "annotation_count_ranking") { $annotation_count_rank = $rule["count"]; $table = 'SELECT user_id FROM user_annotation_count_ranking WHERE webpage_id = ' . $webpage_id . ' and rank <=' . $annotation_count_rank; array_push($qualifier_tables, $table); } } } } } } } } } //else if ($type === "annotation_count_rank"){ } //foreach ($qualifier AS $type => $rule){ // ----------------------------------------------------- // 把所有條件查好的表合併,找出都符合條件的user_id $this->db->select('user.user_id, user.name')->from("user"); //var_dump($qualifier_tables); //show qualifer data foreach ($qualifier_tables as $key => $table) { $cond = 'user.user_id = T' . $key . '.user_id'; $this->db->join('(' . $table . ' ) AS "T' . $key . '"', $cond); //test_msg("table = ",$cond); } $query = $this->db->get(); // var_dump($query); /*foreach ($query->result() as $row){ echo $row->user_id; echo '+'; echo $row->name; echo '||'; } */ //------------ //把資料塞進要回傳的ARRAY中 $user_name_list = array(); foreach ($query->result() as $key => $row) { $user_name_list[$key] = $row->name; } // 20141007 不顯示沒有名單的階級 if (count($user_name_list) === 0) { continue; } //$stamp_name = $stamp["name"]; //stamp name $stamps_result[] = array("stamp_index" => $stamp_index, "user_name_list" => $user_name_list); } //foreach ($stamps AS $stamp ) // 反轉陣列順序 $stamps_result = array_reverse($stamps_result); //20141015 將階級名單中重複的對象刪除 $stamps_result2 = array(); $added_user_list = array(); foreach ($stamps_result as $value) { //$stamp1_list $new_user_name_list = array(); $user_name_list = $value['user_name_list']; //$stamp_name = $value['stamp_name']; foreach ($user_name_list as $user_name) { //var_dump($username); if (in_array($user_name, $added_user_list) === FALSE) { $added_user_list[] = $user_name; $new_user_name_list[] = $user_name; //test_msg("user_name " . $user_name, $added_user_list); } } if (count($new_user_name_list) > 0) { //test_msg("new user name list", $new_user_name_list); $stamps_result2[] = array("stamp_index" => $value['stamp_index'], "user_name_list" => $new_user_name_list); //$stamp1_result2[$stamp_name]["stamp_name"] = $stamp_name; //$stamp1_result2[$stamp_name]["user_name_list"] = $new_user_name_list; } } //var_dump($stamp1_result2); //return array(); return $stamps_result2; }
function index() { $url = $this->url; $this->create_annotation(); $annotation = $this->annotation; //--------------------------------------- $webpage = $this->webpage->create($url); $langvar_coll = $webpage->get_langvar_coll(); $langvar_coll->set_annotation($annotation); $defuzzy_array = $langvar_coll->get_defuzzy_array(); $test_defuzzy_array = array(1 => 1.2, 2 => 1, 3 => 3, 4 => 3, 5 => 1, 6 => 2); for ($i = 1; $i < 4; $i++) { $this->unit->run($defuzzy_array[$i] . '', $test_defuzzy_array[$i] . '', 'langvar_coll,get_defuzzy_array(),測試第' . $i . '個'); } $matrix = $langvar_coll->get_membership_matrix(); $this->draw_table($matrix); test_msg($langvar_coll->get_weight_array()); $this->unit->run(count($matrix), 6, 'langvar_coll,get_membership_matrix(),count第一層'); $this->unit->run(count($matrix[0]), 3, 'langvar_coll,get_membership_matrix(),count第二層'); //---------------------------------- $this->unit->run($langvar_coll->get_inference_result()->get_membership_array(), array(0.24, 0.2, 0.15), 'Fuzzy_inference_engine get_inference_result()'); $this->unit->run($langvar_coll->get_integrated_score() . "", 1.84745762712 . "", 'Fuzzy_inference_engine get_integrated_score()'); //---------------------------------- $this->unit->run($annotation->get_consensus_count(), 2, '看一下標註是否有共識'); $langvar = $this->langvar; $langvar = $this->language_variable_consensus->find_langvar($url); $membership = $langvar->get_membership($annotation); $ms_array = $membership->get_membership_array(); $this->unit->run($ms_array, array(0.8, 0.2, 0), 'language_variable_consensus是否有取得到正確的membership?'); $this->unit->run($langvar->get_membership_array(), array(0.8, 0.2, 0), '再取得一次,language_variable_consensus是否有記錄membership?'); $this->unit->run($langvar->get_record(), 2, 'language_variable_consensus是否有正確set_record?'); $langvar->set_field('function_variables', '1,3,5'); $membership = $langvar->get_membership($annotation); $ms_array = $membership->get_membership_array(); $this->unit->run($ms_array, array(0.5, 0.5, 0), 'language_variable_consensus設定function_variables之後,是否有取得到正確的membership?'); //------------------------------------- $this->unit->run($annotation->get_like_count(), 2, '看一下標註喜愛是否如預期的'); $langvar = $this->language_variable_like->find_langvar($url); $this->unit->run($langvar->get_membership_array($annotation), array(1, 0, 0), 'language_variable_like,是否有取得到正確的membership?'); //-------------------------------- $this->unit->run($annotation->get_type()->get_type_id(), 1, '看一下標註類型是否如預期的'); $langvar = $this->language_variable_type->find_langvar($url); $this->unit->run($langvar->get_membership_array($annotation), array(0, 0, 1), 'language_variable_type,是否有取得到正確的membership?'); //-------------------------------- $this->unit->run($annotation->get_scopes()->get_anchor_speech(), 'is_array', '看一下標註範圍詞性是否為陣列'); $langvar = $this->language_variable_speech->find_langvar($url); $this->unit->run($langvar->get_membership_array($annotation), array(0, 0, 1), 'language_variable_speech,是否有取得到正確的membership?'); //-------------------------------- $this->unit->run($annotation->get_scopes()->get_scope_length(), 33, '看一下標註範圍長度是否符合預期'); $langvar = $this->language_variable_length->find_langvar($url); $this->unit->run($langvar->get_membership_array($annotation), array(1, 0, 0), 'language_variable_length,是否有取得到正確的membership?'); //-------------------------------- $this->unit->run($annotation->get_feature(1)->get_value(), NULL, '看一下標註特徵位置是否符合預期'); $langvar = $this->language_variable_location->find_langvar($url); $this->unit->run($langvar->get_membership_array($annotation), array(1, 0, 0), 'language_variable_location,是否有取得到正確的membership?'); $annotation->set_feature(1, 1); $this->unit->run($langvar->get_membership_array($annotation), array(0, 1, 0), 'language_variable_location,重新設定featrue為1,是否有取得到正確的membership?'); // $this->unit->run($test_result // , $expected_result // , $test_name); //context_complete(); unit_test_report($this, __METHOD__); }
#!/usr/local/bin/php -q <?php // $Id$ // This tests whether the most basic mechanisms are working // Also whether stderr output is reported correctly // Also tests if water levels are working correctly include_once "test_uc.inc"; test_msg("standard upper_case application"); $project = new ProjectUC(); $project->start_servers_and_host(); $project->validate_all_and_stop(); test_done();
/** * 更新前動作 * @abstract 將更新的資料插入$type_id跟$name。 * 注意:子類別覆寫時請務必引用此方法。 * @param array $data 原本要更新的資料 * @return array 更新後的資料 */ protected function _pre_update($data) { if (isset($this->type_field) && FALSE === isset($data[$this->type_field])) { $type_id = $this->get_type_id(); if (is_class($this, 'Annotation_like')) { test_msg('Generic_attribute_object::_pre_update() ', $type_id . '?'); } if (isset($type_id)) { $data[$this->type_field] = $type_id; $this->set_field($this->type_field, $type_id); } } if (isset($this->name_field) && FALSE === isset($data[$this->name_field])) { $name = $this->get_name(); $data[$this->name_field] = $name; $this->set_field($this->name_field, $name); } return $data; }
#!/usr/local/bin/php -q <?php // $Id$ // test whether the scheduling server filters out work units too big for // client include_once "test.inc"; test_msg("resource filtering for large work units"); $project = new Project(); $user = new User(); $host = new Host($user); $project->add_app_and_version("upper_case"); $project->add_user($user); $project->install(); // must install projects before adding to hosts $project->install_feeder(); $host->add_user($user, $project); $host->install(); $work = new Work($app); $work->wu_template = "uc_wu"; $work->result_template = "uc_result"; $work->redundancy = 1; $work->rsc_disk = 1000000000000; // 1 TB $work->rsc_fpops = 0; array_push($work->input_files, "input"); $work->install($project); $project->start_servers(); $host->run("-exit_when_idle -skip_cpu_benchmarks"); $project->stop(); $result->server_state = RESULT_SERVER_STATE_UNSENT; $project->check_results(1, $result);
/** * 顯示偵錯訊息 * @param String $header * @param Object $message * @return \KALS_model */ protected function debug($header, $message) { if ($this->enable_debug === TRUE) { test_msg($header, $message); } return $this; }
#!/usr/local/bin/php -q <?php // $Id$ // End to end test. Tests make_work, feeder, scheduling server, client, // file_upload_handler, validator, assimilator, timeout_check, and // file_deleter on a large batch of workunits. Confirms that credit // is correctly granted and that unneeded files are deleted include_once "test.inc"; test_msg("backend"); $project = new Project(); $user = new User(); $host = new Host($user); $app = new App("upper_case"); $app_version = new App_Version($app); $work = new Work($app); $work->wu_template = "uc_wu"; $work->result_template = "uc_result"; $work->redundancy = 5; $work->delay_bound = 70; array_push($work->input_files, "input"); $project->add_user($user); $project->add_app($app); $project->add_app_version($app_version); $project->install(); // must install projects before adding to hosts $project->install_make_work($work, 499, 5); $host->log_flags = "log_flags.xml"; $host->add_user($user, $project); $host->install(); $work->install($project); $project->start_servers();
/** * @return Scope_anchor_text */ public function get_anchor_text() { if (is_null($this->anchor_text)) { $anchor_text_id = $this->get_field('anchor_text_id'); if (NULL != $anchor_text_id) { $this->_CI_load('library', 'scope/Scope_anchor_text', 'scope_anchor_text'); $this->anchor_text = new Scope_anchor_text($anchor_text_id); } else { test_msg('沒有$anchor_text_id到底是?', $this->database_fields); } } return $this->anchor_text; }
#!/usr/local/bin/php -q <?php // $Id$ $use_proxy_cgi = 1; include_once "test_uc.inc"; test_msg("upload backoff"); start_proxy('print "#$nconnections url=$url time=$time\\n"; exit 1 if ($nconnections < 4); if_done_kill(); if_done_ping();'); $project = new ProjectUC(); // $pid = $host->run_asynch("-exit_when_idle"); $project->start_servers_and_host(); $project->validate_all_and_stop(); test_done();
#!/usr/local/bin/php -q <?php // $Id$ include_once "test.inc"; test_msg("client checkpoint/restart mechanism"); $project = new Project(); $user = new User(); $host = new Host(); $project->add_user($user); $project->add_app_and_version("upper_case"); $project->install(); // must install projects before adding to hosts $host->add_user($user, $project); $host->install(); $work = new Work(); $work->wu_template = "ucs_wu"; $work->result_template = "uc_result"; array_push($work->input_files, "small_input"); $work->install($project); $project->install_feeder(); $project->start_servers(); verbose_echo(0, "Now run the client manually; start and stop it a few times"); //compare_file("ucs_wu_0_0", "uc_small_correct_output");
#!/usr/local/bin/php -q <?php // $Id$ $use_proxy_html = 1; include_once "test_uc.inc"; test_msg("master url failure"); $project = new ProjectUC(); start_proxy('exit 1 if $nconnections < 4; if_done_kill(); if_done_ping();'); // TODO: verify it took ??? seconds // TODO: time out after ??? seconds and fail this test $project->start_servers_and_host(); $project->validate_all_and_stop(); test_done();
#!/usr/local/bin/php -q <?php // $Id$ include_once "test.inc"; test_msg("sticky file mechanism"); $project = new Project(); $user = new User(); $host = new Host($user); $project->add_user($user); $project->add_app_and_version("upper_case"); $project->install(); // must install projects before adding to hosts $project->install_feeder(); $host->add_user($user, $project); $host->install(); $work = new Work($app); $work->wu_template = "uc_wu_sticky"; $work->result_template = "uc_result_sticky"; $work->redundancy = 2; array_push($work->input_files, "input"); $work->install($project); $project->start_servers(); $host->run("-exit_when_idle -skip_cpu_benchmarks"); $project->stop(); $result->server_state = RESULT_SERVER_STATE_OVER; $project->check_results(2, $result); $project->compare_file("uc_wu_sticky_0_0", "uc_correct_output"); $project->compare_file("uc_wu_sticky_1_0", "uc_correct_output"); // make sure result files are still there $host->check_file_present($project, "uc_wu_sticky_0_0"); $host->check_file_present($project, "uc_wu_sticky_1_0");