Show More
@@ -0,0 +1,27 b'' | |||
|
1 | A simple testing framework | |
|
2 | ||
|
3 | This finds all scripts in the test directory named test-* and executes | |
|
4 | them. The scripts can be either shell scripts or Python. Each test is | |
|
5 | run in a temporary directory that is removed when the test is complete. | |
|
6 | ||
|
7 | A test-<x> succeeds if the script returns success and its output | |
|
8 | matches test-<x>.out. If the new output doesn't match, it is stored in | |
|
9 | test-<x>.err. | |
|
10 | ||
|
11 | There are some tricky points here that you should be aware of when | |
|
12 | writing tests: | |
|
13 | ||
|
14 | - hg commit and hg up -m want user interaction | |
|
15 | ||
|
16 | for commit use -t "text" | |
|
17 | for hg up -m, set HGMERGE to something noninteractive (like true or merge) | |
|
18 | ||
|
19 | - changeset hashes will change based on user and date which make | |
|
20 | things like hg history output change | |
|
21 | ||
|
22 | use commit -t "test" -u test -d "0 0" | |
|
23 | ||
|
24 | - diff will show the current time | |
|
25 | ||
|
26 | use hg diff | sed "s/\(\(---\|+++\).*\)\t.*/\1/" to strip dates | |
|
27 |
@@ -0,0 +1,46 b'' | |||
|
1 | #!/bin/bash | |
|
2 | ||
|
3 | set -e | |
|
4 | ||
|
5 | tests=0 | |
|
6 | failed=0 | |
|
7 | H=$PWD | |
|
8 | ||
|
9 | for f in `ls test-* | grep -Ev "\.|~"` ; do | |
|
10 | echo -n "." | |
|
11 | D=`mktemp -d` | |
|
12 | if [ "$D" == "" ] ; then | |
|
13 | echo mktemp failed! | |
|
14 | fi | |
|
15 | ||
|
16 | cd $D | |
|
17 | fail=0 | |
|
18 | if ! $H/$f > .out 2>&1 ; then | |
|
19 | echo $f failed with error code $? | |
|
20 | fail=1 | |
|
21 | fi | |
|
22 | if [ -s .out -a ! -r $H/$f.out ] ; then | |
|
23 | echo $f generated unexpected output: | |
|
24 | cat .out | |
|
25 | cp .out $H/$f.err | |
|
26 | fail=1 | |
|
27 | elif ! diff -u $H/$f.out .out > /dev/null ; then | |
|
28 | echo $f output changed: | |
|
29 | diff -u $H/$f.out .out && true | |
|
30 | cp .out $H/$f.err | |
|
31 | fi | |
|
32 | ||
|
33 | cd $H | |
|
34 | rm -r $D | |
|
35 | ||
|
36 | failed=$[$failed + $fail] | |
|
37 | tests=$[$tests + 1] | |
|
38 | done | |
|
39 | ||
|
40 | echo | |
|
41 | echo Ran $tests tests, $failed failed | |
|
42 | ||
|
43 | if [ $failed -gt 0 ] ; then | |
|
44 | exit 1 | |
|
45 | fi | |
|
46 |
@@ -0,0 +1,13 b'' | |||
|
1 | #!/bin/bash | |
|
2 | ||
|
3 | set -x | |
|
4 | mkdir t | |
|
5 | cd t | |
|
6 | hg init | |
|
7 | echo a > a | |
|
8 | hg add a | |
|
9 | hg commit -t "test" -u test -d "0 0" | |
|
10 | hg history | |
|
11 | hg manifest | |
|
12 | hg cat a | |
|
13 | hg verify No newline at end of file |
@@ -0,0 +1,22 b'' | |||
|
1 | + mkdir t | |
|
2 | + cd t | |
|
3 | + hg init | |
|
4 | + echo a | |
|
5 | + hg add a | |
|
6 | + hg commit -t test -u test -d '0 0' | |
|
7 | + hg history | |
|
8 | changeset: 0:acb14030fe0a21b60322c440ad2d20cf7685a376 | |
|
9 | user: test | |
|
10 | date: Wed Dec 31 16:00:00 1969 | |
|
11 | summary: test | |
|
12 | ||
|
13 | + hg manifest | |
|
14 | b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3 644 a | |
|
15 | + hg cat a | |
|
16 | a | |
|
17 | + hg verify | |
|
18 | checking changesets | |
|
19 | checking manifests | |
|
20 | crosschecking files in changesets and manifests | |
|
21 | checking files | |
|
22 | 1 files, 1 changesets, 1 total revisions |
@@ -0,0 +1,45 b'' | |||
|
1 | + hg help | |
|
2 | hg commands: | |
|
3 | ||
|
4 | add add the specified files on the next commit | |
|
5 | addremove add all new files, delete all missing files | |
|
6 | annotate show changeset information per file line | |
|
7 | cat output the latest or given revision of a file | |
|
8 | commit commit the specified files or all outstanding changes | |
|
9 | diff diff working directory (or selected files) | |
|
10 | export dump the changeset header and diffs for a revision | |
|
11 | forget don't add the specified files on the next commit | |
|
12 | heads show current repository heads | |
|
13 | help show help for a given command or all commands | |
|
14 | history show the changelog history | |
|
15 | init create a new repository or copy an existing one | |
|
16 | log show the revision history of a single file | |
|
17 | manifest output the latest or given revision of the project manifest | |
|
18 | parents show the parents of the current working dir | |
|
19 | patch import an ordered set of patches | |
|
20 | pull pull changes from the specified source | |
|
21 | push push changes to the specified destination | |
|
22 | rawcommit raw commit interface | |
|
23 | recover roll back an interrupted transaction | |
|
24 | remove remove the specified files on the next commit | |
|
25 | serve export the repository via HTTP | |
|
26 | status show changed files in the working directory | |
|
27 | tags list repository tags | |
|
28 | tip show the tip revision | |
|
29 | undo undo the last transaction | |
|
30 | update update or merge working directory | |
|
31 | verify verify the integrity of the repository | |
|
32 | + hg add -h | |
|
33 | hg add: option -h not recognized | |
|
34 | hg add [files] | |
|
35 | ||
|
36 | add the specified files on the next commit | |
|
37 | + hg help diff | |
|
38 | hg diff [-r A] [-r B] [files] | |
|
39 | ||
|
40 | -r --rev | |
|
41 | revision | |
|
42 | ||
|
43 | diff working directory (or selected files) | |
|
44 | + hg help foo | |
|
45 | hg: unknown command foo |
@@ -0,0 +1,26 b'' | |||
|
1 | #!/bin/bash | |
|
2 | ||
|
3 | set -ex | |
|
4 | ||
|
5 | mkdir test | |
|
6 | cd test | |
|
7 | echo foo>foo | |
|
8 | hg init | |
|
9 | hg addremove | |
|
10 | hg commit -t "1" | |
|
11 | hg verify | |
|
12 | cd .. | |
|
13 | ||
|
14 | mkdir branch | |
|
15 | cd branch | |
|
16 | hg init ../test | |
|
17 | hg co | |
|
18 | echo bar>>foo | |
|
19 | hg commit -t "2" | |
|
20 | ||
|
21 | cd ../test | |
|
22 | hg pull ../branch | |
|
23 | hg verify | |
|
24 | hg co | |
|
25 | cat foo | |
|
26 | hg manifest No newline at end of file |
@@ -0,0 +1,38 b'' | |||
|
1 | + mkdir test | |
|
2 | + cd test | |
|
3 | + echo foo | |
|
4 | + hg init | |
|
5 | + hg addremove | |
|
6 | + hg commit -t 1 | |
|
7 | + hg verify | |
|
8 | checking changesets | |
|
9 | checking manifests | |
|
10 | crosschecking files in changesets and manifests | |
|
11 | checking files | |
|
12 | 1 files, 1 changesets, 1 total revisions | |
|
13 | + cd .. | |
|
14 | + mkdir branch | |
|
15 | + cd branch | |
|
16 | + hg init ../test | |
|
17 | + hg co | |
|
18 | + echo bar | |
|
19 | + hg commit -t 2 | |
|
20 | + cd ../test | |
|
21 | + hg pull ../branch | |
|
22 | searching for changes | |
|
23 | adding changesets | |
|
24 | adding manifests | |
|
25 | adding file revisions | |
|
26 | modified 1 files, added 1 changesets and 1 new revisions | |
|
27 | + hg verify | |
|
28 | checking changesets | |
|
29 | checking manifests | |
|
30 | crosschecking files in changesets and manifests | |
|
31 | checking files | |
|
32 | 1 files, 2 changesets, 2 total revisions | |
|
33 | + hg co | |
|
34 | + cat foo | |
|
35 | foo | |
|
36 | bar | |
|
37 | + hg manifest | |
|
38 | 6f4310b00b9a147241b071a60c28a650827fb03d 644 foo |
@@ -0,0 +1,35 b'' | |||
|
1 | #!/bin/bash | |
|
2 | ||
|
3 | export HGMERGE=true | |
|
4 | ||
|
5 | set -ex | |
|
6 | mkdir r1 | |
|
7 | cd r1 | |
|
8 | hg init | |
|
9 | echo a > a | |
|
10 | hg addremove | |
|
11 | hg commit -t "1" -u test -d "0 0" | |
|
12 | ||
|
13 | cd .. | |
|
14 | mkdir r2 | |
|
15 | cd r2 | |
|
16 | hg init ../r1 | |
|
17 | hg up | |
|
18 | echo abc > a | |
|
19 | hg diff | sed "s/\(\(---\|+++\).*\)\t.*/\1/" | |
|
20 | ||
|
21 | cd ../r1 | |
|
22 | echo b > b | |
|
23 | echo a2 > a | |
|
24 | hg addremove | |
|
25 | hg commit -t "2" -u test -d "0 0" | |
|
26 | ||
|
27 | cd ../r2 | |
|
28 | hg -q pull ../r1 | |
|
29 | hg status | |
|
30 | hg -d up | |
|
31 | hg -d up -m | |
|
32 | hg parents | |
|
33 | hg -v history | |
|
34 | hg diff | sed "s/\(\(---\|+++\).*\)\t.*/\1/" | |
|
35 |
@@ -0,0 +1,70 b'' | |||
|
1 | + mkdir r1 | |
|
2 | + cd r1 | |
|
3 | + hg init | |
|
4 | + echo a | |
|
5 | + hg addremove | |
|
6 | + hg commit -t 1 -u test -d '0 0' | |
|
7 | + cd .. | |
|
8 | + mkdir r2 | |
|
9 | + cd r2 | |
|
10 | + hg init ../r1 | |
|
11 | + hg up | |
|
12 | + echo abc | |
|
13 | + hg diff | |
|
14 | + sed 's/\(\(---\|+++\).*\)\t.*/\1/' | |
|
15 | --- a/a | |
|
16 | +++ b/a | |
|
17 | @@ -1,1 +1,1 @@ | |
|
18 | -a | |
|
19 | +abc | |
|
20 | + cd ../r1 | |
|
21 | + echo b | |
|
22 | + echo a2 | |
|
23 | + hg addremove | |
|
24 | + hg commit -t 2 -u test -d '0 0' | |
|
25 | + cd ../r2 | |
|
26 | + hg -q pull ../r1 | |
|
27 | + hg status | |
|
28 | C a | |
|
29 | + hg -d up | |
|
30 | resolving manifests | |
|
31 | ancestor a0c8bcbb local a0c8bcbb remote 1165e8bd | |
|
32 | a versions differ, resolve | |
|
33 | remote created b | |
|
34 | getting b | |
|
35 | merging a | |
|
36 | resolving a | |
|
37 | file a: other d730145a ancestor b789fdd9 | |
|
38 | + hg -d up -m | |
|
39 | resolving manifests | |
|
40 | ancestor 1165e8bd local 1165e8bd remote 1165e8bd | |
|
41 | + hg parents | |
|
42 | changeset: 1:1e71731e6fbb5b35fae293120dea6964371c13c6 | |
|
43 | user: test | |
|
44 | date: Wed Dec 31 16:00:00 1969 | |
|
45 | summary: 2 | |
|
46 | ||
|
47 | + hg -v history | |
|
48 | changeset: 1:1e71731e6fbb5b35fae293120dea6964371c13c6 | |
|
49 | manifest: 1:1165e8bd193e17ad7d321d846fcf27ff3f412758 | |
|
50 | user: test | |
|
51 | date: Wed Dec 31 16:00:00 1969 | |
|
52 | files: a b | |
|
53 | description: | |
|
54 | 2 | |
|
55 | ||
|
56 | changeset: 0:c19d34741b0a4ced8e4ba74bb834597d5193851e | |
|
57 | manifest: 0:a0c8bcbbb45c63b90b70ad007bf38961f64f2af0 | |
|
58 | user: test | |
|
59 | date: Wed Dec 31 16:00:00 1969 | |
|
60 | files: a | |
|
61 | description: | |
|
62 | 1 | |
|
63 | ||
|
64 | + hg diff | |
|
65 | + sed 's/\(\(---\|+++\).*\)\t.*/\1/' | |
|
66 | --- a/a | |
|
67 | +++ b/a | |
|
68 | @@ -1,1 +1,1 @@ | |
|
69 | -a2 | |
|
70 | +abc |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now