From da276e3f3627746db06b63e678d45740e833648e Mon Sep 17 00:00:00 2001 From: Triatmoko Date: Wed, 16 Nov 2011 21:45:25 +0100 Subject: bug on smart test --- Under-Testing/Server-Code-New/gsmselftest.py | 11 +- Under-Testing/Website/index.php~ | 22 -- Under-Testing/Website/mutexSmartTest.php | 355 ++++++++++++++------------- Under-Testing/Website/mutexTry.php | 198 ++++++++------- 4 files changed, 285 insertions(+), 301 deletions(-) delete mode 100644 Under-Testing/Website/index.php~ diff --git a/Under-Testing/Server-Code-New/gsmselftest.py b/Under-Testing/Server-Code-New/gsmselftest.py index c073b7a..2bfe7be 100644 --- a/Under-Testing/Server-Code-New/gsmselftest.py +++ b/Under-Testing/Server-Code-New/gsmselftest.py @@ -286,10 +286,15 @@ def smartTest(): caller = dest[0] # to test nanobts if the test come from RZ GSM but fehler if caller[0:5] == 'GSMRZ' and int(dest[3]) != 2 and dest[1] != 'sip': + repeatTest = True + for test in smartResultList: + if test[1] == caller or test[0] == caller: + repeatTest = False if int(dest[2]) == 486 or int(dest[2]) == 402: - callFrom = 'sip' - testDest(callFrom, dest[0], 2) - rem.append(dest) + if repeatTest = True: + callFrom = 'sip' + testDest(callFrom, dest[0], 2) + rem.append(dest) # test to make sure nanoBTS working or not. sice probably that nanotbts seems error but actually not. for RZ in cpgsmRZList: diff --git a/Under-Testing/Website/index.php~ b/Under-Testing/Website/index.php~ deleted file mode 100644 index 3d534e6..0000000 --- a/Under-Testing/Website/index.php~ +++ /dev/null @@ -1,22 +0,0 @@ -test software -

What Kind of Test do you want??

- -
- - All Tests
- GSM Side
- SIP Side
- SIP to GSM RZ1
- SIP to GSM RZ2
- SIP to GSM RZ3
- SIP to Landline
- SIP to SIP University Phone line
- GSM RZ 1 to SIP
- GSM RZ 2 to SIP
- GSM RZ 3 to SIP
- GSM RZ 1 to GSM RZ 2
- GSM RZ 1 to GSM RZ 3
- GSM RZ 2 to GSM RZ 3
-
- -
diff --git a/Under-Testing/Website/mutexSmartTest.php b/Under-Testing/Website/mutexSmartTest.php index 3abb5ff..d5fe146 100644 --- a/Under-Testing/Website/mutexSmartTest.php +++ b/Under-Testing/Website/mutexSmartTest.php @@ -1,15 +1,18 @@ + Network test live results! +
+ Server-Code -startSoftware.py'); - printf(' - python startSoftware.py'); - } - else - { - socket_set_timeout( $startApp, 50); //one should set the number of the longest test, so we can define the timeout - fwrite($startApp, "START APP"); - usleep(2500); - fclose($startApp); - } - - sleep(6); //sleep till the software starts - - //the software should be running already and set the lock, now we test it and then connect to it! - $softwareRunning1 = isLocked($softwareLock); #gsmselftest.py - if($softwareRunning1 == '0') //Software running and waiting for connection! - { - //try to open the socket and connect to the software - $fp = fsockopen($ip, $port, $errno, $error, 5); - if (!$fp) - { - echo 'Could not open the socket or connect to the testing software! Check ports on both sides!'; - - } - else - { - socket_set_timeout($fp,50); //one should set the number of the longest test, so we can define the timeout function (it is the number after "$fp,") - fwrite($fp, "SMART TEST"); - - //fwrite($fp, "SMART TEST"); //send command to start the tests - if(!feof($fp)) - { - while(!feof($fp)) - { - $received = fgets($fp, 128); //receive data! - - if ($received == "CONFIRM\n") //we got the confirmation from the testing software - { - //test finished successfully + if($taskAmount != 0 or $taskAmount == 'ON') + { + #try to lock the startSoftware + $StartSoftware = isLocked($softwareLock); + if($StartSoftware == '1') //1 means software is not started yet, start it + { + //trying connect to startsoftware + $startApp = fsockopen($ip, 34600, $errno, $error, 5); + if (!$startApp) + { + printf('THE SOFTWARE THAT SHOULD RUN IN BACKGROUND IS NOT RUNNING!'); + printf('Solution: - You need to start the script which always running background (startSoftware.py)'); + printf(' - You can find this script on Code -> Server-Code -startSoftware.py'); + printf(' - python startSoftware.py'); + } + else + { + socket_set_timeout( $startApp, 50); + //send START APP Message to start software to start the task + fwrite($startApp, "START APP"); + usleep(2500); + fclose($startApp); + } + + //sleep till the controller starting + sleep(6); + #try to lock the controller + $controller = isLocked($softwareLock); + + if($controller == '0') //Software running and waiting for connection! + { + //try to open the socket and connect to the software + $fp = fsockopen($ip, $port, $errno, $error, 5); + + if (!$fp) + { + echo 'Could not open the socket or connect to the testing software! Check ports on both sides!'; + } + else + { + socket_set_timeout($fp,50); + fwrite($fp, "SMART TEST"); + if(!feof($fp)) + { + while(!feof($fp)) + { + //receive data! + $received = fgets($fp, 128); + + //we got the confirmation from the testing software + if ($received == "CONFIRM\n") + { + $GSMRZ1 = 0; + $GSMRZ2 = 0; + $GSMRZ3 = 0; + + $SIP = 0; + $UNISIP = 0; + $LANDLINE = 0; + $LSFKS = 0; + + $GSMEE = 0; + $GSMEV = 0; + $GSMET = 0; + $GSMEO = 0; + + $SIPP = 0; + $LANDLINEP = 0; + $UNISIPP = 0; + $NANOBTS1P = 0; + $NANOBTS2P = 0; + + echo '
+ + + + + + + + + + '; + echo str_repeat("\n",7024); + flush(); - $GSMRZ1 = 0; - $GSMRZ2 = 0; - $GSMRZ3 = 0; - - $SIP = 0; - $UNISIP = 0; - $LANDLINE = 0; - $LSFKS = 0; - - $GSMEE = 0; - $GSMEV = 0; - $GSMET = 0; - $GSMEO = 0; - - $SIPP = 0; - $LANDLINEP = 0; - $UNISIPP = 0; - $NANOBTS1P = 0; - $NANOBTS2P = 0; - /////////// end of test! - echo '
-
From: To: Message: Status:
- - - - - - - - - - '; - echo str_repeat("\n",7024); - flush(); - - } - elseif ($received == "TEST DONE\n") - { - if ($taskAmount == "ON"){$taskAmount = "SMART TEST";} - - echo '
From: To: Message: Status:
'; - echo '
'; - echo '"; - echo ''; - echo str_repeat("\n",7024); - flush(); - usleep(100); - fwrite($fp, 'DISCONNECT'); //tell the testing software it may close - break; - } - else - { - //parse the received data! - $numberofTask++; - $received = str_replace("\n",'',$received); - $dataForTable = explode("|", $received); - $callFrom = strtoupper($dataForTable[1]); - $callTo = strtoupper($dataForTable[2]); - $testStatus = strtoupper($dataForTable[3]); - + } + + elseif ($received == "TEST DONE\n") + { + if ($taskAmount == "ON") + { + $taskAmount = "SMART TEST"; + } + + echo ' + '; + echo '
'; + echo '"; + echo ''; + echo str_repeat("\n",7024); + flush(); + usleep(100); + fwrite($fp, 'DISCONNECT'); //tell the testing software it may close + break; + } + else + { + //parse the received data! + $numberofTask++; + $received = str_replace("\n",'',$received); + $dataForTable = explode("|", $received); + $callFrom = strtoupper($dataForTable[1]); + $callTo = strtoupper($dataForTable[2]); + $testStatus = strtoupper($dataForTable[3]); + + // start algorithm to define the result for the picture if($callFrom == 'SIP' || $callTo == 'SIP') { if($testStatus == '200' || $testStatus == '402') @@ -268,7 +280,6 @@ if ($locking == '1') //1 means nobody is on the website } } } - if($callFrom == 'GSMRZ2' || $callTo == 'GSMRZ2') { if($testStatus == '200' || $testStatus == '402') @@ -348,12 +359,9 @@ if ($locking == '1') //1 means nobody is on the website { $NANOBTS1P= 2; } - } } - } - if($callFrom == 'GSMRZ3' || $callTo == 'GSMRZ3') { if($testStatus == '200' || $testStatus == '402') @@ -577,7 +585,6 @@ if ($locking == '1') //1 means nobody is on the website } } } - if($callFrom == 'GSMEXT.EPLUS' || $callTo == 'GSMEXT.EPLUS') { if($testStatus == '200') @@ -655,7 +662,6 @@ if ($locking == '1') //1 means nobody is on the website } } } - if($callFrom == 'GSMEXT.TM' || $callTo == 'GSMEXT.TM') { if($testStatus == '200' || $testStatus == '402') @@ -726,7 +732,6 @@ if ($locking == '1') //1 means nobody is on the website } } - if($callFrom == 'LANDLINE' || $callTo == 'LANDLINE') { @@ -867,7 +872,6 @@ if ($locking == '1') //1 means nobody is on the website { $UNISIPP = 0; } - } elseif ($testStatus == '501') { @@ -888,70 +892,69 @@ if ($locking == '1') //1 means nobody is on the website } } - echo ' - '. $dataForTable[1] . ' - '. $dataForTable[2] . ' - ' . $dataForTable[4] . ' - ' . $dataForTable[3] . ' - '; - echo str_repeat("\n",7024); - flush(); - usleep(100); - fwrite($fp, "CONTINUE"); //tell the software to proceed with the test and confirm receiving data - } - } - } - - fclose($fp);//close the soccket and the connection - - } - - } - elseif($softwareRunning1 == '1') - { - echo 'Testing software was not started(didn\'t obtain the lock)! Check it!'; - echo 'Soulution : Check login information in DBClass.py'; - } - else - { - echo 'Testing software didn\'t obtain the lock'; - echo 'Soulution : Check login information in DBClass.py'; - } - } - elseif($softwareRunning == '0') //0 means the software is still running in the background - { - echo 'Testing software is still running! Maybe you should kill it (if not started manually!)'; - } - else - { - echo 'We have an unknown error! Refresh te web page!'; - } + echo ' + '. $dataForTable[1] . ' + '. $dataForTable[2] . ' + ' . $dataForTable[4] . ' + ' . $dataForTable[3] . ' + '; + echo str_repeat("\n",7024); + flush(); + usleep(100); + //tell the software to proceed with the test and confirm receiving data + fwrite($fp, "CONTINUE"); + } + } + } - } - else - { - echo 'No single test was selected! Please go back and select at least one test'; - } - } - elseif($lockMe == '0') //0 means if the attempt timed out (for example, because another client has previously locked the name) - { - echo 'Someone was faster than you'; - } - else - { + fclose($fp);//close the soccket and the connection + } + } + elseif($controller == '1') + { + echo 'Testing software was not started(didn\'t obtain the lock)! Check it!'; + echo 'Soulution : Check login information in DBClass.py'; + } + else + { + echo 'Testing software didn\'t obtain the lock'; + echo 'Soulution : Check login information in DBClass.py'; + } + } + elseif($StartSoftware == '0') //0 means the software is still running in the background + { + echo 'Testing software is still running! Maybe you should kill it (if not started manually!)'; + } + else + { + echo 'We have an unknown error! Refresh te web page!'; + } + } + else + { + echo 'No single test was selected! Please go back and select at least one test'; + } + } + elseif($lockMe == '0') //0 means if the attempt timed out (for example, because another client has previously locked the name) + { + echo 'Someone was faster than you'; + } + else + { // # if an error occurred (such as running out of memory or the thread was killed with - echo 'We have an error here'; - } + echo 'We have an error here'; + } } elseif ($locking == '0') //0 means somebody is already on the web site { - echo 'Somebody is using the web site already!' . "
"; + echo 'Somebody is using the web site already!' . "
"; } else { - echo 'We have some serious error here'; + echo 'We have some serious error here'; } ?> + diff --git a/Under-Testing/Website/mutexTry.php b/Under-Testing/Website/mutexTry.php index 5579437..3bf32c8 100755 --- a/Under-Testing/Website/mutexTry.php +++ b/Under-Testing/Website/mutexTry.php @@ -10,7 +10,6 @@ Server-Code -startSoftware.py'); + printf(' - python startSoftware.py'); + } + else + { + socket_set_timeout( $startApp, 50); //one should set the number of the longest test, so we can define the timeout + fwrite($startApp, "START APP"); + usleep(2500); + fclose($startApp); + } + //sleep till the software starts + sleep(6); + $controller = isLocked($softwareLock); + if($controller == '0') //Software running and waiting for connection! + { + //try to open the socket and connect to the software + $fp = fsockopen($ip, $port, $errno, $error, 5); + if (!$fp) + { + echo 'Could not open the socket or connect to the testing software! Check ports on both sides!'; - } - else - { - socket_set_timeout($fp,50); //one should set the number of the longest test, so we can define the timeout function (it is the number after "$fp,") - - fwrite($fp, "START TEST"); - - if(!feof($fp)) - { - while(!feof($fp)) - { - $received = fgets($fp, 128); //receive data! - - if ($received == "CONFIRM\n") //we got the confirmation from the testing software - { - //test finished successfully - - $GSMRZ1 = 0; - $GSMRZ2 = 0; - $GSMRZ3 = 0; - - $SIP = 0; - $UNISIP = 0; - $LANDLINE = 0; - $LSFKS = 0; - - $GSMEE = 0; - $GSMEV = 0; - $GSMET = 0; - $GSMEO = 0; - - $SIPP = 2; - $LANDLINEP = 2; - $UNISIPP = 2; - $NANOBTS1P = 2; - $NANOBTS2P = 2; - /////////// end of test! - echo '
- - - - - - - - - - - '; - echo str_repeat("\n",7024); - flush(); - sleep(6); - $pings = mysql_query("select * from PingResultTable where taskNo=(select max(taskNo) from PingResultTable)"); + } + else + { + socket_set_timeout($fp,50); + fwrite($fp, "START TEST"); + if(!feof($fp)) + { + while(!feof($fp)) + { + $received = fgets($fp, 128); //receive data! + //we got the confirmation from the testing software + if ($received == "CONFIRM\n") + { + $GSMRZ1 = 0; + $GSMRZ2 = 0; + $GSMRZ3 = 0; + + $SIP = 0; + $UNISIP = 0; + $LANDLINE = 0; + $LSFKS = 0; - while($row = mysql_fetch_array($pings)) - { - // echo $row['taskNo']; + $GSMEE = 0; + $GSMEV = 0; + $GSMET = 0; + $GSMEO = 0; + + $SIPP = 2; + $LANDLINEP = 2; + $UNISIPP = 2; + $NANOBTS1P = 2; + $NANOBTS2P = 2; + + echo '
+
From: To: Message: Status:
+ + + + + + + + + + '; + echo str_repeat("\n",7024); + flush(); + sleep(6); + $pings = mysql_query("select * from PingResultTable where taskNo=(select max(taskNo) from PingResultTable)"); + + while($row = mysql_fetch_array($pings)) + { $SIPP = $row['sipServer']; $LANDLINEP = $row['sipGate']; $UNISIPP = $row['unisip']; @@ -917,7 +915,7 @@ if ($locking == '1') //1 means nobody is on the website } } - elseif($softwareRunning1 == '1') + elseif($controller == '1') { echo 'Testing software was not started(didn\'t obtain the lock)! Check it!'; } @@ -926,7 +924,7 @@ if ($locking == '1') //1 means nobody is on the website echo 'Testing software didn\'t obtain the lock'; } } - elseif($softwareRunning == '0') //0 means the software is still running in the background + elseif($StartSoftware == '0') //0 means the software is still running in the background { echo 'Testing software is still running! Maybe you should kill it (if not started manually!)'; } -- cgit v1.2.3-55-g7522
From: To: Message: Status: