You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2014/05/16 23:20:23 UTC

git commit: THRIFT-2534 Cross language test results should recorded to a status.md or status.html file automatically

Repository: thrift
Updated Branches:
  refs/heads/master 816790b18 -> cc0fe274c


THRIFT-2534 Cross language test results should recorded to a status.md or status.html file automatically

Patch: Chamila Dilshan Wijayarathna & Roger Meier


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/cc0fe274
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/cc0fe274
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/cc0fe274

Branch: refs/heads/master
Commit: cc0fe274c03add48d00f604896bb7b3745ac9e55
Parents: 816790b
Author: Roger Meier <ro...@apache.org>
Authored: Fri May 16 23:18:25 2014 +0200
Committer: Roger Meier <ro...@apache.org>
Committed: Fri May 16 23:18:25 2014 +0200

----------------------------------------------------------------------
 test/test.sh | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 93 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/cc0fe274/test/test.sh
----------------------------------------------------------------------
diff --git a/test/test.sh b/test/test.sh
index 90ec5a6..6086ab8 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -26,6 +26,7 @@
 # THRIFT-847 Test Framework harmonization across all languages
 # THRIFT-819 add Enumeration for protocol, transport and server types
 
+START_TIME=$SECONDS
 cd "$( dirname "$0" )"
 BASEDIR=$(pwd)
 
@@ -33,6 +34,65 @@ print_header() {
   printf "%-16s %-11s %-17s %-s\n" "client-server:" "protocol:" "transport:" "result:"
 }
 
+STATUS_HTML="status.html"
+
+print_html_header() {
+cat << EOF > $STATUS_HTML
+<!DOCTYPE HTML>
+<html>
+<head>
+<meta charset="utf-8">
+<title>Apache Thrift - integration test suite</title>
+<link rel="stylesheet" type="text/css" href="http://cdn.datatables.net/1.10.0/css/jquery.dataTables.css">
+<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
+<script type="text/javascript" charset="utf-8" src="http://cdn.datatables.net/1.10.0/js/jquery.dataTables.js"></script>
+<script>
+  var test_data;
+  \$(document).ready( function () {
+    testTable = \$('#test_results').DataTable( {
+      data: test_data
+    });
+  \$('#test_results_filter label input')
+    .focus()
+    .val('failure');
+  });
+</script>
+</head>
+<body>
+<h2>Apache Thrift - integration test suite: Results</h2>
+<table id="test_results" class="display">
+    <thead>
+        <tr>
+            <th>Server</th>
+            <th>Client</th>
+            <th>Protocol</th>
+            <th>Transport</th>
+            <th>Result (log)</th>
+        </tr>
+    </thead>
+</table>
+<script>
+test_data = [
+EOF
+}
+
+print_html_footer() {
+duration=$1
+cat << EOF >> $STATUS_HTML
+]
+</script>
+<h2>Test Information</h2>
+<pre>
+Test Date:     `date --iso-8601=seconds`
+Revision:      `git rev-parse --short HEAD`
+OS:            `uname -a`
+Test duration: $duration
+</pre>
+</body>
+</html>
+EOF
+}
+
 intersection() {
   return_value=""
   for one in $1; do
@@ -65,9 +125,11 @@ do_test () {
     timeout $client_timeout $client_exec > log/${testname}_client.log 2>&1
 
     if [ "$?" -eq "0" ]; then
-      echo " success"
+      result="success($?)"
+      echo " $result"
     else
-      echo " failure"
+      result="failure($?)"
+      echo " $result"
       # add details to the error.log
       print_header >> log/error.log
       printf "%-16s %-11s %-17s\n" ${client_server} ${protocol} ${transport} >> log/error.log
@@ -79,6 +141,21 @@ do_test () {
       echo "" >> log/error.log
     fi
 
+    # write json array
+    client_server=( ${client_server//[-]/ } )
+    server=${client_server[0]}
+    client=${client_server[1]}
+
+    cat << EOF >> $STATUS_HTML
+      [
+        "${client}",
+        "${server}",
+        "${protocol}",
+        "${transport}",
+        "${result} (<a href=\"log/${testname}_client.log\">client</a>, <a href=\"log/${testname}_server.log\">server</a>)"
+      ],
+EOF
+
     # silently kill server
     kill ${server_pid} 2>/dev/null && wait ${server_pid} 2>/dev/null
 }
@@ -86,14 +163,18 @@ do_test () {
 echo "Apache Thrift - integration test suite"
 date
 
-ant -f ../lib/java/build.xml compile-test 1>/dev/null
 
 echo "======================================================"
 
 rm -rf log
 mkdir -p log
 
+
 print_header
+print_html_header
+
+ant -f ../lib/java/build.xml compile-test 1>/dev/null
+
 
 #TODO add enum for parameters
 #TODO align program arguments across languages
@@ -300,6 +381,14 @@ do_test "rb-rb" "binary-accl" "buffered-ip" \
         "5" "5"
 
 echo " failed tests are logged to test/log/error.log"
-echo " full log is here test/log/client_server_protocol_transport.log"
+echo " full log is here test/log/client_server_protocol_transport_client.log"
+echo " full log is here test/log/client_server_protocol_transport_server.log"
+echo " or look at file://$BASEDIR/$STATUS_HTML"
+
+ELAPSED_TIME=$(($SECONDS - $START_TIME))
+DURATION="$(($ELAPSED_TIME/60)) min $(($ELAPSED_TIME%60)) sec"
+echo "test an took" $DURATION
+print_html_footer "$DURATION"
+
 date
 cd -