Contents of /tags/mkinitrd-6_3_1/busybox/testsuite/patch.tests
Parent Directory | Revision Log
Revision 1143 -
(show annotations)
(download)
Thu Aug 19 12:44:27 2010 UTC (14 years, 1 month ago) by niro
File size: 1638 byte(s)
Thu Aug 19 12:44:27 2010 UTC (14 years, 1 month ago) by niro
File size: 1638 byte(s)
tagged 'mkinitrd-6_3_1'
1 | #!/bin/sh |
2 | # Copyright 2008 by Denys Vlasenko |
3 | # Licensed under GPL v2, see file LICENSE for details. |
4 | |
5 | . ./testing.sh |
6 | |
7 | # testing "test name" "options" "expected result" "file input" "stdin" |
8 | |
9 | testing "patch with old_file == new_file" \ |
10 | 'patch; echo $?; cat input' \ |
11 | "\ |
12 | patching file input |
13 | 0 |
14 | qwe |
15 | asd |
16 | zxc |
17 | " \ |
18 | "\ |
19 | qwe |
20 | zxc |
21 | " \ |
22 | "\ |
23 | --- input Jan 01 01:01:01 2000 |
24 | +++ input Jan 01 01:01:01 2000 |
25 | @@ -1,2 +1,3 @@ |
26 | qwe |
27 | +asd |
28 | zxc |
29 | " \ |
30 | |
31 | testing "patch with nonexistent old_file" \ |
32 | 'patch; echo $?; cat input' \ |
33 | "\ |
34 | patching file input |
35 | 0 |
36 | qwe |
37 | asd |
38 | zxc |
39 | " \ |
40 | "\ |
41 | qwe |
42 | zxc |
43 | " \ |
44 | "\ |
45 | --- input.doesnt_exist Jan 01 01:01:01 2000 |
46 | +++ input Jan 01 01:01:01 2000 |
47 | @@ -1,2 +1,3 @@ |
48 | qwe |
49 | +asd |
50 | zxc |
51 | " \ |
52 | |
53 | testing "patch -R with nonexistent old_file" \ |
54 | 'patch -R; echo $?; cat input' \ |
55 | "\ |
56 | patching file input |
57 | 0 |
58 | qwe |
59 | zxc |
60 | " \ |
61 | "\ |
62 | qwe |
63 | asd |
64 | zxc |
65 | " \ |
66 | "\ |
67 | --- input.doesnt_exist Jan 01 01:01:01 2000 |
68 | +++ input Jan 01 01:01:01 2000 |
69 | @@ -1,2 +1,3 @@ |
70 | qwe |
71 | +asd |
72 | zxc |
73 | " \ |
74 | |
75 | testing "patch detects already applied hunk" \ |
76 | 'patch 2>&1; echo $?; cat input' \ |
77 | "\ |
78 | patching file input |
79 | patch: hunk #1 FAILED at 1 |
80 | patch: 1 out of 1 hunk FAILED |
81 | 1 |
82 | abc |
83 | def |
84 | 123 |
85 | " \ |
86 | "\ |
87 | abc |
88 | def |
89 | 123 |
90 | " \ |
91 | "\ |
92 | --- input.old Jan 01 01:01:01 2000 |
93 | +++ input Jan 01 01:01:01 2000 |
94 | @@ -1,2 +1,3 @@ |
95 | abc |
96 | +def |
97 | 123 |
98 | " \ |
99 | |
100 | # Currently fails (erroneously appends second "456" line): |
101 | false && testing "patch detects already applied hunk" \ |
102 | 'patch 2>&1; echo $?; cat input' \ |
103 | "\ |
104 | patching file input |
105 | patch: hunk #1 FAILED at 2 |
106 | patch: 1 out of 1 hunk FAILED |
107 | 1 |
108 | abc |
109 | 123 |
110 | 456 |
111 | " \ |
112 | "\ |
113 | abc |
114 | 123 |
115 | 456 |
116 | " \ |
117 | "\ |
118 | --- input.old Jan 01 01:01:01 2000 |
119 | +++ input Jan 01 01:01:01 2000 |
120 | @@ -1,2 +1,3 @@ |
121 | abc |
122 | 123 |
123 | +456 |
124 | " \ |
125 | |
126 | rm input.orig 2>/dev/null |
127 | |
128 | exit $FAILCOUNT |