File: svntest-run.sh

package info (click to toggle)
subversion 1.4.2dfsg1-3
  • links: PTS
  • area: main
  • in suites: etch
  • size: 37,284 kB
  • ctags: 32,888
  • sloc: ansic: 406,472; python: 38,378; sh: 15,438; cpp: 9,604; ruby: 8,313; perl: 5,308; java: 4,576; lisp: 3,860; xml: 3,298; makefile: 856
file content (184 lines) | stat: -rwxr-xr-x 5,622 bytes parent folder | download | duplicates (2)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#!/bin/sh

EXEC_PATH="`dirname $0`"
BUILD_TYPE="$1"
RA_TYPE="$2"
FS_TYPE="$3"

# Source the configuration file.
. "$EXEC_PATH/svntest-config.sh"

# Compute local vars
LOG_FILE="$LOG_FILE_PREFIX.$BUILD_TYPE.$RA_TYPE.$FS_TYPE"
TEST="`$GUESS` $BUILD_TYPE $RA_TYPE $FS_TYPE"
REV="`$SVN st -v $SVN_SOURCE/README | $CUT -c 12-17 | $SED -e 's/^ *//'`"

# Prime and initialize the log file
$CP_F "$LOG_FILE_PREFIX.$BUILD_TYPE" $LOG_FILE
echo >> $LOG_FILE
echo "TEST: $REVPREFIX$REV on $TEST" >> $LOG_FILE
echo "TIME: $($DATE '+%Y-%m-%d %H:%M:%S %z')" >> $LOG_FILE
echo >> $LOG_FILE

# Check the build type
START "check build type" "Checking build type..."
case $BUILD_TYPE in
    shared) OBJ="$OBJ_SHARED" ;;
    static) OBJ="$OBJ_STATIC" ;;
    *)  echo "$BUILD_TYPE: unknown build type"
        echo "$BUILD_TYPE: unknown build type" >> $LOG_FILE
        FAIL ;;
esac
PASS

# Check the test type
START "check RA type" "Checking RA methd..."
case $RA_TYPE in
    ra_local) CHECK_TARGET="check" ;;
    ra_svn)   CHECK_TARGET="svncheck" ;;
    ra_dav)   CHECK_TARGET="davcheck" ;;
    *)  echo "$RA_TYPE: unknown RA type"
        echo "$RA_TYPE: unknown RA type" >> $LOG_FILE
        FAIL ;;
esac
PASS

# Check the FS type
START "check FS type" "Checking FS type..."
case $FS_TYPE in
    bdb)  CHECK_ARGS="FS_TYPE=bdb" ;;
    fsfs) CHECK_ARGS="FS_TYPE=fsfs" ;;
    *)  echo "$FS_TYPE: unknown FS type"
        echo "$FS_TYPE: unknown FS type" >> $LOG_FILE
        FAIL ;;
esac
PASS

# Check that the object directory exists, and that it contains the
# necessary executable files
START "check object directory" "Checking object directory..."
test -d $TEST_ROOT/$OBJ || FAIL; PASS
START "check svn executable" "Checking svn executable..."
test -x $INST_DIR/$SVN_NAME/bin/svn || FAIL; PASS
START "check svnadmin executable" "Checking svnadmin executable..."
test -x $INST_DIR/$SVN_NAME/bin/svnadmin || FAIL; PASS
START "check svnlook executable" "Checking svnlook executable..."
test -x $INST_DIR/$SVN_NAME/bin/svnlook || FAIL; PASS
START "check svnserve executable" "Checking svnserve executable..."
test -x $INST_DIR/$SVN_NAME/bin/svnserve || FAIL; PASS
START "check svnversion executable" "Checking svnversion executable..."
test -x $INST_DIR/$SVN_NAME/bin/svnversion || FAIL; PASS

# Build has initially mounted ramdisk for us, but this
# script will at the end to do unmount, so check if it is mounted or not
# and if it is not, do initial fire up for it
if test "xyes" = "x$RAMDISK";
then
    reinitialize_ramdisk
fi

if test "xyes" = "x$INTERMEDIATE_CLEANUP";
then
    # Flag the tests to cleanup after themselves to avoid requiring
    # hundreds of MBs of storage at once for test data.
    CHECK_ARGS="$CHECK_ARGS CLEANUP=1"
fi

# Prepare the server
case $CHECK_TARGET in
    check)
        # Nothing to do here
        ;;
    svncheck)
        START "run svnserve" "Running svnserve..."
        $TEST_ROOT/$OBJ/subversion/svnserve/svnserve -d \
            --listen-port $SVNSERVE_PORT \
            -r $TEST_ROOT/$OBJ/$RA_SVN_REPO_ROOT \
            >> $LOG_FILE 2>&1
        test $? = 0 || FAIL
        PASS

        START "get svnserve pid" "Getting svnserve process ID..."
        USER_NAME="`$ID_UN`"
        SVNSERVE_PID="`$PS_U $USER_NAME | $GREP '[s]vnserve' \
                       | $SED -e 's/^ *//' | $CUT -f 1 -d ' ' -s`"
        test -n "$SVNSERVE_PID" || FAIL
        PASS
        CHECK_ARGS="$CHECK_ARGS $RA_SVN_CHECK_ARGS"
        ;;
    davcheck)
        START "run $HTTPD_NAME" "Running $HTTPD_NAME..."
        $CP_F "$TEST_ROOT/$HTTPD_NAME.conf" \
            "$INST_DIR/$HTTPD_NAME/conf/httpd.conf" || FAIL

        $CP_F "$TEST_ROOT/mod_dav_${SVN_NAME}.conf" \
            "$INST_DIR/$HTTPD_NAME/conf/mod_dav_svn.conf" || FAIL

        "$INST_DIR/$HTTPD_NAME/bin/apachectl" start \
            >> $LOG_FILE 2>&1
        test $? = 0 || FAIL
        PASS
        CHECK_ARGS="$CHECK_ARGS $RA_DAV_CHECK_ARGS"
        ;;
esac

# Kill the server
kill_svnserve() {
    case $CHECK_TARGET in
        check)
            # Nothing to do here
            ;;
        svncheck)
            START "kill svnserve" "Stopping svnserve..."
            $KILL $SVNSERVE_PID || FAIL
            PASS
            ;;
        davcheck)
            START "kill $HTTPD_NAME" "Stopping $HTTPD_NAME..."
            "$INST_DIR/$HTTPD_NAME/bin/apachectl" stop || \
                FAIL
            PASS
            ;;
    esac

    umount_ramdisk "$TEST_ROOT/$OBJ/subversion/tests"
}

# Test
ts_start=`$DATE +"%s"`

START "make $CHECK_TARGET" "Testing $RA_TYPE on $FS_TYPE..."
CHECK_LOG_FILE="$LOG_FILE_DIR/LOG_svn_check_${BUILD_TYPE}_${RA_TYPE}_${FS_TYPE}"
cd $TEST_ROOT/$OBJ
if test "$CHECK_TARGET" = "davcheck";
then
    # At the moment we can't give repository url with
    # make davcheck, so use check & BASE_URL here for the present
    $MAKE check $CHECK_ARGS > $CHECK_LOG_FILE 2>&1
elif test "$CHECK_TARGET" = "svncheck";
then
    $MAKE check $CHECK_ARGS > $CHECK_LOG_FILE 2>&1
else
    $MAKE $CHECK_TARGET $CHECK_ARGS > $CHECK_LOG_FILE 2>&1
fi
test $? = 0 || {
    FAIL_LOG $CHECK_LOG_FILE
    $CP "tests.log" \
        "$LOG_FILE_PREFIX.log.$BUILD_TYPE.$RA_TYPE.$FS_TYPE.$REV.failed" \
        >> $LOG_FILE 2>&1

    # Prepare the log file for the mailer
    $GZIP_C < "tests.log" \
            > "$LOG_FILE_DIR/tests.$BUILD_TYPE.$RA_TYPE.$FS_TYPE.log.gz"
    FAIL kill_svnserve
}
PASS
ts_stop=`$DATE +"%s"`

START "Timer: make $CHECK_TARGET $(($ts_stop - $ts_start)) sec" \
      "Timer: make $CHECK_TARGET $(($ts_stop - $ts_start)) sec"
PASS

kill_svnserve
echo "TIME: $($DATE '+%Y-%m-%d %H:%M:%S %z')" >> $LOG_FILE