forked from adamlaska/datatracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-setup
More file actions
executable file
·81 lines (64 loc) · 1.89 KB
/
test-setup
File metadata and controls
executable file
·81 lines (64 loc) · 1.89 KB
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
#!/bin/bash
#
# This script expects to be started by a Buildbot slave with PWD set to the build
# directory.
# Script Setup
# ============
program=${0##*/}
progdir=${0%/*}
build=$PWD
. $progdir/shell-utils
# Patch Django
# ============
#
# Assuming we check out trunk or branch-XXX with the command
# 'svn co URL/BRANCH/'
# then this script will be $PWD/test/patch-django and we will place our patched
# django in $PWD/test/lib/django
#
say "Setting up a local Django for the test suite"
cd $build
django=$(py_module_path "django")
rsync -av $django $build/test/lib/
cd $build/test/lib
for patch in $build/test/*.patch; do
patch -p 3 -t -N < $patch
done
# Database setup
# ==============
#say "Setting up a database for the test suite"
# Project Setup
# =============
# put in place a suitable settings_local.py for our application to find. This should
# be based on the local settings_local.py, but should add test-specific settings, and
# should set things up so that we use the patched Django, not the system's default
# Django.
say "Setting up the Django settings for the test suite"
cd $build
settings_local=$(py_module_file "settings_local")
[ "$settings_local" ] || die "No setting_local file available"
cat $settings_local test/settings_local_test.py > test/settings_local.py
# Acquire lock, to prevent running test and database update at the same time
LOCKDIR=/var/lock/ietfdb
PIDFILE=$LOCKDIR/pid
while true; do
if mkdir $LOCKDIR; then
echo "$$" > $PIDFILE
chmod a+rwx $LOCKDIR
chmod a+rw $PIDFILE
break
else
pid=$(< $PIDFILE )
[ "$pid" ] || die "Couldn't read pidfile '$PIDFILE'"
if kill -0 $pid; then
echo "Pidfile for process $pid exists, and process is running. Sleeping."
sleep 10
else
echo "Pidfile for process $pid exists, but process isn't running."
echo "Removing lock and old pid file $pidfile."
rm -rf $LOCKDIR
break
fi
fi
done
exit $warnings