blob: 8180e2a1a3c29c89054bef564c2cd54263421179 [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
Jens Geyerf066d842022-06-13 23:37:25 +020013 ${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
Mustafa Senol Cosarf86845e2018-12-05 17:50:18 +030014 ${DIR}/../../../compiler/cpp/thrift -o ${DIR} --gen js:node,ts ${DIR}/../../../test/Int64Test.thrift
Jens Geyerf066d842022-06-13 23:37:25 +020015 ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/v0.16/ThriftTest.thrift
Mustafa Senol Cosarf86845e2018-12-05 17:50:18 +030016 ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/Int64Test.thrift
wilfrem2c69b5a2015-04-20 19:24:50 +090017
18 tsc --outDir $COMPILEDDIR --project $DIR/tsconfig.json
19}
20compile
21
22testServer()
23{
24 echo "start server $1"
25 RET=0
26 node ${COMPILEDDIR}/server.js $1 &
27 SERVERPID=$!
28 sleep 1
29 echo "start client $1"
30 node ${COMPILEDDIR}/client.js $1 || RET=1
31 kill -2 $SERVERPID || RET=1
32 return $RET
33}
34
Mustafa Senol Cosarf86845e2018-12-05 17:50:18 +030035node ${COMPILEDDIR}/int64.test.js || TESTOK=1
36
wilfrem2c69b5a2015-04-20 19:24:50 +090037#integration tests
38
39testServer || TESTOK=1
40testServer --promise || TESTOK=1
41
42exit $TESTOK