]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | #! /bin/sh |
2 | ||
3 | DIR="$( cd "$( dirname "$0" )" && pwd )" | |
4 | ||
5 | mkdir -p $DIR/../test-compiled | |
6 | ||
7 | COMPILEDDIR="$(cd $DIR && cd ../test-compiled && pwd)" | |
8 | export NODE_PATH="${DIR}:${DIR}/../../nodejs/lib:${NODE_PATH}" | |
9 | ||
10 | compile() | |
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 ${DIR} --gen js:node,ts ${DIR}/../../../test/Int64Test.thrift | |
15 | ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/ThriftTest.thrift | |
16 | ${DIR}/../../../compiler/cpp/thrift -o ${COMPILEDDIR} --gen js:node,ts ${DIR}/../../../test/Int64Test.thrift | |
17 | ||
18 | tsc --outDir $COMPILEDDIR --project $DIR/tsconfig.json | |
19 | } | |
20 | compile | |
21 | ||
22 | testServer() | |
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 | ||
35 | node ${COMPILEDDIR}/int64.test.js || TESTOK=1 | |
36 | ||
37 | #integration tests | |
38 | ||
39 | testServer || TESTOK=1 | |
40 | testServer --promise || TESTOK=1 | |
41 | ||
42 | exit $TESTOK |