-
Notifications
You must be signed in to change notification settings - Fork 0
/
flexisip_tester_script
executable file
·122 lines (84 loc) · 4.65 KB
/
flexisip_tester_script
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
#Script to mimic Gitlab-CI configuration of flexisip-flexisip_tester
#execute it with sh -x [script] to see variables values and command launched
FLEXISIP_LOCATION=~/flexisip
#GCI script variables
REBUILD_FLEXISIP_IMAGE_FROM_RPM=false
REBUILD_FLEXISIP_AUXILIARIES=true
REBUILD_SDK=false
SDK_VERSION=4.3
SDK_BRANCH=release/$SDK_VERSION
PARALLEL_TEST_MODE=false
DOCKER_BUILD_OPTIONS="--no-cache --force-rm -t gitlab.linphone.org:4567/bc/public/flexisip/flexisip:latest -f docker/flex-from-src --build-arg=njobs=12"
liblinphone_tester="gitlab.linphone.org:4567/bc/public/linphone-sdk/liblinphone_tester:$SDK_VERSION"
sourcedir=$FLEXISIP_LOCATION/linphone-sdk-docker
workspace=$FLEXISIP_LOCATION/liblinphone_tester_workspace
#docker compose network is default one (it is docker_default ???)
docker_run_options="--volume=$FLEXISIP_LOCATION/liblinphone_tester_workspace:/home/bc/linphone-sdk-build/linphone-sdk/desktop/work --network=docker_default --device=/dev/snd --user 1000:29"
COMPOSE_PROJECT_NAME=$RANDOM
#new variables for flexisip_tester
export FLEXISIP_DOCKER_IMAGE="gitlab.linphone.org:4567/bc/public/flexisip/flexisip"
export FLEXISIP_DOCKER_TAG="latest"
#new variables for liblinphone_tester in docker-compose
export LIBLINPHONE_DOCKER_IMAGE="gitlab.linphone.org:4567/bc/public/linphone-sdk/liblinphone_tester"
export LIBLINPHONE_DOCKER_TAG=$SDK_VERSION
if [ -z $workspace ]; then
echo "Error, $workspace should be set. Aborting to avoid unwanted rm"
exit 1
fi
mkdir -p $workspace
sudo rm -rf $workspace
mkdir -p $workspace/{bin,ext,lime-server-apache}
ls $workspace
#workaround for logs writing
sudo chown apache:apache $workspace
sudo chmod -R 777 $workspace
if [ "$REBUILD_FLEXISIP_IMAGE_FROM_RPM" = "true" ]; then
docker build $DOCKER_BUILD_OPTIONS .
fi
#--no-cache --force-rm
if [ "$REBUILD_SDK" = "true" ]; then
docker build --no-cache --force-rm -t gitlab.linphone.org:4567/bc/public/linphone-sdk/liblinphone_tester:$SDK_VERSION --build-arg="branch=$SDK_BRANCH" --build-arg="njobs=8" -f "$sourcedir/docker-files/liblinphone-tester" $sourcedir/docker-files/
fi
#Handle multiple runs
docker_compose_options=''
#Overriding docker-compose.yaml values with docker-compose-standalone.yaml in the ways specified with docker docs (either OR or AND, depending on key)
for name in 'docker-compose.yaml' 'docker-compose-standalone.yaml'; do
docker_compose_options="$docker_compose_options -f $FLEXISIP_LOCATION/flexisip-tester/docker/$name"
done
#liblinphone_tester_options='--dns-hosts none --log-file liblinphone_tester.log --xml --verbose --show-account-manager-logs'
liblinphone_tester_options="--suite Register --test \"Simple register\" --dns-hosts none --log-file liblinphone_tester.log --xml --verbose --show-account-manager-logs"
if [ "$PARALLEL_TEST_MODE" = "true" ]; then
liblinphone_tester_options="$liblinphone_tester_options --parallel"
fi
export FLEXISIP_LOGS="$workspace"
cd $workspace
docker-compose $docker_compose_options down
if [ "$REBUILD_FLEXISIP_AUXILIARIES" = "true" ]; then
docker-compose $docker_compose_options build
fi
# --exit-code-from liblinphone_tester
docker-compose $docker_compose_options up --exit-code-from liblinphone_tester |& tee logs_all | grep 'liblinphone_tester_1' || EXIT=$?
grep 'file-transfer-server_1' logs_all > file-transfer-server.log
grep 'lime-server_1' logs_all > lime-server_stdout.log
grep 'dbserver_1' logs_all > dbserver_stdout.log
grep 'account-manager_1' logs_all > account-manager_stdout.log
grep 'http-proxy_1' logs_all > http-proxy_stdout.log
grep 'redis-server_1' logs_all > redis-server_stdout.log
#docker-compose $docker_compose_options exec liblinphone_tester bash
#sleep 60
#docker run $(echo $docker_run_options) $liblinphone_tester $liblinphone_tester_options || EXIT=$? && echo 'Tests have failed'
docker-compose $docker_compose_options stop
#after script (coredump management)
# we specify commands to launch for each coredump of liblinphone_tester
echo "set debug-file-directory ../lib64" | tee gdb_options
echo "thread apply all bt" | tee -a gdb_options
# searching for core files and if there are some, launch gdb on all of it
# xargs -L1 means that the command in argument will be executed for each
# line (core dump) found in find output
# The docker syntax is error proning : to override the entrypoint with
# args, we enter the entrypoint first, then the name of the image, then the
# args to the entrypoint command.
# "true ||" is used here to continue the script even if the find fails
if [[ -n $(find . -type f -name "core*") ]]; then find . -type f -name "core*" | xargs -L1 docker run $(echo $docker_run_options) --entrypoint gdb $liblinphone_tester ../bin/liblinphone_tester -x gdb_options; fi || true
echo $EXIT