To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / deploy / test @ 1613:90bed4e10cc8

1 1596:45b0571b684d Chris
#!/bin/bash
2
3
# The big problem with this test script is that it needs the cron
4
# scripts that generate some of this stuff to have been run at least
5
# once
6
7
usage() {
8
    echo 1>&2
9
    echo "Usage: $0 <uri-base>" 1>&2
10
    echo 1>&2
11
    echo "  e.g. $0 https://code.soundsoftware.ac.uk" 1>&2
12
    echo "    or $0 http://localhost:8080" 1>&2
13
    echo 1>&2
14
    exit 2
15
}
16
17
uribase="$1"
18
if [ -z "$uribase" ]; then
19
    usage
20
fi
21
22
set -eu
23
24 1597:eeacb8332051 Chris
# A project known to exist, be public, and have a repository
25
project_with_repo=vamp-plugin-sdk
26
27
# A project known to exist, be public, and have embedded documentation
28
project_with_docs=vamp-plugin-sdk
29
30
# A project known to exist, be public, and have a bibliography
31
project_with_biblio=sonic-visualiser
32 1596:45b0571b684d Chris
33 1612:2496b955f638 Chris
# A project known not to exist
34
nonexistent_project=nonexistent-project
35
36 1613:90bed4e10cc8 Chris
# A file for download known to exist
37
file_for_download=/attachments/download/2210/vamp-plugin-sdk-2.7.1-binaries-osx.tar.gz
38
39 1596:45b0571b684d Chris
tried=0
40
succeeded=0
41
42
mydir=$(dirname "$0")
43
44
try() {
45
    mkdir -p "$mydir/output"
46
    origin=$(pwd)
47
    cd "$mydir/output"
48
    path="$1"
49
    description="$2"
50 1612:2496b955f638 Chris
    expected="$3"
51 1596:45b0571b684d Chris
    url="$uribase$path"
52
    echo
53
    echo "Trying \"$description\" [$url]..."
54
    echo
55
    if wget "$url" ; then
56
        echo "+++ Succeeded"
57
        succeeded=$(($succeeded + 1))
58
    else
59 1612:2496b955f638 Chris
        returned="$?"
60
        if [ "$returned" = "$expected" ]; then
61
            echo "+++ Succeeded [returned expected code $expected]"
62
            succeeded=$(($succeeded + 1))
63
        else
64
            echo "--- FAILED with return code $returned"
65
        fi
66 1596:45b0571b684d Chris
    fi
67 1597:eeacb8332051 Chris
    tried=$(($tried + 1))
68
    cd "$origin"
69 1596:45b0571b684d Chris
}
70
71 1612:2496b955f638 Chris
assert() {
72
    try "$1" "$2" 0
73
}
74
75
fail() {
76
    try "$1" "$2" "$3"
77
}
78
79
assert "/" "Front page"
80
assert "/projects/$project_with_repo" "Project page"
81
assert "/projects/$project_with_biblio" "Project page with bibliography"
82
assert "/projects/$project_with_repo/repository" "Repository page"
83
assert "/hg/$project_with_repo" "Mercurial repo"
84
assert "/projects/$project_with_docs/embedded" "Project documentation page (from docgen cron script)"
85
assert "/git/$project_with_repo/info/refs" "Git repo mirror"
86 1613:90bed4e10cc8 Chris
assert "$file_for_download" "File for download"
87 1612:2496b955f638 Chris
88
# we expect this to return an http auth requirement, not a 404 - the
89
# value 6 is wget's return code for auth failure
90
fail "/hg/$nonexistent_project" "Mercurial repo" 6
91 1596:45b0571b684d Chris
92
echo
93
echo "Passed $succeeded of $tried"
94
echo