blob: a7c00bfd931e29db046999928cb4f2d3416cc488 [file] [log] [blame]
wilfrem2c69b5a2015-04-20 19:24:50 +09001#! /bin/sh
2
3DIR="$( cd "$( dirname "$0" )" && pwd )"
4
5mkdir -p $DIR/../test-compiled
6
7COMPILEDDIR="$(cd $DIR && cd ../test-compiled && pwd)"
8export NODE_PATH="${DIR}:${DIR}/../../nodejs/lib:${NODE_PATH}"
9
10compile()
11{
12 #generating thrift code
13 ${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
14 ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift
15
16 tsc --outDir $COMPILEDDIR --project $DIR/tsconfig.json
17}
18compile
19
20testServer()
21{
22 echo "start server $1"
23 RET=0
24 node ${COMPILEDDIR}/server.js $1 &
25 SERVERPID=$!
26 sleep 1
27 echo "start client $1"
28 node ${COMPILEDDIR}/client.js $1 || RET=1
29 kill -2 $SERVERPID || RET=1
30 return $RET
31}
32
33#integration tests
34
35testServer || TESTOK=1
36testServer --promise || TESTOK=1
37
38exit $TESTOK