enhanced test.php management and engine_test.sh added
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 20 Feb 2013 08:23:45 +0000 (09:23 +0100)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Wed, 20 Feb 2013 08:24:02 +0000 (09:24 +0100)
bin/engine_test.sh [new file with mode: 0755]
web/Obj/brisk.phh

diff --git a/bin/engine_test.sh b/bin/engine_test.sh
new file mode 100755 (executable)
index 0000000..b6a3ca4
--- /dev/null
@@ -0,0 +1,50 @@
+#!/bin/bash
+# set -x
+url="http://dodo.birds.lan/brisk/test.php"
+# url="http://dodo.birds.lan/pippo.php"
+
+rm -f engine_test.log engine_test.out engine_test.in
+
+to=1
+while [ $# -gt 0 ]; do
+    case $1 in
+        -w)
+            USE_WGET=y
+            ;;
+        *)
+            to_tot=$1
+            to=$to_tot
+            break
+            ;;
+    esac
+    shift
+done
+
+rm -f engine_test.tmp
+touch engine_test.tmp
+if [ $to_tot -gt 10 ]; then
+    for i in $(seq 1 $((to / 10))); do
+        echo "_123456789abcdef_123456789abcdef_123456789abcdef_123456789abcdef_123456789abcdef_123456789abcdef_123456789abcdef_123456789abcdef_123456789abcdef_123456789abcdef" | tr -d '\n' >> engine_test.tmp
+    done
+    into=$((to / 10))
+    into=$((into * 10))
+    to=$((to - into))
+fi
+
+for i in $(seq 1 $to); do
+        echo "_123456789abcdef" | tr -d '\n' >> engine_test.tmp
+done
+in_md5="$(cat engine_test.tmp | tr -d '\n' | md5sum | cut -c 1-7)"
+echo "data=" | tr -d '\n' > engine_test.in
+cat  engine_test.tmp >>  engine_test.in
+
+if [ "$USE_WGET" = "y" ]; then
+    echo "Started wget, sent "$((to_tot * 16))" (MD5 $in_md5) ... " | tr -d '\n'
+    wget --post-file=engine_test.in -q -o engine_test.log -O engine_test.out "$url"
+else
+    echo "Started curl, sent "$((to_tot * 16))" (MD5 $in_md5) ... " | tr -d '\n'
+    curl -d @engine_test.in -o engine_test.out "$url" > engine_test.log 2>&1
+fi
+# rm engine_test.in
+echo "returned "$(cat engine_test.out | wc -c)" (MD5 "$(cat engine_test.out | md5sum | cut -c 1-7)")."
+echo
index 45b583c..b9f305a 100644 (file)
@@ -2288,7 +2288,13 @@ class Room
           if (!(BRISK_DEBUG & DBG_ENGI))
               return (FALSE);
           fprintf(STDERR, "TEST.PHP running\n");
-          $content = "<html><body>OK</body></html>";
+          if (isset($post['data'])) {
+              $content = $post['data'];
+          }
+          else {
+              $content = "NO DATA AVAILABLE";
+          }
+          $header_out['Content-Type'] = 'text/plain';
           $s_a_p->pendpage_try_addflush($new_socket, 20, $enc, $header_out, $content);
           return TRUE;
           break;