From ba20a04b8729a6775a75c70feeef8ddfeb38ae79 Mon Sep 17 00:00:00 2001 From: cdwijayarathna Date: Fri, 15 Aug 2014 22:18:30 +0530 Subject: [PATCH] THRIFT-847 Test Framework harmonization across all languages THRIFT-847 Test Framework harmonization across all languages THRIFT-847 Test Framework harmonization across all languages --- contrib/installDependencies.sh | 2 +- lib/hs/Thrift.cabal | 2 +- test/hs/TestClient.hs | 59 +++--- test/hs/TestServer.hs | 97 ++++----- test/test.sh | 368 +++++++++++++++++++++++---------- test/tests.json | 48 ++++- 6 files changed, 384 insertions(+), 192 deletions(-) mode change 100644 => 100755 test/hs/TestServer.hs diff --git a/contrib/installDependencies.sh b/contrib/installDependencies.sh index 343ea7e81b..50141e02cb 100755 --- a/contrib/installDependencies.sh +++ b/contrib/installDependencies.sh @@ -27,7 +27,7 @@ sh ${SCRIPTPATH}/installCXXDependencies.sh # 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 f847663d6e..1b71ca79ec 100755 --- a/lib/hs/Thrift.cabal +++ b/lib/hs/Thrift.cabal @@ -68,6 +68,6 @@ Test-Suite tests 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 35e8397fd9..2b9254b031 100644 --- a/test/hs/TestClient.hs +++ b/test/hs/TestClient.hs @@ -23,6 +23,7 @@ module Main where 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 :: (Protocol p, Transport t) => p t -> IO () 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 @@ runClient p = do -- 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 @@ runClient p = do , 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 @@ runClient p = do } 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 @@ runClient p = do -- 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 @@ main = do 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 @@ showHelp = putStrLn \ -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 old mode 100644 new mode 100755 index 340b58b68c..e3f3241c50 --- a/test/hs/TestServer.hs +++ b/test/hs/TestServer.hs @@ -25,6 +25,7 @@ import Control.Monad 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 @@ data Options = Options , ssl :: Bool , workers :: Int } - + data ServerType = Simple | ThreadPool | Threaded @@ -93,42 +94,42 @@ defaultOptions = Options } 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 @@ instance ThriftTest_Iface TestHandler where 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 @@ instance ThriftTest_Iface TestHandler where 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 @@ instance ThriftTest_Iface TestHandler where ] testInsanity _ x = do - putStrLn "testInsanity()" + System.IO.putStrLn "testInsanity()" return $ Map.fromList [ (1, Map.fromList [ (TWO , x) , (THREE, x) ]) @@ -192,32 +193,32 @@ instance ThriftTest_Iface TestHandler where ] 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 @@ main = do 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 @@ main = do 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 @@ showHelp = putStrLn \ --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 3a284296e0..0eeefe5196 100755 --- a/test/test.sh +++ b/test/test.sh @@ -212,91 +212,6 @@ hs_protocols="binary compact json" 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 @@ for proto in ${py_protocols}; do "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 @@ for trans in ${py_transports}; do "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 @@ for proto in $(intersection "${cpp_protocols}" "${py_protocols}"); do "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 @@ for trans in $(intersection "${cpp_transports}" "${py_transports}"); do "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 @@ for proto in $(intersection "${cpp_protocols}" "${py_protocols}"); do 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 @@ for trans in $(intersection "${cpp_transports}" "${py_transports}"); do 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 @@ for proto in $(intersection "${py_protocols}" "${java_protocols}"); do "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 @@ for trans in $(intersection "${py_transports}" "${java_server_transports}"); do "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 @@ for proto in $(intersection "${py_protocols}" "${java_protocols}"); do 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 @@ for trans in $(intersection "${py_transports}" "${java_client_transports}"); do 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 @@ for proto in $(intersection "${py_protocols}" "${nodejs_protocols}"); do "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 @@ for trans in $(intersection "${py_transports}" "${nodejs_transports}"); do "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 @@ for proto in $(intersection "${py_protocols}" "${nodejs_protocols}"); do 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 @@ for trans in $(intersection "${py_transports}" "${nodejs_transports}"); do 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 @@ for trans in $(intersection "${ruby_transports}" "${nodejs_transports}"); do 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 @@ for proto in $(intersection "${py_protocols}" "${ruby_protocols}"); do "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 @@ for trans in $(intersection "${py_transports}" "${ruby_transports}"); do "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 @@ for proto in $(intersection "${py_protocols}" "${ruby_protocols}"); do 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 @@ for trans in $(intersection "${py_transports}" "${ruby_transports}"); do 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 diff --git a/test/tests.json b/test/tests.json index 8d2b16ca33..5abafdf330 100644 --- a/test/tests.json +++ b/test/tests.json @@ -28,7 +28,7 @@ "description": "C++ TestClient", "lib": "cpp", "executable": "cpp/TestClient", - "exit": "soft", + "exit": "hard", "protocols": [ "binary", "compact", @@ -97,7 +97,7 @@ "lib": "java", "executable": ["ant","-f","../lib/java/build.xml","-Dno-gen-thrift=\"\""], "extra_args": ["run-testclient"], - "exit": "soft", + "exit": "hard", "protocols": [ "binary", "compact", @@ -116,6 +116,26 @@ "platform": [ "Linux" ] + }, + { + "description": "Haskell TestClient", + "lib": "hs", + "executable": "hs/TestClient", + "exit": "hard", + "protocols": [ + "binary", + "compact", + "json" + ], + "transports": [ + "buffered" + ], + "sockets": [ + "ip" + ], + "platform": [ + "Linux" + ] } ], "server": [ @@ -125,7 +145,7 @@ "executable": "py/TestServer.py", "extra_args": ["--genpydir=gen-py", "TSimpleServer"], "extra_delay": 0, - "exit": "hard", + "exit": "soft", "protocols": [ "binary", "compact", @@ -217,7 +237,7 @@ "lib": "java", "executable": ["ant","-f","../lib/java/build.xml","-Dno-gen-thrift=\"\""], "extra_args": ["run-testserver"], - "exit": "soft", + "exit": "hard", "protocols": [ "binary", "compact", @@ -235,6 +255,26 @@ "platform": [ "Linux" ] + }, + { + "description": "Haskell TestServer", + "lib": "hs", + "executable": "hs/TestServer", + "exit": "hard", + "protocols": [ + "binary", + "compact", + "json" + ], + "transports": [ + "buffered" + ], + "sockets": [ + "ip" + ], + "platform": [ + "Linux" + ] } ] }