aboutsummaryrefslogtreecommitdiff
path: root/testsuite/gerrit-tests.sh
blob: 8df440af1a5a4708dc46abba78d4fb6672b1fd15 (plain)
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
# tests for the gerrit REST API functions

echo "============= gerrit() tests ================"

review="/tmp/.gitreview"
cat <<EOF > ${review}
[gerrit]
	host=review.linaro.org
	port=29418
	project=toolchain/abe

[gitreview]
	username=buildslave
EOF

srcdir="/tmp"

# FIXME: Note these following test cases only PASS if you have the source
# directories created already.
if test -d ${srcdir}; then
    fail_state=fail
else
    fail_state=untested
fi

out="`extract_gerrit_host ${srcdir}`"
if test x"${out}" = x"review.linaro.org"; then
    pass extract_gerrit_host""
else
    ${fail_state} "extract_gerrit_host"
    fixme "extract_gerrit_host returned ${out}"
fi

out="`extract_gerrit_project ${srcdir}`"
if test x"${out}" = x"toolchain/abe"; then
    pass extract_gerrit_project""
else
    ${fail_state} "extract_gerrit_project"
    fixme "extract_gerrit_project returned ${out}"
fi

out="`extract_gerrit_username ${srcdir}`"
if test x"${out}" = x"buildslave"; then
    pass extract_gerrit_project""
else
    ${fail_state} "extract_gerrit_project"
    fixme "extract_gerrit_project returned ${out}"
fi

out="`extract_gerrit_port ${srcdir}`"
if test x"${out}" = x"29418"; then
    pass "extract_gerrit_port"
else
    ${fail_state} "extract_gerrit_port"
    fixme "extract_gerrit_port returned ${out}"
fi

rm -f ${review}

# FIXME: Note these following test cases only PASS if you have the source
# directories created already.
#srcdir="${local_snapshots}/gcc.git"
srcdir="/linaro/shared/snapshots/gcc.git"
if test -d ${srcdir}; then
    out="`get_git_revision ${srcdir}`"
    out="`echo ${out} | grep -o [a-z0-9]\*`"
    if test x"${out}" != x; then
	pass "get_git_revision"
    else
	${fail_state} "get_git_revision"
	fixme "get_git_revision returned ${out}"
    fi
fi