-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdebug.sh
executable file
·86 lines (76 loc) · 2.75 KB
/
debug.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
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
#!/bin/bash
set -e
set -x
cd /opt/zope
if [ ! -z "$GIT_NAME" ]; then
if [ ! -z "$GIT_BRANCH" ]; then
cd src/$GIT_NAME
git pull
if [ ! -z "$GIT_CHANGE_ID" ]; then
GIT_BRANCH=PR-${GIT_CHANGE_ID}
git fetch origin pull/$GIT_CHANGE_ID/head:$GIT_BRANCH
git checkout $GIT_BRANCH
else
git checkout $GIT_BRANCH
git pull
fi
cd ../..
sed -i "s|^$GIT_NAME .*$|$GIT_NAME = fs $GIT_NAME|g" sources-devel.cfg
if [[ "$GIT_BRANCH" == "hotfix"* || "$GIT_BRANCH" == "HOTFIX"* || "$GIT_BRANCH" == "Hotfix"* || "$GIT_BRANCH" == "HotFix"* || ! -z "$GIT_CHANGE_ID" ]]; then
echo "Switching sources-devel.cfg to master"
sed -i "s|branch=develop|branch=master|g" sources-devel.cfg
fi
fi
fi
if [[ "$GIT_BRANCH" == "master" ]]; then
echo "Switching sources-devel.cfg to master"
sed -i "s|branch=develop|branch=master|g" sources-devel.cfg
fi
bin/develop rb
python /docker-initialize.py
if [ -z "$1" ]; then
echo "============================================================="
echo "All set. Now you can dive into container and start debugging:"
echo " "
echo " $ docker exec -it <container_name_or_id> bash "
echo " $ ps aux "
echo " $ bin/instance fg "
echo " "
echo "============================================================="
exec cat
fi
# Coverage
if [ "$1" == "coverage" ]; then
cd src/$GIT_NAME
../../bin/coverage run ../../bin/xmltestreport --test-path $(pwd) -v -vv -s $GIT_NAME
../../bin/report xml --include=*$GIT_NAME*
exit 0
fi
# Tests
if [ "$1" == "tests" ]; then
for i in $(ls src); do
# Auto exclude tests
if ! grep -q "$i" bin/test; then
echo "============================================================="
echo "Auto: Skipping tests for: $i "
continue
fi
# Manual exclude tests
if [ ! -z "$EXCLUDE" ]; then
if [[ $EXCLUDE == *"$i"* ]]; then
echo "============================================================="
echo "Manual: Skipping tests for: $i "
continue
fi
fi
# Run tests
echo "============================================================="
echo "Running tests for: "
echo " "
echo " $i "
echo " "
./bin/test --test-path /opt/zope/src/$i -v -vv -s $i
done
else
exec "$@"
fi