From: Sebastien D. <sde...@us...> - 2005-01-03 14:23:06
|
Update of /cvsroot/tslogparser/tslogparser/admin In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25792/admin Modified Files: index.php modules.inc.php Log Message: Updated HISTORY, database, and opts module is able to parse a testsuite directory Index: modules.inc.php =================================================================== RCS file: /cvsroot/tslogparser/tslogparser/admin/modules.inc.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- modules.inc.php 31 Dec 2004 15:13:12 -0000 1.1 +++ modules.inc.php 3 Jan 2005 14:22:56 -0000 1.2 @@ -20,10 +20,10 @@ A module consists in four functions closely related to a testsuite model ("type"). These functions are: - int TS_parse(string TS_name, string TS_description, string TS_path); - int TS_delete(int TS_id); - int RUN_parse(string RUN_name, string RUN_description, int TS_id, string CONTENT); - int RUN_delete(int RUN_id); + int TS_parse(ref parent, string TS_name, string TS_description, string TS_path); + int TS_delete(ref parent, int TS_id); + int RUN_parse(ref parent, string RUN_name, string RUN_description, int TS_id, string CONTENT); + int RUN_delete(ref parent, int RUN_id); An additionnal function is added for informational purpose (no functionnal need) string module_info(void) @@ -50,6 +50,9 @@ Then it removes it from the database. The return value is $true if success and $false otherwise. + All 4 previous functions have a 'parent' pointer to the testsuite class. This is + used for error reporting directly into the parent's 'last_error' property. + module_info will return an HTML-formated text (enclosed in <p> and </p> tags) describing the module and the testsuite it supports. All information related to the module (version, known bugs, ...) are suitable @@ -79,6 +82,7 @@ var $modules_catalog; var $selected_module; var $last_error=""; + var $debug=2; /* Class constructor: initializes the modules catalog and the default selected */ function testsuite($default_catalog="") @@ -179,6 +183,38 @@ array($this->selected_module, 'TS_parse'), array(&$this, $TS_name, $TS_description, $path)); } + function TS_delete($TS_ID) + { + /* Check the environment is correct */ + if ($this->selected_module == "") + { + die("No selected module"); + } + if (!is_callable(array($this->selected_module,'TS_delete'))) + { + die("Module ".$this->selected_module." is malformed.\n"); + } + /* Call actually the module method */ + return call_user_func_array( + array($this->selected_module, 'TS_delete'), + array(&$this, $TS_ID)); + } + function RUN_parse($RUN_name, $RUN_description, $TS_id, &$CONTENT) + { + /* Check the environment is correct */ + if ($this->selected_module == "") + { + die("No selected module"); + } + if (!is_callable(array($this->selected_module,'RUN_parse'))) + { + die("Module ".$this->selected_module." is malformed.\n"); + } + /* Call actually the module method */ + return call_user_func_array( + array($this->selected_module, 'RUN_parse'), + array(&$this, $RUN_name, $RUN_description, $TS_id, $CONTENT)); + } } Index: index.php =================================================================== RCS file: /cvsroot/tslogparser/tslogparser/admin/index.php,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- index.php 31 Dec 2004 15:13:12 -0000 1.1 +++ index.php 3 Jan 2005 14:22:56 -0000 1.2 @@ -44,12 +44,39 @@ and can provide additional information on any module */ + + + +/******************************************** + Testing the functions +********************************************/ echo "<pre>\n"; + +/* +$tmp = $tslp->TS_delete(13); +if ($tmp == false) +{ + echo "Erreur: <b>".$tslp->last_error."</b>\n"; +} + + $tmp = $tslp->TS_parse("pts1.5.0", "Release officielle 1.5.0", "/home/thedoc/travail/CVS-sf.net/posixtestsuite"); if ($tmp == false) { echo "Erreur: <b>".$tslp->last_error."</b>\n"; } +*/ + +$DATA=file_get_contents("/home/thedoc/travail/CVS-sf.net/posixtestsuite/logfile") or die("failed to read file"); + +$tmp = $tslp->RUN_parse("test_run", "Run de test", $DATA); +if ($tmp == false) +{ + echo "Erreur: <b>".$tslp->last_error."</b>\n"; +} + + + echo "</pre>\n"; ?> \ No newline at end of file |