File: 2006_02_18_makeppbuiltin.test

package info (click to toggle)
makepp 2.0.98.5-2.1
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 2,744 kB
  • sloc: perl: 15,893; makefile: 38; javascript: 25; sh: 1
file content (258 lines) | stat: -rw-r--r-- 5,800 bytes parent folder | download | duplicates (3)
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
###	SPAR <http://www.cpan.org/scripts/>
###	34	755	1154536064	1224957725	makepp_test_script.pl
#
# This if a multiple hack.  First we steal the contents of another test, because
# we want to test the same things, only invoked from the command line.  Then we
# call makepp to tell us what it would have done, so we can inherit any future
# changes as well.  Then we call makeppbuiltin once, and perform everything
# internally, so that we don't have to fork exec perl many times.  This is not
# how makeppbuiltin usually works, but builtins within a rule do.
#

# Slurp this test into our directory.
open DATA, "$Mpp::source_path/builtins.test" or
  die "can't find builtins.test near here--$!\n";
eval { un_spar() };

# makepp --dry-run barfs at rules treating plain file as dir.
rename dir2 => 'tempdir2';
mkdir 'dir2';

# Ask politely what we need to do.
{
  open my $fh, '>&STDOUT';
  open STDOUT, '>commands';
  makepp '--dry-run';
  open STDOUT, '>&', $fh;
  close $fh;
}

# Restore the way it was in builtins.test.
rmdir 'dir2';
rename 'tempdir2' => dir2;

# We don't start a real command, just use this to get our code loaded
# within the context of makeppbuiltin.
makepp \'builtin', '-Mworker', 'clonetest';
###	43	644	1153861432	1140276843	worker.pm
use mymodule;
# Normally from the command line the commands can inherit nothing from the
# context of their makefile (since there is none).  But here we rerun tests
# that do have such a context, so get it from the makefile.
open my $mf, 'RootMakeppfile' or die $!;
while( <$mf> ) {
  print, eval if
    /^sub / or
    s/^perl /eval / or
    s/^(\w+) *= *(.*)/our \$$1 = '$2'/;
}

# pseudocommand which in fact runs all the others
sub c_clonetest {
  open my $fh, 'commands';
  while( <$fh> ) {
    next if ord != ord '&';
    warn $_;
    chop;
    my $comment = Mpp::Text::find_unquoted $_, '#';
    $_ = substr $_, 0, $comment if $comment > -1;
    $0 = 'makeppbuiltin';
    @ARGV = Mpp::Text::unquote_split_on_whitespace $_;
    substr( $ARGV[0], 0, 1 ) = ''; # Remove &
    eval { Mpp::doit }; warn $@ if $@;
  }

  # We don't know how many files we created, but just to satisfy the test harness:
  Mpp::Cmds::c_sed 's/(\d+) (\d+) (\d+)/N_FILES\01$1\01$2\01$3\01/', 'answers/n_files', '-o', '.makepp/log';

  # Now do as makeppbuiltin does with --help.
  @ARGV = '--help';
  open STDERR, '>help';
  for $0 ( sort grep { /^c_/ and defined &{"Mpp::Cmds::$_"} } keys %Mpp::Cmds:: ) {
    eval { Mpp::doit };
    warn "\n";
  }
  close STDERR;

  unlink 'answers/help' if 'a' lt 'A';	# Ebcdic does it the other way round, failing on -i/-I
}

1;
###	D	755	1140344139	1140344139	answers
###	176	644	1153678523	1402433959	answers/help
cat options:
  -f, --force
  -i, --inpipe=arg
  -I, --infail
  -o, --output=arg
  -O, --outfail
  -S, --sync-lines
  -v, --verbose
chmod options:
  -v, --verbose
cp options:
  -f, --force
  -l, --link
  -s, --symbolic-link
  -v, --verbose
cut options:
  -c, --characters=arg
  -d, --delimiter=arg
  -E, --no-escape
  -f, --fields=arg
      --force
  -i, --inpipe=arg
  -I, --infail
  -l, --lines=arg
  -m, --matching
  -o, --output=arg
  -O, --outfail
  -p, --printf=arg
  -r, --record-size=arg
  -s, --only-delimited
      --separator=arg
  -S, --sync-lines
  -v, --verbose
echo options:
  -E, --no-escape
  -f, --force
  -n, --no-newline
  -o, --output=arg
  -O, --outfail
  -v, --verbose
expr options:
  -f, --force
  -n, --no-newline
  -o, --output=arg
  -O, --outfail
  -v, --verbose
grep options:
  -c, --count
  -f, --force
  -i, --inpipe=arg
  -I, --infail
  -l, --list, --files-with-matches
  -o, --output=arg
  -O, --outfail
  -r, --record-size=arg
  -s, --separator=arg
  -S, --sync-lines
  -v, --vice-versa, --revert-match
      --verbose
  -w, --waste-file=arg
install options:
  -c, --copy
  -d, --directory
  -g, --group=arg
  -l, --link
      --logfile=arg
  -m, --mode=arg
  -o, --owner=arg
  -r, --resolve-symbolic-link
  -s, --strip
  -S, --symbolic-link
  -v, --verbose
ln options:
  -f, --force
  -r, --resolve-symbolic-link
  -s, --symbolic-link
  -v, --verbose
mkdir options:
  -f, --force
  -m, --mode=arg
  -p, --parent
  -v, --verbose
mv options:
  -f, --force
  -v, --verbose
perl options:
  -f, --force
  -i, --inpipe=arg
  -I, --infail
  -o, --output=arg
  -O, --outfail
  -r, --record-size=arg
  -s, --separator=arg
  -S, --sync-lines
  -v, --verbose
preprocess options:
  -a, --assignment
  -f, --force
  -h, --hashref=arg
  -o, --output=arg
  -O, --outfail
  -S, --sync-lines
  -v, --verbose
printf options:
  -E, --no-escape
  -f, --force
  -o, --output=arg
  -O, --outfail
  -v, --verbose
rm options:
  -f, --force
  -m, --metainfo
  -v, --verbose
sed options:
  -f, --force
  -i, --inpipe=arg
  -I, --infail
  -o, --output=arg
  -O, --outfail
  -r, --record-size=arg
  -s, --separator=arg
  -S, --sync-lines
  -v, --verbose
sort options:
  -c, --compare=arg
  -d, --detransform=arg
  -f, --force
  -i, --inpipe=arg
  -I, --infail
  -n, --numeric-sort
  -o, --output=arg
  -O, --outfail
  -r, --reverse
      --record-size=arg
  -s, --separator=arg
  -t, --transform=arg
  -u, --unique
  -v, --verbose
template options:
  -d, --defined
  -f, --force
  -h, --hashref=arg
  -i, --inpipe=arg
  -I, --infail
  -m, --multiline=arg
  -o, --output=arg
  -O, --outfail
  -r, --record-size=arg
  -s, --simple=arg
      --separator=arg
  -S, --sync-lines
  -v, --verbose
touch options:
  -v, --verbose
uninstall options:
  -i, --inpipe=arg
  -I, --infail
  -v, --verbose
uniq options:
  -c, --compare=arg
  -f, --force
  -i, --inpipe=arg
  -I, --infail
  -o, --output=arg
  -O, --outfail
  -r, --record-size=arg
  -s, --separator=arg
  -S, --sync-lines
  -v, --verbose
yes options:
  -E, --no-escape
  -f, --force
  -n, --no-newline
  -o, --output=arg
  -O, --outfail
  -v, --verbose