THRIFT-847 Test Framework harmonization across all languages

Signed-off-by: Roger Meier <roger@apache.org>
diff --git a/contrib/installDependencies.sh b/contrib/installDependencies.sh
index d52c0fa..852a805 100755
--- a/contrib/installDependencies.sh
+++ b/contrib/installDependencies.sh
@@ -27,7 +27,7 @@
 
 # Java dependencies
 sudo apt-get install -qq ant openjdk-7-jdk
-sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 
+sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
 
 # Python dependencies
 sudo apt-get install -qq python-all python-all-dev python-all-dbg python-setuptools python-support
diff --git a/lib/hs/Thrift.cabal b/lib/hs/Thrift.cabal
index f847663..1b71ca7 100755
--- a/lib/hs/Thrift.cabal
+++ b/lib/hs/Thrift.cabal
@@ -68,6 +68,6 @@
   Hs-Source-Dirs:
     tests
   Build-Depends:
-    base, QuickCheck, binary, bytestring, thrift
+    base, QuickCheck, binary, bytestring, thrift, split
   Main-Is:
     JSONTests.hs
\ No newline at end of file
diff --git a/test/hs/TestClient.hs b/test/hs/TestClient.hs
index 35e8397..2b9254b 100644
--- a/test/hs/TestClient.hs
+++ b/test/hs/TestClient.hs
@@ -23,6 +23,7 @@
 import Control.Exception
 import Control.Monad
 import Data.Functor
+import Data.List.Split
 import Data.String
 import Network
 import System.Environment
@@ -80,10 +81,10 @@
 runClient p = do
   let prot = (p,p)
   putStrLn "Starting Tests"
-              
+
   -- VOID Test
   Client.testVoid prot
-  
+
   -- String Test
   s <- Client.testString prot "Test"
   when (s /= "Test") exitFailure
@@ -91,11 +92,11 @@
   -- Byte Test
   byte <- Client.testByte prot 1
   when (byte /= 1) exitFailure
-  
+
   -- I32 Test
   i32 <- Client.testI32 prot (-1)
   when (i32 /= -1) exitFailure
-  
+
   -- I64 Test
   i64 <- Client.testI64 prot (-34359738368)
   when (i64 /= -34359738368) exitFailure
@@ -110,7 +111,7 @@
                        , xtruct_i32_thing    = -3
                        , xtruct_i64_thing    = -5
                        }
-  structOut <- Client.testStruct prot structIn 
+  structOut <- Client.testStruct prot structIn
   when (structIn /= structOut) exitFailure
 
   -- Nested Struct Test
@@ -120,22 +121,22 @@
                       }
   nestOut <- Client.testNest prot nestIn
   when (nestIn /= nestOut) exitSuccess
-  
+
   -- Map Test
   let mapIn = Map.fromList $ map (\i -> (i, i-10)) [1..5]
   mapOut <- Client.testMap prot mapIn
   when (mapIn /= mapOut) exitSuccess
-  
+
   -- Set Test
   let setIn = Set.fromList [-2..3]
   setOut <- Client.testSet prot setIn
   when (setIn /= setOut) exitFailure
-  
+
   -- List Test
   let listIn = Vector.fromList [-2..3]
   listOut <- Client.testList prot listIn
   when (listIn /= listOut) exitFailure
-  
+
   -- Enum Test
   numz1 <- Client.testEnum prot ONE
   when (numz1 /= ONE) exitFailure
@@ -149,26 +150,26 @@
   -- Typedef Test
   uid <- Client.testTypedef prot 309858235082523
   when (uid /= 309858235082523) exitFailure
-  
+
   -- Nested Map Test
   _ <- Client.testMapMap prot 1
-  
+
   -- Exception Test
   exn1 <- try $ Client.testException prot "Xception"
   case exn1 of
     Left (Xception _ _) -> return ()
     _ -> putStrLn (show exn1) >> exitFailure
-  
+
   exn2 <- try $ Client.testException prot "TException"
   case exn2 of
     Left (_ :: SomeException) -> return ()
     Right _ -> exitFailure
-  
+
   exn3 <- try $ Client.testException prot "success"
   case exn3 of
     Left (_ :: SomeException) -> exitFailure
     Right _ -> return ()
-  
+
   -- Multi Exception Test
   multi1 <- try $ Client.testMultiException prot "Xception" "test 1"
   case multi1 of
@@ -197,24 +198,24 @@
             Binary  -> runClient $ BinaryProtocol handle
             Compact -> runClient $ CompactProtocol handle
             JSON    -> runClient $ JSONProtocol handle
-      replicateM_ testLoops client      
+      replicateM_ testLoops client
       putStrLn "COMPLETED SUCCESSFULLY"
 
 parseFlags :: [String] -> Options -> Maybe Options
+parseFlags (flag : flags) opts = do
+  let pieces = splitOn "=" flag
+  case pieces of
+    "--port" : arg : _ -> parseFlags flags opts{ port = read arg }
+    "--domain-socket" : arg : _ -> parseFlags flags opts{ domainSocket = read arg }
+    "--host" : arg : _ -> parseFlags flags opts{ host = arg }
+    "--transport" : arg : _ -> parseFlags flags opts{ transport = arg }
+    "--protocol" : arg : _ -> parseFlags flags opts{ protocol = getProtocol arg }
+    "--h" : _ -> Nothing
+    "--help" : _ -> Nothing
+    "--ssl" : _ -> parseFlags flags opts{ ssl = True }
+    "--processor-events" : _ -> parseFlags flags opts
 parseFlags (flag : arg : flags) opts
-  | flag == "--port"          = parseFlags flags opts{ port = read arg }
-  | flag == "--domain-socket" = parseFlags flags opts{ domainSocket = arg }
-  | flag == "--host"          = parseFlags flags opts{ host = arg }
-  | flag == "--transport"     = parseFlags flags opts{ transport = arg }
-  | flag == "--protocol"      = parseFlags flags opts{ protocol = getProtocol arg }
-  | flag == "-n" ||
-    flag == "--testloops"     = parseFlags flags opts{ testLoops = read arg }
-parseFlags (flag : flags) opts
-  | flag == "-h"     = Nothing
-  | flag == "--help" = Nothing
-  | flag == "--ssl"  = parseFlags flags opts{ ssl = True }
-  | flag == "--processor-events" ||
-    otherwise = parseFlags flags opts
+  | flag == "-n"                    = parseFlags flags opts{ testLoops = read arg }
 parseFlags [] opts = Just opts
 
 showHelp :: IO ()
@@ -223,7 +224,7 @@
   \  -h [ --help ]               produce help message\n\
   \  --host arg (=localhost)     Host to connect\n\
   \  --port arg (=9090)          Port number to connect\n\
-  \  --domain-socket arg         Domain Socket (e.g. /tmp/ThriftTest.thrift),\n\ 
+  \  --domain-socket arg         Domain Socket (e.g. /tmp/ThriftTest.thrift),\n\
   \                              instead of host and port\n\
   \  --transport arg (=buffered) Transport: buffered, framed, http, evhttp\n\
   \  --protocol arg (=binary)    Protocol: binary, compact, json\n\
diff --git a/test/hs/TestServer.hs b/test/hs/TestServer.hs
index 340b58b..e3f3241 100644
--- a/test/hs/TestServer.hs
+++ b/test/hs/TestServer.hs
@@ -25,6 +25,7 @@
 import Data.Functor
 import Data.HashMap.Strict (HashMap)
 import Data.List
+import Data.List.Split
 import Data.String
 import Network
 import System.Environment
@@ -57,7 +58,7 @@
   , ssl          :: Bool
   , workers      :: Int
   }
-  
+
 data ServerType = Simple
                 | ThreadPool
                 | Threaded
@@ -93,42 +94,42 @@
   }
 
 stringifyMap :: (Show a, Show b) => Map.HashMap a b -> String
-stringifyMap = intercalate ", " . map joinKV . Map.toList
+stringifyMap = Data.List.intercalate ", " . Data.List.map joinKV . Map.toList
   where joinKV (k, v) = show k ++ " => " ++ show v
 
 stringifySet :: Show a => Set.HashSet a -> String
-stringifySet = intercalate ", " . map show . Set.toList
+stringifySet = Data.List.intercalate ", " . Data.List.map show . Set.toList
 
 stringifyList :: Show a => Vector.Vector a -> String
-stringifyList = intercalate ", " . map show . Vector.toList
+stringifyList = Data.List.intercalate ", " . Data.List.map show . Vector.toList
 
 data TestHandler = TestHandler
-instance ThriftTest_Iface TestHandler where  
-  testVoid _ = putStrLn "testVoid()"
+instance ThriftTest_Iface TestHandler where
+  testVoid _ = System.IO.putStrLn "testVoid()"
 
   testString _ s = do
-    putStrLn $ "testString(" ++ show s ++ ")"
+    System.IO.putStrLn $ "testString(" ++ show s ++ ")"
     return s
 
   testByte _ x = do
-    putStrLn $ "testByte(" ++ show x ++ ")"
+    System.IO.putStrLn $ "testByte(" ++ show x ++ ")"
     return x
 
   testI32 _ x = do
-    putStrLn $ "testI32(" ++ show x ++ ")"
+    System.IO.putStrLn $ "testI32(" ++ show x ++ ")"
     return x
 
   testI64 _ x = do
-    putStrLn $ "testI64(" ++ show x ++ ")"
+    System.IO.putStrLn $ "testI64(" ++ show x ++ ")"
     return x
-    
+
   testDouble _ x = do
-    putStrLn $ "testDouble(" ++ show x ++ ")"
+    System.IO.putStrLn $ "testDouble(" ++ show x ++ ")"
     return x
 
   testStruct _ struct@Xtruct{..} = do
-    putStrLn $ "testStruct({" ++ show xtruct_string_thing
-                      ++ ", " ++ show xtruct_byte_thing 
+    System.IO.putStrLn $ "testStruct({" ++ show xtruct_string_thing
+                      ++ ", " ++ show xtruct_byte_thing
                       ++ ", " ++ show xtruct_i32_thing
                       ++ ", " ++ show xtruct_i64_thing
                       ++ "})"
@@ -136,7 +137,7 @@
 
   testNest _ nest@Xtruct2{..} = do
     let Xtruct{..} = xtruct2_struct_thing
-    putStrLn $ "testNest({" ++ show xtruct2_byte_thing
+    System.IO.putStrLn $ "testNest({" ++ show xtruct2_byte_thing
                    ++ "{, " ++ show xtruct_string_thing
                    ++  ", " ++ show xtruct_byte_thing
                    ++  ", " ++ show xtruct_i32_thing
@@ -145,31 +146,31 @@
     return nest
 
   testMap _ m = do
-    putStrLn $ "testMap({" ++ stringifyMap m ++ "})"
+    System.IO.putStrLn $ "testMap({" ++ stringifyMap m ++ "})"
     return m
-            
+
   testStringMap _ m = do
-    putStrLn $ "testStringMap(" ++ stringifyMap m ++ "})"
+    System.IO.putStrLn $ "testStringMap(" ++ stringifyMap m ++ "})"
     return m
 
   testSet _ x = do
-    putStrLn $ "testSet({" ++ stringifySet x ++ "})"
+    System.IO.putStrLn $ "testSet({" ++ stringifySet x ++ "})"
     return x
 
   testList _ x = do
-    putStrLn $ "testList(" ++ stringifyList x ++ "})"
+    System.IO.putStrLn $ "testList(" ++ stringifyList x ++ "})"
     return x
 
   testEnum _ x = do
-    putStrLn $ "testEnum(" ++ show x ++ ")"
+    System.IO.putStrLn $ "testEnum(" ++ show x ++ ")"
     return x
 
   testTypedef _ x = do
-    putStrLn $ "testTypedef(" ++ show x ++ ")"
+    System.IO.putStrLn $ "testTypedef(" ++ show x ++ ")"
     return x
 
   testMapMap _ x = do
-    putStrLn $ "testMapMap(" ++ show x ++ ")"
+    System.IO.putStrLn $ "testMapMap(" ++ show x ++ ")"
     return $ Map.fromList [ (-4, Map.fromList [ (-4, -4)
                                               , (-3, -3)
                                               , (-2, -2)
@@ -183,7 +184,7 @@
                           ]
 
   testInsanity _ x = do
-    putStrLn "testInsanity()"
+    System.IO.putStrLn "testInsanity()"
     return $ Map.fromList [ (1, Map.fromList [ (TWO  , x)
                                              , (THREE, x)
                                              ])
@@ -192,32 +193,32 @@
                           ]
 
   testMulti _ byte i32 i64 _ _ _ = do
-    putStrLn "testMulti()"
+    System.IO.putStrLn "testMulti()"
     return Xtruct{ xtruct_string_thing = Text.pack "Hello2"
                  , xtruct_byte_thing   = byte
                  , xtruct_i32_thing    = i32
                  , xtruct_i64_thing    = i64
                  }
-                                        
+
   testException _ s = do
-    putStrLn $ "testException(" ++ show s ++ ")"
+    System.IO.putStrLn $ "testException(" ++ show s ++ ")"
     case s of
       "Xception"   -> throw $ Xception 1001 s
       "TException" -> throw ThriftException
       _ -> return ()
 
   testMultiException _ s1 s2 = do
-    putStrLn $ "testMultiException(" ++ show s1 ++ ", " ++ show s2 ++  ")"
+    System.IO.putStrLn $ "testMultiException(" ++ show s1 ++ ", " ++ show s2 ++  ")"
     case s1 of
-      "Xception"   -> throw $ Xception 1001 "This is an Xception" 
-      "Xception2"  -> throw $ Xception2 2002 default_Xtruct 
+      "Xception"   -> throw $ Xception 1001 "This is an Xception"
+      "Xception2"  -> throw $ Xception2 2002 default_Xtruct
       "TException" -> throw ThriftException
       _ -> return default_Xtruct{ xtruct_string_thing = s2 }
 
   testOneway _ i = do
-    putStrLn $ "testOneway(" ++ show i ++ "): Sleeping..."
+    System.IO.putStrLn $ "testOneway(" ++ show i ++ "): Sleeping..."
     sleep (fromIntegral i)
-    putStrLn $ "testOneway(" ++ show i ++ "): done sleeping!"
+    System.IO.putStrLn $ "testOneway(" ++ show i ++ "): done sleeping!"
 
 main :: IO ()
 main = do
@@ -225,7 +226,7 @@
   case options of
     Nothing -> showHelp
     Just Options{..} -> do
-      putStrLn $ "Starting \"" ++ show serverType ++ "\" server (" ++
+      System.IO.putStrLn $ "Starting \"" ++ show serverType ++ "\" server (" ++
         show transport ++ ") listen on: " ++ domainSocket ++ show port
       case protocol of
         Binary  -> runServer BinaryProtocol port
@@ -238,23 +239,25 @@
           return (p h, p h)
 
 parseFlags :: [String] -> Options -> Maybe Options
+parseFlags (flag : flags) opts = do
+  let pieces = splitOn "=" flag
+  case pieces of
+    "--port" : arg : _ -> parseFlags flags opts{ port = read arg }
+    "--domain-socket" : arg : _ -> parseFlags flags opts{ domainSocket = read arg }
+    "--server-type" : arg : _ -> parseFlags flags opts{ serverType = fromString arg }
+    "--transport" : arg : _ -> parseFlags flags opts{ transport = arg }
+    "--protocol" : arg : _ -> parseFlags flags opts{ protocol = getProtocol arg }
+    "--workers" : arg : _ -> parseFlags flags opts{ workers = read arg }
+    "--h" : _ -> Nothing
+    "--help" : _ -> Nothing
+    "--ssl" : _ -> parseFlags flags opts{ ssl = True }
+    "--processor-events" : _ -> parseFlags flags opts
 parseFlags (flag : arg : flags) opts
-  | flag == "--port"          = parseFlags flags opts{ port = read arg }
-  | flag == "--domain-socket" = parseFlags flags opts{ domainSocket = arg }
-  | flag == "--server-type"   = parseFlags flags opts{ serverType = fromString arg }
-  | flag == "--transport"     = parseFlags flags opts{ transport = arg }
-  | flag == "--protocol"      = parseFlags flags opts{ protocol = getProtocol arg }
-  | flag == "-n" ||
-    flag == "--workers"       = parseFlags flags opts{ workers = read arg }
-parseFlags (flag : flags) opts
-  | flag == "-h"     = Nothing
-  | flag == "--help" = Nothing
-  | flag == "--ssl"  = parseFlags flags opts{ ssl = True }
-  | flag == "--processor-events" = parseFlags flags opts
+  | flag == "-n"                     = parseFlags flags opts{ workers = read arg }
 parseFlags [] opts = Just opts
 
 showHelp :: IO ()
-showHelp = putStrLn
+showHelp = System.IO.putStrLn
   "Allowed options:\n\
   \  -h [ --help ]               produce help message\n\
   \  --port arg (=9090)          Port number to listen\n\
@@ -265,5 +268,5 @@
   \  --protocol arg (=binary)    protocol: binary, compact, json\n\
   \  --ssl                       Encrypted Transport using SSL\n\
   \  --processor-events          processor-events\n\
-  \  -n [ --workers ] arg (=4)   Number of thread pools workers. Only valid for\n\ 
+  \  -n [ --workers ] arg (=4)   Number of thread pools workers. Only valid for\n\
   \                              thread-pool server type"
\ No newline at end of file
diff --git a/test/test.sh b/test/test.sh
index 3a28429..0eeefe5 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -212,91 +212,6 @@
 hs_transports="buffered"
 hs_sockets="ip"
 
-######### hs client - hs server ###############
-for proto in $hs_protocols; do
-  for trans in $hs_transports; do
-    for sock in $hs_sockets; do
-      case "$sock" in
-       "ip" )     extraparam="";;
-       "ip-ssl" ) extraparam="--ssl";;
-       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
-      esac
-      do_test "hs-hs"   "${proto}" "${trans}-${sock}" \
-              "hs/TestClient --protocol ${proto} --transport ${trans} ${extraparam}" \
-              "hs/TestServer --protocol ${proto} --transport ${trans} ${extraparam}" \
-              "2" "0.1"
-    done
-  done
-done
-
-######### hs client - cpp server ###############
-for proto in $(intersection "${hs_protocols}" "${cpp_protocols}"); do
-  for trans in  $(intersection "${hs_transports}" "${cpp_transports}"); do
-    for sock in $(intersection "${hs_sockets}" "${cpp_sockets}"); do
-      case "$sock" in
-       "ip" )     extraparam="";;
-       "ip-ssl" ) extraparam="--ssl";;
-       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
-      esac
-      do_test "hs-cpp"   "${proto}" "${trans}-${sock}" \
-              "hs/TestClient --protocol ${proto} --transport ${trans} ${extraparam}" \
-              "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
-              "2" "0.1"
-    done
-  done
-done
-
-######### cpp client - hs server ###############
-for proto in $(intersection "${hs_protocols}" "${cpp_protocols}"); do
-  for trans in  $(intersection "${hs_transports}" "${cpp_transports}"); do
-    for sock in $(intersection "${hs_sockets}" "${cpp_sockets}"); do
-      case "$sock" in
-       "ip" )     extraparam="";;
-       "ip-ssl" ) extraparam="--ssl";;
-       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
-      esac
-      do_test "cpp-hs"   "${proto}" "${trans}-${sock}" \
-              "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
-              "hs/TestServer --protocol ${proto} --transport ${trans} ${extraparam}" \
-              "2" "0.1"
-    done
-  done
-done
-
-######### hs client - java server ###############
-for proto in $(intersection "${hs_protocols}" "${java_protocols}"); do
-  for trans in  $(intersection "${hs_transports}" "${java_transports}"); do
-    for sock in $(intersection "${hs_sockets}" "${java_sockets}"); do
-      case "$sock" in
-       "ip" )     extraparam="";;
-       "ip-ssl" ) extraparam="--ssl";;
-       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
-      esac
-      do_test "hs-java" "${proto}" "${trans}-${sock}" \
-              "hs/TestClient --protocol ${proto} --transport ${trans} ${extraparam}" \
-	      "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" run-testserver" \
-              "5" "1"
-    done
-  done
-done
-
-######### java client - hs server ###############
-for proto in $(intersection "${hs_protocols}" "${java_protocols}"); do
-  for trans in  $(intersection "${hs_transports}" "${java_transports}"); do
-    for sock in $(intersection "${hs_sockets}" "${java_sockets}"); do
-      case "$sock" in
-       "ip" )     extraparam="";;
-       "ip-ssl" ) extraparam="--ssl";;
-       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
-      esac
-      do_test "java-hs" "${proto}" "${trans}-${sock}" \
-              "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" run-testclient" \
-              "hs/TestServer --protocol ${proto} --transport ${trans} ${extraparam}" \
-              "5" "1"
-    done
-  done
-done
-
 ######### java client - java server #############
 for proto in $java_protocols; do
   for trans in $java_server_transports; do
@@ -456,8 +371,8 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-py" "${proto}" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=${proto} --transport={trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
-              "py/TestServer.py --protocol=${proto} --transport={trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestClient.py --protocol=${proto} --transport={trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
+              "py/TestServer.py --protocol=${proto} --transport={trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "10" "2"
     done
   done
@@ -470,12 +385,12 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-py" "accel-binary" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
-              "py/TestServer.py --protocol=binary --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
+              "py/TestServer.py --protocol=binary --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "10" "2"
       do_test "py-py" "binary-accel" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=binary --transport={trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
-              "py/TestServer.py --protocol=accel --transport={trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestClient.py --protocol=binary --transport={trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
+              "py/TestServer.py --protocol=accel --transport={trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "10" "2"
     done
   done
@@ -489,7 +404,7 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-cpp" "${proto}" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=${proto} --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
+              "py/TestClient.py --protocol=${proto} --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
               "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
               "10" "2"
     done
@@ -503,7 +418,7 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-cpp" "accel-binary" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
+              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
               "cpp/TestServer --protocol=binary --transport=${trans} ${extraparam}" \
               "10" "2"
     done
@@ -519,7 +434,7 @@
       esac
       do_test "cpp-py" "${proto}" "${trans}-${sock}" \
               "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
-              "py/TestServer.py --protocol=${proto} --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestServer.py --protocol=${proto} --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "10" "2"
     done
   done
@@ -533,7 +448,7 @@
       esac
       do_test "cpp-py" "binary-accel" "${trans}-${sock}" \
               "cpp/TestClient --protocol=binary --transport=${trans} ${extraparam}" \
-              "py/TestServer.py --protocol=accel --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestServer.py --protocol=accel --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "10" "2"
     done
   done
@@ -547,7 +462,7 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-java" "${proto}" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=${proto} --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
+              "py/TestClient.py --protocol=${proto} --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
               "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" run-testserver" \
               "15" "2"
     done
@@ -561,7 +476,7 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-java" "accel-binary" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
+              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
               "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=binary --transport=${trans} ${extraparam}\" run-testserver" \
               "15" "2"
     done
@@ -577,7 +492,7 @@
       esac
       do_test "java-py" "${proto}" "${trans}-${sock}" \
               "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" run-testclient" \
-              "py/TestServer.py --protocol=${proto} --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestServer.py --protocol=${proto} --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "10" "5"
     done
   done
@@ -591,7 +506,7 @@
       esac
       do_test "java-py" "binary-accel" "${trans}-${sock}" \
               "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=binary --transport=${trans} ${extraparam}\" run-testclient" \
-              "py/TestServer.py --protocol=accel --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestServer.py --protocol=accel --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "10" "5"
     done
   done
@@ -605,7 +520,7 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-nodejs" "${proto}" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=${proto} --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
+              "py/TestClient.py --protocol=${proto} --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
               "node ${NODE_TEST_DIR}/server.js -p ${proto} -t ${trans} ${extraparam}" \
               "15" "2"
     done
@@ -619,7 +534,7 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-nodejs" "${proto}" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
+              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
               "node ${NODE_TEST_DIR}/server.js -p binary -t ${trans} ${extraparam}" \
               "15" "2"
     done
@@ -635,7 +550,7 @@
       esac
       do_test "nodejs-py" "${proto}" "${trans}-${sock}" \
               "node ${NODE_TEST_DIR}/client.js -p ${proto} -t ${trans} ${extraparam}" \
-              "py/TestServer.py --protocol=${proto} --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestServer.py --protocol=${proto} --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "10" "2"
     done
   done
@@ -649,7 +564,7 @@
       esac
       do_test "nodejs-py" "binary-accel" "${trans}-${sock}" \
               "node ${NODE_TEST_DIR}/client.js -p binary -t ${trans} ${extraparam}" \
-              "py/TestServer.py --protocol=accel --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestServer.py --protocol=accel --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "10" "2"
     done
   done
@@ -861,7 +776,7 @@
     done
   done
 
-  ######### py client - ruby server ##############
+######### py client - ruby server ##############
 for proto in $(intersection "${py_protocols}" "${ruby_protocols}"); do
   for trans in $(intersection "${py_transports}" "${ruby_transports}"); do
     for sock in $(intersection "${py_sockets}" "${ruby_sockets}"); do
@@ -870,7 +785,7 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-ruby" "${proto}" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=${proto} --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
+              "py/TestClient.py --protocol=${proto} --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
               "ruby rb/integration/TestServer.rb --protocol=${proto} --transport=${trans}" \
               "15" "5"
     done
@@ -884,11 +799,11 @@
         "ip-ssl" ) extraparam="--ssl";;
       esac
       do_test "py-ruby" "${proto}" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
+              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
               "ruby rb/integration/TestServer.rb --protocol=binary --transport=${trans}" \
               "15" "5"
       do_test "py-ruby" "${proto}" "${trans}-${sock}" \
-              "py/TestClient.py --protocol=binary --transport=${trans} --port=9090 --host=localhost --genpydir=py/gen-py ${extraparam}" \
+              "py/TestClient.py --protocol=binary --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
               "ruby rb/integration/TestServer.rb --protocol=accel --transport=${trans}" \
               "15" "5"
     done
@@ -904,7 +819,7 @@
       esac
       do_test "ruby-py" "${proto}" "${trans}-${sock}" \
               "ruby rb/integration/TestClient.rb --protocol=${proto} --transport=${trans}" \
-              "py/TestServer.py --protocol=${proto} --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestServer.py --protocol=${proto} --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "5" "2"
     done
   done
@@ -918,15 +833,248 @@
       esac
       do_test "ruby-py" "binary-accel" "${trans}-${sock}" \
               "ruby rb/integration/TestClient.rb --protocol=binary --transport=${trans}" \
-              "py/TestServer.py --protocol=accel --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestServer.py --protocol=accel --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "5" "2"
       do_test "ruby-py" "accel-binary" "${trans}-${sock}" \
               "ruby rb/integration/TestClient.rb --protocol=accel --transport=${trans}" \
-              "py/TestServer.py --protocol=binary --transport=${trans} --port=9090 --genpydir=py/gen-py TSimpleServer ${extraparam}" \
+              "py/TestServer.py --protocol=binary --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
               "5" "2"
     done
   done
 
+######### hs client - hs server ###############
+for proto in $hs_protocols; do
+  for trans in $hs_transports; do
+    for sock in $hs_sockets; do
+      case "$sock" in
+       "ip" )     extraparam="";;
+       "ip-ssl" ) extraparam="--ssl";;
+       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
+      esac
+      do_test "hs-hs"   "${proto}" "${trans}-${sock}" \
+              "hs/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "hs/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "2" "0.1"
+    done
+  done
+done
+
+######### hs client - cpp server ###############
+for proto in $(intersection "${hs_protocols}" "${cpp_protocols}"); do
+  for trans in  $(intersection "${hs_transports}" "${cpp_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${cpp_sockets}"); do
+      case "$sock" in
+       "ip" )     extraparam="";;
+       "ip-ssl" ) extraparam="--ssl";;
+       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
+      esac
+      do_test "hs-cpp"   "${proto}" "${trans}-${sock}" \
+              "hs/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "cpp/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "2" "0.1"
+    done
+  done
+done
+
+######### cpp client - hs server ###############
+for proto in $(intersection "${hs_protocols}" "${cpp_protocols}"); do
+  for trans in  $(intersection "${hs_transports}" "${cpp_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${cpp_sockets}"); do
+      case "$sock" in
+       "ip" )     extraparam="";;
+       "ip-ssl" ) extraparam="--ssl";;
+       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
+      esac
+      do_test "cpp-hs"   "${proto}" "${trans}-${sock}" \
+              "cpp/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "hs/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "2" "0.1"
+    done
+  done
+done
+
+######### hs client - java server ###############
+for proto in $(intersection "${hs_protocols}" "${java_protocols}"); do
+  for trans in  $(intersection "${hs_transports}" "${java_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${java_sockets}"); do
+      case "$sock" in
+       "ip" )     extraparam="";;
+       "ip-ssl" ) extraparam="--ssl";;
+       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
+      esac
+      do_test "hs-java" "${proto}" "${trans}-${sock}" \
+              "hs/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
+        "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" run-testserver" \
+              "5" "1"
+    done
+  done
+done
+
+######### java client - hs server ###############
+for proto in $(intersection "${hs_protocols}" "${java_protocols}"); do
+  for trans in  $(intersection "${hs_transports}" "${java_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${java_sockets}"); do
+      case "$sock" in
+       "ip" )     extraparam="";;
+       "ip-ssl" ) extraparam="--ssl";;
+       "domain" ) extraparam="--domain-socket=/tmp/ThriftTest.thrift";;
+      esac
+      do_test "java-hs" "${proto}" "${trans}-${sock}" \
+              "ant -f  ../lib/java/build.xml -Dno-gen-thrift=\"\" -Dtestargs \"--protocol=${proto} --transport=${trans} ${extraparam}\" run-testclient" \
+              "hs/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "5" "1"
+    done
+  done
+done
+
+######### py client -hs server ##############
+for proto in $(intersection "${hs_protocols}" "${py_protocols}"); do
+  for trans in $(intersection "${hs_transports}" "${py_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${py_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "py-hs" "${proto}" "${trans}-${sock}" \
+              "py/TestClient.py --protocol=${proto} --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
+              "hs/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "10" "2"
+    done
+  done
+done
+
+for trans in $(intersection "${hs_transports}" "${py_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${py_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "py-hs" "accel-binary" "${trans}-${sock}" \
+              "py/TestClient.py --protocol=accel --transport=${trans} --port=9090 --host=localhost --genpydir=gen-py ${extraparam}" \
+              "hs/TestServer --protocol=binary --transport=${trans} ${extraparam}" \
+              "10" "2"
+    done
+  done
+
+######### hs client - py server ##############
+for proto in $(intersection "${hs_protocols}" "${py_protocols}"); do
+  for trans in $(intersection "${hs_transports}" "${py_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${py_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "hs-py" "${proto}" "${trans}-${sock}" \
+              "hs/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "py/TestServer.py --protocol=${proto} --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
+              "10" "2"
+    done
+  done
+done
+
+for trans in $(intersection "${hs_transports}" "${py_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${py_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "hs-py" "binary-accel" "${trans}-${sock}" \
+              "hs/TestClient --protocol=binary --transport=${trans} ${extraparam}" \
+              "py/TestServer.py --protocol=accel --transport=${trans} --port=9090 --genpydir=gen-py TSimpleServer ${extraparam}" \
+              "10" "2"
+    done
+  done
+
+######### nodejs client - hs server ##############
+for proto in $(intersection "${nodejs_protocols}" "${hs_protocols}"); do
+  for trans in $(intersection "${nodejs_transports}" "${hs_transports}"); do
+    for sock in $(intersection "${nodejs_sockets}" "${hs_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "nodejs-hs" "${proto}" "${trans}-${sock}" \
+              "node ${NODE_TEST_DIR}/client.js -p ${proto} -t ${trans} ${extraparam}" \
+              "hs/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "5" "0.2"
+    done
+  done
+done
+
+######### hs client - nodejs server ##############
+for proto in $(intersection "${nodejs_protocols}" "${hs_protocols}"); do
+  for trans in $(intersection "${nodejs_transports}" "${hs_transports}"); do
+    for sock in $(intersection "${nodejs_sockets}" "${hs_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "hs-nodejs" "${proto}" "${trans}-${sock}" \
+              "hs/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "node ${NODE_TEST_DIR}/server.js -p ${proto} -t ${trans} ${extraparam}" \
+              "5" "2"
+    done
+  done
+done
+
+######### ruby client - hs server ##############
+for proto in $(intersection "${hs_protocols}" "${ruby_protocols}"); do
+  for trans in $(intersection "${hs_transports}" "${ruby_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${ruby_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "ruby-hs" "${proto}" "${trans}-${sock}" \
+              "ruby rb/integration/TestClient.rb --protocol=${proto} --transport=${trans}" \
+              "hs/TestServer --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "5" "5"
+    done
+  done
+done
+
+for trans in $(intersection "${hs_transports}" "${ruby_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${ruby_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "ruby-cpp" "accel-binary" "${trans}-${sock}" \
+              "ruby rb/integration/TestClient.rb --protocol=accel --transport=${trans}" \
+              "hs/TestServer --protocol=binary --transport=${trans} ${extraparam}" \
+              "5" "5"
+    done
+  done
+
+######### hs client - ruby server ##############
+for proto in $(intersection "${hs_protocols}" "${ruby_protocols}"); do
+  for trans in $(intersection "${hs_transports}" "${ruby_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${ruby_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "hs-ruby" "${proto}" "${trans}-${sock}" \
+              "hs/TestClient --protocol=${proto} --transport=${trans} ${extraparam}" \
+              "ruby rb/integration/TestServer.rb --protocol=${proto} --transport=${trans}" \
+              "5" "5"
+    done
+  done
+done
+
+for trans in $(intersection "${hs_transports}" "${ruby_transports}"); do
+    for sock in $(intersection "${hs_sockets}" "${ruby_sockets}"); do
+      case "$sock" in
+        "ip" ) extraparam="";;
+        "ip-ssl" ) extraparam="--ssl";;
+      esac
+      do_test "hs-ruby" "binary-accel" "${trans}-${sock}" \
+              "hs/TestClient --protocol=binary --transport=${trans} ${extraparam}" \
+              "ruby rb/integration/TestServer.rb --protocol=accel --transport=${trans}" \
+              "5" "5"
+    done
+  done
+
 
 # delete Unix Domain Socket used by cpp tests
 rm -f /tmp/ThriftTest.thrift