-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.sh
executable file
·49 lines (39 loc) · 1.15 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
set -e
Help()
{
# Display Help
echo "Generates the test client and server Dart code and runs tests against it."
echo
echo "Syntax: test.sh [-r|h]"
echo "options:"
echo "h prints this help message"
echo "r path/to/webrpc/bin if using a local version of the base webrpc repo"
echo
}
tmp=".tmp"
webrpc_root=$tmp
while getopts ":hr:" option; do
case $option in
h) # display Help
Help
exit;;
r) # Enter a name
webrpc_root=$OPTARG;;
\?) # Invalid option
echo "Error: Invalid option"
exit;;
esac
done
export PORT=9988
ref_schema="$tmp/test.ridl"
webrpcgen="$webrpc_root/webrpc-gen"
webrpctest="$webrpc_root/webrpc-test"
./$webrpctest -version
./$webrpctest -print-schema > $ref_schema
./$webrpcgen -schema=$ref_schema -target=../ -client -out=lib/ref_client.dart
./$webrpcgen -schema="schema/custom.ridl" -target=../ -client -out=lib/custom_client.dart
./$webrpctest -server -port=$PORT -timeout=60s &
# Wait until http://localhost:$PORT is available, up to 10s.
for (( i=0; i<100; i++ )); do nc -z localhost $PORT && break || sleep 0.1; done
dart test --chain-stack-traces