How to use run method of internal_run class

Best Phoronix-test-suite code snippet using internal_run.run

TSunic.class.php

Source:TSunic.class.php Github

copy

Full Screen

...36 /** Reference of Log object37 * @var Log $Log38 */39 public $Log = NULL;40 /** Is current run called internally?41 *42 * @var bool $internal_run43 */44 protected $internal_run;45 /** Constructor46 *47 * This method will create the environment for TSunic48 */49 public function __construct () {50 // set global reference to this object51 global $TSunic;52 $TSunic = $this;53 // create factory object54 $this->Factory = new $$$Factory();55 // create stats object56 $this->Stats = $this->get('$$$Stats');57 // create setting object58 $this->Config = $this->get('$$$Config');59 // create database object60 $this->Db = $this->get('$$$Database');61 // create session object (this starts session)62 $readonlysession = ($this->getRunningMode() == 'index') ? false : true;63 $this->Session = $this->get('$$$Session', array($this->Db, $readonlysession));64 // create Input object65 $this->Input = $this->get('$$$Input');66 // create Log object67 $this->Log = $this->get('$$$Log', $this->Config->get('loglevel'));68 // start template engine69 $this->Tmpl = $this->get('$$$TemplateEngine');70 // create user object71 $this->verifyUser();72 return;73 }74 /** Handle some event75 *76 * Call this function to make TSunic do some job. This method will search77 * for the requested module and function and run it providing the given78 * parameters79 *80 * @param string $event81 * If running internally, enter the event here82 * @param array|string $parameters83 * Parameters for event function (internal-run only!)84 *85 * @return bool|mix86 */87 public function run ($event = NULL, $parameters = NULL) {88 $this->internal_run = false;89 // is internal run?90 if (!empty($event)) {91 // internal92 $this->internal_run = true;93 // get parameter-string94 $parameter_string = '';95 if (!($parameters === false)) {96 // put values in array97 if (!is_array($parameters)) $parameters = array($parameters);98 // create parameter-string for function99 foreach ($parameters as $index => $value) {100 // use nowdoc to define string (TRICKY!)101 $parameters[$index] = '<<<\'EOD\''.chr(10).$value.chr(10).'EOD'.chr(10);102 }103 $parameter_string = implode(',', $parameters);104 }105 } else {106 // external107 // delete old activated templates108 $this->Tmpl->clearActivatedTemplates();109 // redirect, if back-link110 if ($this->isIndex() AND isset($_GET['back'])) $this->redirect('this');111 // get event112 $event = $this->Input->get('event');113 if (empty($event)) {114 if ($this->isAjax()) return false;115 $this->redirect('default');116 exit;117 }118 }119 $this->Log->log(6, "Run: $event");120 // get path and file-object121 $path = '#runtime#functions/'.$event.'.func.php';122 $File = $this->get('$$$File', array($path));123 // does file exists?124 if (!$File->isFile()) {125 // function doesn't exist126 if ($this->internal_run OR $this->isAjax()) return false;127 // page not found!128 $this->Log->alert('error', '{CLASS__TSUNIC__PAGE_NOT_FOUND}');129 $this->redirect('back');130 }131 // include function132 $File->includeFile();133 // run function134 if (!$this->internal_run OR empty($parameter_string)) {135 $return = $event();136 } else {137 $to_eval = '$return = '.$event.'('.$parameter_string.');';138 try {139 @eval($to_eval);140 } catch (Exception $e) {141 // invalid function142 $this->throwError(143 'Fatale error: Requested function is invalid! ('.144 $this->Input->get('event').')'145 );146 }147 }148 if (!$this->internal_run OR $return === NULL) return true;149 return $return;150 }151 /** Get instance of some class.152 *153 * This method is will call the Factory object to get a new object of154 * some class. You can specify, if you want to force the creation of a new155 * object or if it is ok for you, to reuse an existing one (default)156 *157 * @param string $class158 * Class of requested object159 * @param array $values160 * Parameters to hand to the objects constructor161 * @param bool $forceNew162 * Force object to be a new one163 *164 * @return object165 */166 public function get ($class, $values = array(), $forceNew = false) {167 return $this->Factory->get($class, $values, $forceNew);168 }169 /** Display output of TSunic170 *171 * Call this function to display the output of TSunic.172 * If you call this function from an ajax request, it will return xml output173 *174 * @param string $template175 * Request output of certain template only176 *177 * @return bool178 */179 public function display ($template = false) {180 // validate template181 if (empty($template)) {182 $template = $this->Input->get('tmpl');183 // is tmpl?184 if (empty($template)) $template = '$$$html';185 }186 // display templates187 if (!$this->isAjax()) {188 $this->Tmpl->display($template);189 } else {190 $this->Tmpl->responseAjax();191 }192 return true;193 }194 /** Verify login of user195 *196 * This function verifies that the user is logged in. If this check fails197 * and the user requests an event that is not permitted it redirects to the198 * login page199 *200 * @return bool201 */202 private function verifyUser () {203 // get pages, a guest has access to204 // NO GOOD CODING - will be replaced, when Access-System is included...205 $allowed_pages = array('$$$showIndex',206 '$usersystem$showIndex',207 '$usersystem$doLogin',208 '$usersystem$doRegister',209 '$usersystem$showLogin',210 '$usersystem$showRegistration',211 '$$$resetAllCookies',212 '$$$disableJavascript',213 '$$$enableJavascript',214 '$$$autoenableJavascript',215 '$$$showSysteminfo',216 '',217 '$$$setLanguage',218 '$help$showHelp',219 '$help$showMain');220 // get user221 $this->Usr = $this->get('$usersystem$User');222 // is allowed to access current page?223 if (224 $this->isIndex() and225 !$this->Usr->isLoggedIn() and226 !in_array($this->Input->get('event'), $allowed_pages)227 ) {228 $this->Log->alert('error', '{CLASS__TSUNIC__LOGINFIRST}');229 $this->redirect('$usersystem$showLogin');230 exit;231 }232 return true;233 }234 /** Check, if JavaScript is enabled235 *236 * Is JavaScript enabled for this user? This method will give you the237 * answer.238 *239 * @param bool $getDistinguishable240 * Return true, only if JavaScript has been disabled by the user241 * explicitely (false, if this has been detected automatically)242 *243 * @return bool244 */245 public function isJavascript ($getDistinguishable = false) {246 // get javascript-setting247 $value = $this->Usr->config('$$$javascript');248 // get return249 if ($getDistinguishable) {250 return $value;251 } else {252 if ($value == 'off' OR $value === false) return false;253 return true;254 }255 }256 /** Get name of file, who started TSunic request257 *258 * Possible values: index|ajax|javascript|file259 *260 * @return string261 */262 public function getRunningMode () {263 // get mode264 switch (basename($_SERVER['PHP_SELF'])) {265 case 'ajax.php':266 $output = 'ajax';267 break;268 case 'functions.js.php':269 $output = 'javascript';270 break;271 case 'file.php':272 $output = 'file';273 break;274 default:275 $output = 'index';276 }277 // change, if isset $_GET['tmpl']278 if (isset($_GET['tmpl'])) $output = 'template';279 return $output;280 }281 /** Is TSunic accessed via ajax?282 *283 * @return bool284 */285 public function isAjax () {286 return ($this->getRunningMode() == 'ajax') ? true : false;287 }288 /** Is TSunic accessed via index?289 *290 * @return bool291 */292 public function isIndex () {293 return ($this->getRunningMode() == 'index') ? true : false;294 }295 /** Is TSunic accessed via template?296 *297 * @return bool298 */299 public function isTemplate () {300 return ($this->getRunningMode() == 'template') ? true : false;301 }302 /** Get all installed modules303 *304 * Get a list of all installed modules305 *306 * @return array|bool307 */308 public function getModules () {309 if (!$this->Db) return array();310 // get all modules from database311 $sql = "SELECT id__module as id,312 name,313 author,314 description,315 version_installed,316 link317 FROM ".$this->Config->get('prefix')."modules318 WHERE is_activated = 1319 AND is_parsed = 1320 ORDER BY name ASC;";321 return $this->Db->doSelect($sql);322 }323 /** Display fatal error message and exit324 *325 * Use this function to throw an fatale exception and exit the the script326 *327 * @param string $message328 * The error message to be thrown329 */330 public function throwError ($message = 0) {331 // parse $message332 if ($message === 0) $message = 'Unknown error.';333 $message = str_replace('<', '&lt;', $message); // replace <334 $message = str_replace('>', '&gt;', $message); // replace >335 // log error336 $this->Log->log(1, "Fatal error: $message");337 // display error338 $output = '<h1>TSunic '.$this->Config->get('version').' - Fatal error!</h1>';339 $output.= '<p><strong>Error message:</strong><br />';340 $output.= $message;341 $output.= '</p><p>For more information please contact the webmaster of this page.</p>';342 $output.= '<p><a href="?">back to home</a></p>';343 // return/throw344 if ($this->isAjax()) {345 // add as error346 // TODO347 echo '<error>'.$output.'</error>';348 exit;349 } else {350 // delete session351 session_unset();352 // print353 echo $output;354 // end script355 exit;356 }357 }358 /** Redirect user359 *360 * Redirect user to another page (or event)361 *362 * @param string $event363 * Name of event to redirect to (use 'back' to redirect one event back, 364 * 'this' to redirect to the current event and 'default' to redirect to 365 * default start page)366 * @param bool|array|int $gets367 * GET parameters for redirect or number of events to go back368 *369 */370 public function redirect ($event, $gets = false) {371 // TODO: Prevent internal runs from redirecting372 // get loop373 $loop = $this->Input->get('loop');374 // get module and event375 if ($event === 'back') {376 // go back to page in history377 // get back-time378 $time = ($gets === false OR !is_numeric($gets)) ? 1 : $gets;379 // create link380 $link = '?back='.$time;381 } elseif ($event === 'default') {382 // set default-event383 $link = '?event=$$$showIndex';384 } elseif ($event === 'this') {385 // redirect to current page...

Full Screen

Full Screen

internal_run.php

Source:internal_run.php Github

copy

Full Screen

...14 GNU General Public License for more details.15 You should have received a copy of the GNU General Public License16 along with this program. If not, see <http://www.gnu.org/licenses/>.17*/18class internal_run implements pts_option_interface19{20 const doc_section = 'Batch Testing';21 const doc_description = 'This option and its arguments pre-set the Phoronix Test Suite batch run mode with sane values for carrying out benchmarks in a semi-automated manner and without uploading any of the result data to the public OpenBenchmarking.org.';22 public static function argument_checks()23 {24 return array(25 new pts_argument_check('VARIABLE_LENGTH', array('pts_types', 'identifier_to_object'), null)26 );27 }28 public static function run($r)29 {30 $test_run_manager = new pts_test_run_manager(array(31 'UploadResults' => false,32 'SaveResults' => true,33 'PromptForTestDescription' => true,34 'RunAllTestCombinations' => false,35 'PromptSaveName' => true,36 'PromptForTestIdentifier' => true,37 'OpenBrowser' => true38 ));39 $test_run_manager->standard_run($r);40 }41}42?>...

Full Screen

Full Screen

xml.php

Source:xml.php Github

copy

Full Screen

...8if( ! isset( $_GET['type'] ) || $_GET['type'] == 'events' ) {9 echo $xml;die();10}11$xml = simplexml_load_string( $xml );12$internal_run = time();13echo '<?xml version="1.0" encoding="UTF-8"?>';14echo '<event_datetimes>';15$events = $xml->xpath('//event');16if( count( $events ) > 0 ) {17 foreach( $events as $event ) {18 $datetimes = $event->xpath('datetimes/datetime');19 20 if( count( $datetimes ) > 0 ) {21 22 foreach( $datetimes as $datetime ) {23 24 echo '<event_datetime>';25 echo '<internal_run>'.$internal_run.'</internal_run>';26 27 $out = '<event_parent_guid>'.$event->guid.'</event_parent_guid>';28 $out .= '<date_start>'.$datetime->date_start.'</date_start>';29 $out .= '<time_start>'.$datetime->time_start.'</time_start>';30 $out .= '<date_end>'.$datetime->date_end.'</date_end>';31 $out .= '<time_end>'.$datetime->time_end.'</time_end>';32 $out .= '<is_allowed_after_start>'.$datetime->is_allowed_after_start.'</is_allowed_after_start>';33 34 echo $out;35 36 echo '<internal_hash>'.md5( $out ) .'</internal_hash>';37 echo '</event_datetime>';38 39 }...

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1$run = new internal_run();2$run->run();3$run = new internal_run();4$run->run();5$run = new internal_run();6$run->run();7$run = new internal_run();8$run->run();9$run = new internal_run();10$run->run();11$run = new internal_run();12$run->run();13$run = new internal_run();14$run->run();15$run = new internal_run();16$run->run();17$run = new internal_run();18$run->run();19$run = new internal_run();20$run->run();21$run = new internal_run();22$run->run();23$run = new internal_run();24$run->run();25$run = new internal_run();26$run->run();27$run = new internal_run();28$run->run();29$run = new internal_run();30$run->run();31$run = new internal_run();32$run->run();33$run = new internal_run();34$run->run();

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1$internal_run = new internal_run;2$internal_run->run();3$internal_run = new internal_run;4$internal_run->run();5$internal_run = new internal_run;6$internal_run->run();7require_once 'internal_run.php';8$internal_run = new internal_run;9$internal_run->run();10$internal_run = new internal_run;11$internal_run->run();12$internal_run = new internal_run;13$internal_run->run();

Full Screen

Full Screen

run

Using AI Code Generation

copy

Full Screen

1$run = new internal_run();2$run->run();3$run = new external_run();4$run->run();5$run = new internal_run();6$run->run();7$run = new external_run();8$run->run();9$run = new internal_run();10$run->run();11$run = new external_run();12$run->run();13$run = new internal_run();14$run->run();15$run = new external_run();16$run->run();17$run = new internal_run();18$run->run();19$run = new external_run();20$run->run();21$run = new internal_run();22$run->run();23$run = new external_run();24$run->run();25$run = new internal_run();26$run->run();27$run = new external_run();28$run->run();29$run = new internal_run();30$run->run();31$run = new external_run();32$run->run();33$run = new internal_run();34$run->run();

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Phoronix-test-suite automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in internal_run

Trigger run code on LambdaTest Cloud Grid

Execute automation tests with run on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful