~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to test.sh

  • Committer: Robert Collins
  • Date: 2005-10-16 00:22:17 UTC
  • mto: This revision was merged to the branch mainline in revision 1457.
  • Revision ID: robertc@lifelesslap.robertcollins.net-20051016002217-aa38f9c1eb13ee48
Plugins are now loaded under bzrlib.plugins, not bzrlib.plugin.

Plugins are also made available for other plugins to use by making them 
accessible via import bzrlib.plugins.NAME. You should not import other
plugins during the __init__ of your plugin though, as no ordering is
guaranteed, and the plugins directory is not on the python path.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /bin/sh -pe
2
 
 
3
 
# Simple shell-based tests for bzr.
4
 
 
5
 
# This is meant to exercise the external behaviour, command line
6
 
# parsing and similar things and compliment the inwardly-turned
7
 
# testing done by doctest.
8
 
 
9
 
# This must already exist and be in the right place
10
 
if ! [ -d bzr-test.tmp ] 
11
 
then
12
 
    echo "please create directory bzr-test.tmp"
13
 
    exit 1
14
 
fi
15
 
 
16
 
echo "testing `which bzr`"
17
 
bzr --version | head -n 1
18
 
echo
19
 
 
20
 
rm -rf bzr-test.tmp
21
 
mkdir bzr-test.tmp
22
 
 
23
 
# save it for real errors
24
 
exec 3>&2
25
 
 
26
 
exec > bzr-test.log
27
 
exec 2>&1 
28
 
set -x
29
 
 
30
 
quitter() {
31
 
    echo "tests failed, look in bzr-test.log" >&3; exit 2; 
32
 
}
33
 
 
34
 
trap quitter ERR
35
 
 
36
 
cd bzr-test.tmp 
37
 
rm -rf .bzr
38
 
 
39
 
mkdir branch1
40
 
cd branch1
41
 
 
42
 
# some information commands
43
 
bzr help
44
 
bzr version
45
 
 
46
 
[ $(bzr help commands | wc -l) -gt 20 ]
47
 
 
48
 
# user identification is set
49
 
bzr whoami
50
 
bzr whoami --email
51
 
 
52
 
# invalid commands are detected
53
 
! bzr pants
54
 
 
55
 
# TODO: test unicode user names
56
 
 
57
 
bzr help
58
 
 
59
 
# some experiments with renames
60
 
bzr init
61
 
echo "hello world" > test.txt
62
 
bzr unknowns
63
 
 
64
 
# should be the only unknown file
65
 
[ "`bzr unknowns`" = test.txt ]
66
 
 
67
 
bzr status --all > status.tmp
68
 
! diff -u - status.tmp <<EOF
69
 
?       status.tmp
70
 
?       test.txt
71
 
EOF
72
 
 
73
 
# command alias
74
 
bzr st --all | diff -u - status.tmp
75
 
 
76
 
# can't rename unversioned files; use the regular unix rename command
77
 
! bzr rename test.txt new-test.txt
78
 
 
79
 
# ok, so now add it and see what happens
80
 
bzr add test.txt
81
 
[ -z "`bzr unknowns`" ]
82
 
 
83
 
# after adding even before committing you can rename files
84
 
bzr rename test.txt newname.txt
85
 
[ "`bzr status`" = "A       newname.txt" ]
86
 
 
87
 
[ `bzr revno` = 0 ]
88
 
bzr commit -m "add first revision"
89
 
[ `bzr revno` = 1 ]
90
 
 
91
 
# now more complicated renames
92
 
mkdir sub1
93
 
! bzr rename newname.txt sub1
94
 
! bzr rename newname.txt sub1/foo.txt
95
 
bzr add sub1
96
 
! bzr rename newname.txt sub1
97
 
 
98
 
bzr rename newname.txt sub1/foo.txt
99
 
[ -f sub1/foo.txt ]
100
 
[ ! -f newname.txt ]
101
 
 
102
 
bzr rename sub1/foo.txt newname.txt
103
 
[ -f newname.txt ]
104
 
 
105
 
bzr rename newname.txt sub1/foo.txt
106
 
bzr rename sub1/foo.txt sub1/bar.txt
107
 
 
108
 
cd sub1
109
 
mkdir sub2
110
 
bzr add sub2
111
 
bzr rename bar.txt sub2/bar.txt
112
 
cd sub2
113
 
bzr rename bar.txt ../../bar.txt
114
 
cd ../../
115
 
 
116
 
bzr commit -m "more renames"
117
 
[ `bzr revno` = 2 ] 
118
 
 
119
 
# now try pulling that file back out, checking it was stored properly
120
 
[ "`bzr cat -r 1 newname.txt`" = "hello world" ]
121
 
 
122
 
! bzr rename sub1 sub1/knotted-up
123
 
 
124
 
 
125
 
 
126
 
 
127
 
 
128
 
# now test hardlinked branches in subdirectories
129
 
cd ..
130
 
[ -d branch2 ] && rm -rf branch2
131
 
cp -al branch1 branch2
132
 
 
133
 
cd branch2
134
 
bzr log 
135
 
[ `bzr revno` = 2 ]
136
 
 
137
 
echo "added in branch2" > new-in-2.txt
138
 
bzr add new-in-2.txt
139
 
bzr commit -m "add file to branch 2 only"
140
 
 
141
 
[ `bzr revno` = 3 ]
142
 
 
143
 
cd ../branch1
144
 
[ `bzr revno` = 2 ]
145
 
 
146
 
bzr check
147
 
 
148
 
 
149
 
echo "tests completed ok" >&3