summaryrefslogtreecommitdiff
path: root/tests/tests/unrepresentable
blob: 8f451aa79d3d277f09850acae6f99efd098f7b3b (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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
#!/bin/bash
set -e
. tests/lib

t-tstunt-parsechangelog

t-prep-newpackage example 1.1

ln -s $troot/pkg-srcs/${p}_${v%-*}.orig.tar.* .

cd $p

make_singlepatch () {
	git checkout quilt-tip-1.1
	echo >debian/source/options single-debian-patch
	git add debian/source/options
	git commit -m single-debian-patch debian/source/options
}

quilt_mode=smash
case $DGIT_TEST_TESTNAME in
	*-single-dpkg) make_singlepatch ;;
	*-single-git) quilt_mode=single ;;
	*-*) fail 'unknown test name' ;;
	*) ;;
esac

quilt-fixup () {
	t-dgit -wgf --quilt=$quilt_mode quilt-fixup
}
build-source () {
	t-dgit --quilt=nofix -wgf build-source
}
run-push () {
	t-dgit -wgf --dry-run push-built --new
}
badly-raw () {
	wrongmsg=$1
	t-expect-fail "$1" \
	quilt-fixup
}
badly-late-raw () {
	quilt-fixup
	build-source
	t-expect-fail "$1" \
	run-push
}
good () {
	quilt-fixup
	build-source
	run-push
}

start () {
	path=$1
	git checkout quilt-tip-1.1~0;
}
finish () {
	case "$DGIT_TEST_TESTNAME" in
	*-single-dpkg)	expected=${2-$1} ;;
	*)		expected=$1 ;;
	esac

	case "$expected" in
	NOTHING) ;;
	*)	git commit -m "$expected" ;;
	esac

	case "$expected" in
	GOOD:*|NOTHING)
		good
		;;

	EP:*)
		wrongmsg="${expected#*:}"
		badly-raw E:"cannot represent change: $wrongmsg .*: $path"
		;;

	LATE-EP:*)
		# quilt-fixup and dpkg-source succeeded, but dgit push failed.
		# This is rather a poor outcome.
		case "$DGIT_TEST_TESTNAME" in
		*-single-dpkg)	;;
		*) fail 'push failure, other than with single-debina-patch' ;;
		esac

		wrongmsg="${expected#*:}"
		badly-late-raw "E:$wrongmsg.*: $path"
		;;

	E:* | [^A-Z]*)
		badly-raw "$expected"
		;;

	*)	fail 'bad pattern' ;;

	esac
}

start orig-symlink
	ln -sf NEWTARGET orig-symlink
	git add orig-symlink
finish EP:'modified symlink' 'new version is symlink'

start orig-symlink
	git rm -f orig-symlink
finish EP:'deletion of symlink' LATE-EP:'Mode change from 20000 to 000000'

start new
	ln -s hi new
	git add new
finish EP:'creation .* symlink' 'new version is symlink'

start src.c
	git rm src.c
finish GOOD:deleted

start orig-exec
	git rm orig-exec
finish GOOD:'deleted exec'

start orig-unwriteable
	git rm -f orig-unwriteable
finish GOOD:'deleted unwritable'

start src.c 
	chmod +x src.c
	git add src.c
finish GOOD:chmod LATE-EP:'Mode change from 644 to 755'

start newx
	echo hi >newx
	chmod 755 newx
	git add newx
finish GOOD:add-755 LATE-EP:'Mode change from 644 to 755'

start nothing
finish NOTHING NOTHING

t-ok