File: run-test

package info (click to toggle)
patchutils 0.3.1-2
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 1,480 kB
  • ctags: 279
  • sloc: sh: 6,676; ansic: 5,891; xml: 2,215; perl: 398; makefile: 259
file content (63 lines) | stat: -rwxr-xr-x 1,081 bytes parent folder | download | duplicates (8)
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
#!/bin/sh

# This is an interdiff(1) testcase.
# Test: Prevent patch from checking EOF when not necessary
#
# I think the reason that this fails is that patch(1) assumes that
# fewer post-context lines than pre-context lines indicates end of
# file after the post-context.
#
# Possible work-around: get interdiff(1) to trim the pre-context lines
# so that there aren't more than the post-context lines.
#
# IF YOU GET AN UNEXPECTED PASS (XPASS) when running this test you are
# probably using a version of patch(1) that is missing a fix for
# flushing stderr before exiting.


. ${top_srcdir-.}/tests/common.sh

cat << EOF > file
LINE 1
line 2
line 3
line 4
line 5
if
1
fi
if
2
fi
A
B
C
EOF
cat << EOF > patch1
--- file
+++ file
@@ -1,4 +1,4 @@
-line 1
+LINE 1
 line 2
 line 3
 line 4
EOF
cat << EOF > patch2
--- file
+++ file
@@ -5,9 +5,6 @@
 line 5
 if
 1
-fi
-if
-2
 fi
 A
 B
EOF
${INTERDIFF} patch1 patch2 2>errors >patch1-2
[ -s errors -o "$?" -gt "0" ] && { cat errors; exit 1;}
${PATCH} file < patch1-2 >errors || { cat errors; exit 1;}
if grep fuzz errors; then exit 1; fi