travis tests
authorgggeek <giunta.gaetano@gmail.com>
Sun, 13 Dec 2020 21:38:04 +0000 (21:38 +0000)
committergggeek <giunta.gaetano@gmail.com>
Sun, 13 Dec 2020 21:38:04 +0000 (21:38 +0000)
demo/server/server.php
tests/benchmark.php
tests/ci/setup/create_user.sh
tests/phpunit_coverage.php
tests/verify_compat.php

index 6e9fdf9..2c48b73 100644 (file)
@@ -11,8 +11,8 @@
 
 require_once __DIR__ . "/_bootstrap.php";
 
-// out-of-band information: let the client manipulate the server operations.
-// we do this to help the testsuite script: do not reproduce in production!
+// Out-of-band information: let the client manipulate the server operations.
+// We do this to help the testsuite script: do not reproduce in production!
 if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
     $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage';
     if (!is_dir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
index 8ef4587..4c1fe12 100644 (file)
@@ -8,6 +8,8 @@
  *
  * @todo add a test for response ok in call testing
  * @todo add support for --help option to give users the list of supported parameters
+ * @todo make number of test iterations flexible
+ * @todo add https tests
  **/
 
 use PhpXmlRpc\PhpXmlRpc;
@@ -198,12 +200,14 @@ if (function_exists('xmlrpc_decode')) {
 
 if (!$xd) {
 
+    $num_tests = 25;
+
     /// test multicall vs. many calls vs. keep-alives
     $encoder = new Encoder();
     $value = $encoder->encode($data1, array('auto_dates'));
     $req = new Request('interopEchoTests.echoValue', array($value));
     $reqs = array();
-    for ($i = 0; $i < 25; $i++) {
+    for ($i = 0; $i < $num_tests; $i++) {
         $reqs[] = $req;
     }
     $server = explode(':', $args['HTTPSERVER']);
@@ -225,7 +229,7 @@ if (!$xd) {
     }
     begin_test($testName, 'http 10');
     $response = array();
-    for ($i = 0; $i < 25; $i++) {
+    for ($i = 0; $i < $num_tests; $i++) {
         $resp = $c->send($req);
         $response[] = $resp->value();
     }
@@ -234,7 +238,7 @@ if (!$xd) {
     if (function_exists('curl_init')) {
         begin_test($testName, 'http 11 w. keep-alive');
         $response = array();
-        for ($i = 0; $i < 25; $i++) {
+        for ($i = 0; $i < $num_tests; $i++) {
             $resp = $c->send($req, 10, 'http11');
             $response[] = $resp->value();
         }
@@ -243,7 +247,7 @@ if (!$xd) {
         $c->keepalive = false;
         begin_test($testName, 'http 11');
         $response = array();
-        for ($i = 0; $i < 25; $i++) {
+        for ($i = 0; $i < $num_tests; $i++) {
             $resp = $c->send($req, 10, 'http11');
             $response[] = $resp->value();
         }
@@ -263,7 +267,7 @@ if (!$xd) {
 
         begin_test($testName, 'http 10 w. compression');
         $response = array();
-        for ($i = 0; $i < 25; $i++) {
+        for ($i = 0; $i < $num_tests; $i++) {
             $resp = $c->send($req);
             $response[] = $resp->value();
         }
@@ -272,7 +276,7 @@ if (!$xd) {
         if (function_exists('curl_init')) {
             begin_test($testName, 'http 11 w. keep-alive and compression');
             $response = array();
-            for ($i = 0; $i < 25; $i++) {
+            for ($i = 0; $i < $num_tests; $i++) {
                 $resp = $c->send($req, 10, 'http11');
                 $response[] = $resp->value();
             }
@@ -281,7 +285,7 @@ if (!$xd) {
             $c->keepalive = false;
             begin_test($testName, 'http 11 w. compression');
             $response = array();
-            for ($i = 0; $i < 25; $i++) {
+            for ($i = 0; $i < $num_tests; $i++) {
                 $resp = $c->send($req, 10, 'http11');
                 $response[] = $resp->value();
             }
index 67adae5..4196508 100755 (executable)
@@ -1,14 +1,14 @@
 #!/bin/sh
 
 # @todo set up the same user for running tests as on travis (ie. 'travis'), or maybe user 'user' ?
-# @todo make the GID & UID of the user variable
+# @todo make the GID & UID of the user variable (we picked 2000 as it is the one used by default by Travis)
 
 set -e
 
 USERNAME="${1:-test}"
 
-addgroup --gid 1013 "${USERNAME}"
-adduser --system --uid=1013 --gid=1013 --home "/home/${USERNAME}" --shell /bin/bash "${USERNAME}"
+addgroup --gid 2000 "${USERNAME}"
+adduser --system --uid=2000 --gid=2000 --home "/home/${USERNAME}" --shell /bin/bash "${USERNAME}"
 adduser "${USERNAME}" "${USERNAME}"
 
 mkdir -p "/home/${USERNAME}/.ssh"
index 69d1258..37c05d9 100644 (file)
@@ -11,6 +11,10 @@ $coverageFile = realpath(__DIR__ . "/../vendor/phpunit/phpunit-selenium/PHPUnit/
 // has to be the same value as used in server.php
 $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage';
 
+if (!is_dir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
+    mkdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']);
+}
+
 chdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']);
 
 include_once $coverageFile;
index 06cf234..b1d696c 100644 (file)
@@ -36,7 +36,7 @@ function phpxmlrpc_verify_compat($mode = 'client')
             $tests['zlib']['description'] = "The zlib extension is enabled.\n\nYou will be able to receive compressed requests and send compressed responses for the 'HTTP' protocol";
         }
 
-        // test for dispaly of php errors in xml reponse
+        // test for display of php errors in xml response
         if (ini_get('display_errors')) {
             if (intval(ini_get('error_reporting')) && E_NOTICE) {
                 $tests['display_errors']['status'] = 1;