ExtUtils::Constant 0.13
[p5sagit/p5-mst-13.2.git] / lib / ExtUtils / t / Constant.t
1 #!/usr/bin/perl -w
2
3 print "1..52\n";
4
5 BEGIN {
6     if( $ENV{PERL_CORE} ) {
7         chdir 't' if -d 't';
8         @INC = '../lib';
9     }
10 }
11
12 # use warnings;
13 use strict;
14 use ExtUtils::MakeMaker;
15 use ExtUtils::Constant qw (constant_types C_constant XS_constant autoload);
16 use Config;
17 use File::Spec;
18
19 my $do_utf_tests = $] > 5.006;
20 my $better_than_56 = $] > 5.007;
21
22 # Because were are going to be changing directory before running Makefile.PL
23 my $perl = $^X;
24 # 5.005 doesn't have new enough File::Spec to have rel2abs. But actually we
25 # only need it when $^X isn't absolute, which is going to be 5.8.0 or later
26 # (where ExtUtils::Constant is in the core, and tests against the uninstalled
27 # perl
28 $perl = File::Spec->rel2abs ($perl) unless $] < 5.006;
29 # ExtUtils::Constant::C_constant uses $^X inside a comment, and we want to
30 # compare output to ensure that it is the same. We were probably run as ./perl
31 # whereas we will run the child with the full path in $perl. So make $^X for
32 # us the same as our child will see.
33 $^X = $perl;
34
35 print "# perl=$perl\n";
36
37 my $lib = $ENV{PERL_CORE} ? '../../lib' : '../blib/lib';
38 my $runperl = "$perl \"-I$lib\"";
39
40 $| = 1;
41
42 my $dir = "ext-$$";
43 my @files;
44
45 print "# $dir being created...\n";
46 mkdir $dir, 0777 or die "mkdir: $!\n";
47
48 my $output = "output";
49
50 # For debugging set this to 1.
51 my $keep_files = 0;
52
53 END {
54     use File::Path;
55     print "# $dir being removed...\n";
56     rmtree($dir) unless $keep_files;
57 }
58
59 my $package = "ExtTest";
60
61 # Test the code that generates 1 and 2 letter name comparisons.
62 my %compass = (
63 N => 0, 'NE' => 45, E => 90, SE => 135, S => 180, SW => 225, W => 270, NW => 315
64 );
65
66 my $parent_rfc1149 =
67   'A Standard for the Transmission of IP Datagrams on Avian Carriers';
68 # Check that 8 bit and unicode names don't cause problems.
69 my $pound; 
70 if (ord('A') == 193) {  # EBCDIC platform
71     $pound = chr 177; # A pound sign. (Currency)
72 } else { # ASCII platform
73     $pound = chr 163; # A pound sign. (Currency)
74 }
75
76 my ($inf, $pound_bytes, $pound_utf8);
77 if ($do_utf_tests) {
78   $inf = chr 0x221E;
79   # Check that we can distiguish the pathological case of a string, and the
80   # utf8 representation of that string.
81   $pound_utf8 = $pound . '1';
82   if ($better_than_56) {
83     $pound_bytes = $pound_utf8;
84     utf8::encode ($pound_bytes);
85   } else {
86     # Must have that "U*" to generate a zero length UTF string that forces
87     # top bit set chars (such as the pound sign) into UTF8, so that the
88     # unpack 'C*' then gets the byte form of the UTF8.
89     $pound_bytes =  pack 'C*', unpack 'C*', $pound_utf8 . pack "U*";
90   }
91 }
92
93 my @names = ("FIVE", {name=>"OK6", type=>"PV",},
94              {name=>"OK7", type=>"PVN",
95               value=>['"not ok 7\\n\\0ok 7\\n"', 15]},
96              {name => "FARTHING", type=>"NV"},
97              {name => "NOT_ZERO", type=>"UV", value=>"~(UV)0"},
98              {name => "OPEN", type=>"PV", value=>'"/*"', macro=>1},
99              {name => "CLOSE", type=>"PV", value=>'"*/"',
100               macro=>["#if 1\n", "#endif\n"]},
101              {name => "ANSWER", default=>["UV", 42]}, "NOTDEF",
102              {name => "Yes", type=>"YES"},
103              {name => "No", type=>"NO"},
104              {name => "Undef", type=>"UNDEF"},
105 # OK. It wasn't really designed to allow the creation of dual valued constants.
106 # It was more for INADDR_ANY INADDR_BROADCAST INADDR_LOOPBACK INADDR_NONE
107              {name=>"RFC1149", type=>"SV", value=>"sv_2mortal(temp_sv)",
108               pre=>"SV *temp_sv = newSVpv(RFC1149, 0); "
109                    . "(void) SvUPGRADE(temp_sv,SVt_PVIV); SvIOK_on(temp_sv); "
110                    . "SvIVX(temp_sv) = 1149;"},
111              {name=>"perl", type=>"PV",},
112 );
113
114 push @names, $_ foreach keys %compass;
115
116 # Automatically compile the list of all the macro names, and make them
117 # exported constants.
118 my @names_only = map {(ref $_) ? $_->{name} : $_} @names;
119
120 # Exporter::Heavy (currently) isn't able to export these names:
121 push @names, ({name=>"*/", type=>"PV", value=>'"CLOSE"', macro=>1},
122               {name=>"/*", type=>"PV", value=>'"OPEN"', macro=>1},
123               {name=>$pound, type=>"PV", value=>'"Sterling"', macro=>1},
124              );
125
126 if ($do_utf_tests) {
127   push @names, ({name=>$inf, type=>"PV", value=>'"Infinity"', macro=>1},
128                 {name=>$pound_utf8, type=>"PV", value=>'"1 Pound"', macro=>1},
129                 {name=>$pound_bytes, type=>"PV", value=>'"1 Pound (as bytes)"',
130                  macro=>1},
131                );
132 }
133
134 =pod
135
136 The above set of names seems to produce a suitably bad set of compile
137 problems on a Unicode naive version of ExtUtils::Constant (ie 0.11):
138
139 nick@thinking-cap 15439-32-utf$ PERL_CORE=1 ./perl lib/ExtUtils/t/Constant.t
140 1..33
141 # perl=/stuff/perl5/15439-32-utf/perl
142 # ext-30370 being created...
143 Wide character in print at lib/ExtUtils/t/Constant.t line 140.
144 ok 1
145 ok 2
146 # make = 'make'
147 ExtTest.xs: In function `constant_1':
148 ExtTest.xs:80: warning: multi-character character constant
149 ExtTest.xs:80: warning: case value out of range
150 ok 3
151
152 =cut
153
154 # Grr `
155
156 my $types = {};
157 my $constant_types = constant_types(); # macro defs
158 my $C_constant = join "\n",
159   C_constant ($package, undef, "IV", $types, undef, undef, @names);
160 my $XS_constant = XS_constant ($package, $types); # XS for ExtTest::constant
161
162 ################ Header
163 my $header = File::Spec->catdir($dir, "test.h");
164 push @files, "test.h";
165 open FH, ">$header" or die "open >$header: $!\n";
166 print FH <<"EOT";
167 #define FIVE 5
168 #define OK6 "ok 6\\n"
169 #define OK7 1
170 #define FARTHING 0.25
171 #define NOT_ZERO 1
172 #define Yes 0
173 #define No 1
174 #define Undef 1
175 #define RFC1149 "$parent_rfc1149"
176 #undef NOTDEF
177 #define perl "rules"
178 EOT
179
180 while (my ($point, $bearing) = each %compass) {
181   print FH "#define $point $bearing\n"
182 }
183 close FH or die "close $header: $!\n";
184
185 ################ XS
186 my $xs = File::Spec->catdir($dir, "$package.xs");
187 push @files, "$package.xs";
188 open FH, ">$xs" or die "open >$xs: $!\n";
189
190 print FH <<'EOT';
191 #include "EXTERN.h"
192 #include "perl.h"
193 #include "XSUB.h"
194 EOT
195
196 print FH "#include \"test.h\"\n\n";
197 print FH $constant_types;
198 print FH $C_constant, "\n";
199 print FH "MODULE = $package             PACKAGE = $package\n";
200 print FH "PROTOTYPES: ENABLE\n";
201 print FH $XS_constant;
202 close FH or die "close $xs: $!\n";
203
204 ################ PM
205 my $pm = File::Spec->catdir($dir, "$package.pm");
206 push @files, "$package.pm";
207 open FH, ">$pm" or die "open >$pm: $!\n";
208 print FH "package $package;\n";
209 print FH "use $];\n";
210
211 print FH <<'EOT';
212
213 use strict;
214 EOT
215 printf FH "use warnings;\n" unless $] < 5.006;
216 print FH <<'EOT';
217 use Carp;
218
219 require Exporter;
220 require DynaLoader;
221 use vars qw ($VERSION @ISA @EXPORT_OK $AUTOLOAD);
222
223 $VERSION = '0.01';
224 @ISA = qw(Exporter DynaLoader);
225 @EXPORT_OK = qw(
226 EOT
227
228 # Print the names of all our autoloaded constants
229 print FH "\t$_\n" foreach (@names_only);
230 print FH ");\n";
231 # Print the AUTOLOAD subroutine ExtUtils::Constant generated for us
232 print FH autoload ($package, $]);
233 print FH "bootstrap $package \$VERSION;\n1;\n__END__\n";
234 close FH or die "close $pm: $!\n";
235
236 ################ test.pl
237 my $testpl = File::Spec->catdir($dir, "test.pl");
238 push @files, "test.pl";
239 open FH, ">$testpl" or die "open >$testpl: $!\n";
240
241 print FH "use strict;\n";
242 print FH "use $package qw(@names_only);\n\n";
243
244 print FH "use utf8\n\n" if $do_utf_tests;
245
246 print FH <<"EOT";
247
248 print "1..1\n";
249 if (open OUTPUT, ">$output") {
250   print "ok 1\n";
251   select OUTPUT;
252 } else {
253   print "not ok 1 # Failed to open '$output': $!\n";
254   exit 1;
255 }
256 EOT
257
258 print FH << 'EOT';
259
260 my $better_than_56 = $] > 5.007;
261
262 # What follows goes to the temporary file.
263 # IV
264 my $five = FIVE;
265 if ($five == 5) {
266   print "ok 5\n";
267 } else {
268   print "not ok 5 # $five\n";
269 }
270
271 # PV
272 print OK6;
273
274 # PVN containing embedded \0s
275 $_ = OK7;
276 s/.*\0//s;
277 print;
278
279 # NV
280 my $farthing = FARTHING;
281 if ($farthing == 0.25) {
282   print "ok 8\n";
283 } else {
284   print "not ok 8 # $farthing\n";
285 }
286
287 # UV
288 my $not_zero = NOT_ZERO;
289 if ($not_zero > 0 && $not_zero == ~0) {
290   print "ok 9\n";
291 } else {
292   print "not ok 9 # \$not_zero=$not_zero ~0=" . (~0) . "\n";
293 }
294
295 # Value includes a "*/" in an attempt to bust out of a C comment.
296 # Also tests custom cpp #if clauses
297 my $close = CLOSE;
298 if ($close eq '*/') {
299   print "ok 10\n";
300 } else {
301   print "not ok 10 # \$close='$close'\n";
302 }
303
304 # Default values if macro not defined.
305 my $answer = ANSWER;
306 if ($answer == 42) {
307   print "ok 11\n";
308 } else {
309   print "not ok 11 # What do you get if you multiply six by nine? '$answer'\n";
310 }
311
312 # not defined macro
313 my $notdef = eval { NOTDEF; };
314 if (defined $notdef) {
315   print "not ok 12 # \$notdef='$notdef'\n";
316 } elsif ($@ !~ /Your vendor has not defined ExtTest macro NOTDEF/) {
317   print "not ok 12 # \$@='$@'\n";
318 } else {
319   print "ok 12\n";
320 }
321
322 # not a macro
323 my $notthere = eval { &ExtTest::NOTTHERE; };
324 if (defined $notthere) {
325   print "not ok 13 # \$notthere='$notthere'\n";
326 } elsif ($@ !~ /NOTTHERE is not a valid ExtTest macro/) {
327   chomp $@;
328   print "not ok 13 # \$@='$@'\n";
329 } else {
330   print "ok 13\n";
331 }
332
333 # Truth
334 my $yes = Yes;
335 if ($yes) {
336   print "ok 14\n";
337 } else {
338   print "not ok 14 # $yes='\$yes'\n";
339 }
340
341 # Falsehood
342 my $no = No;
343 if (defined $no and !$no) {
344   print "ok 15\n";
345 } else {
346   print "not ok 15 # \$no=" . defined ($no) ? "'$no'\n" : "undef\n";
347 }
348
349 # Undef
350 my $undef = Undef;
351 unless (defined $undef) {
352   print "ok 16\n";
353 } else {
354   print "not ok 16 # \$undef='$undef'\n";
355 }
356
357
358 # invalid macro (chosen to look like a mix up between No and SW)
359 $notdef = eval { &ExtTest::So };
360 if (defined $notdef) {
361   print "not ok 17 # \$notdef='$notdef'\n";
362 } elsif ($@ !~ /^So is not a valid ExtTest macro/) {
363   print "not ok 17 # \$@='$@'\n";
364 } else {
365   print "ok 17\n";
366 }
367
368 # invalid defined macro
369 $notdef = eval { &ExtTest::EW };
370 if (defined $notdef) {
371   print "not ok 18 # \$notdef='$notdef'\n";
372 } elsif ($@ !~ /^EW is not a valid ExtTest macro/) {
373   print "not ok 18 # \$@='$@'\n";
374 } else {
375   print "ok 18\n";
376 }
377
378 my %compass = (
379 EOT
380
381 while (my ($point, $bearing) = each %compass) {
382   print FH "'$point' => $bearing, "
383 }
384
385 print FH <<'EOT';
386
387 );
388
389 my $fail;
390 while (my ($point, $bearing) = each %compass) {
391   my $val = eval $point;
392   if ($@) {
393     print "# $point: \$@='$@'\n";
394     $fail = 1;
395   } elsif (!defined $bearing) {
396     print "# $point: \$val=undef\n";
397     $fail = 1;
398   } elsif ($val != $bearing) {
399     print "# $point: \$val=$val, not $bearing\n";
400     $fail = 1;
401   }
402 }
403 if ($fail) {
404   print "not ok 19\n";
405 } else {
406   print "ok 19\n";
407 }
408
409 EOT
410
411 print FH <<"EOT";
412 my \$rfc1149 = RFC1149;
413 if (\$rfc1149 ne "$parent_rfc1149") {
414   print "not ok 20 # '\$rfc1149' ne '$parent_rfc1149'\n";
415 } else {
416   print "ok 20\n";
417 }
418
419 if (\$rfc1149 != 1149) {
420   printf "not ok 21 # %d != 1149\n", \$rfc1149;
421 } else {
422   print "ok 21\n";
423 }
424
425 EOT
426
427 print FH <<'EOT';
428 # test macro=>1
429 my $open = OPEN;
430 if ($open eq '/*') {
431   print "ok 22\n";
432 } else {
433   print "not ok 22 # \$open='$open'\n";
434 }
435 EOT
436
437 if ($do_utf_tests) {
438   # Do this in 7 bit in case someone is testing with some settings that cause
439   # 8 bit files incapable of storing this character.
440   my @values
441     = map {"'" . join (",", unpack "U*", $_ . pack "U*") . "'"}
442       ($pound, $inf, $pound_bytes, $pound_utf8);
443   # Values is a list of strings, such as ('194,163,49', '163,49')
444
445   print FH <<'EOT';
446
447   # I can see that this child test program might be about to use parts of
448   # Test::Builder
449
450   my $test = 23;
451   my ($pound, $inf, $pound_bytes, $pound_utf8) = map {eval "pack 'U*', $_"}
452 EOT
453
454   print FH join ",", @values;
455
456   print FH << 'EOT';
457 ;
458
459 foreach (["perl", "rules", "rules"],
460          ["/*", "OPEN", "OPEN"],
461          ["*/", "CLOSE", "CLOSE"],
462          [$pound, 'Sterling', []],
463          [$inf, 'Infinity', []],
464          [$pound_utf8, '1 Pound', '1 Pound (as bytes)'],
465          [$pound_bytes, '1 Pound (as bytes)', []],
466         ) {
467   # Flag an expected error with a reference for the expect string.
468   my ($string, $expect, $expect_bytes) = @$_;
469   (my $name = $string) =~ s/([^ -~])/sprintf '\x{%X}', ord $1/ges;
470   print "# \"$name\" => \'$expect\'\n";
471   # Try to force this to be bytes if possible.
472   if ($better_than_56) {
473     utf8::downgrade ($string, 1);
474   } else {
475     if ($string =~ tr/0-\377// == length $string) {
476       # No chars outside range 0-255
477       $string = pack 'C*', unpack 'U*', ($string . pack 'U*');
478     }
479   }
480 EOT
481
482   print FH  "my (\$error, \$got) = ${package}::constant (\$string);\n";
483
484   print FH <<'EOT';
485   if ($error or $got ne $expect) {
486     print "not ok $test # error '$error', got '$got'\n";
487   } else {
488     print "ok $test\n";
489   }
490   $test++;
491   print "# Now upgrade '$name' to utf8\n";
492   if ($better_than_56) {
493     utf8::upgrade ($string);
494   } else {
495     $string = pack ('U*') . $string;
496   }
497 EOT
498
499   print FH  "my (\$error, \$got) = ${package}::constant (\$string);\n";
500
501   print FH <<'EOT';
502   if ($error or $got ne $expect) {
503     print "not ok $test # error '$error', got '$got'\n";
504   } else {
505     print "ok $test\n";
506   }
507   $test++;
508   if (defined $expect_bytes) {
509     print "# And now with the utf8 byte sequence for name\n";
510     # Try the encoded bytes.
511     if ($better_than_56) {
512       utf8::encode ($string);
513     } else {
514       $string = pack 'C*', unpack 'C*', $string . pack "U*";
515     }
516 EOT
517
518     print FH "my (\$error, \$got) = ${package}::constant (\$string);\n";
519
520     print FH <<'EOT';
521     if (ref $expect_bytes) {
522       # Error expected.
523       if ($error) {
524         print "ok $test # error='$error' (as expected)\n";
525       } else {
526         print "not ok $test # expected error, got no error and '$got'\n";
527       }
528     } elsif ($got ne $expect_bytes) {
529       print "not ok $test # error '$error', expect '$expect_bytes', got '$got'\n";
530     } else {
531       print "ok $test\n";
532     }
533     $test++;
534   }
535 }
536 EOT
537 } else {
538   # Don't utf tests;
539   print FH <<'EOT';
540 print "ok $_ # Skipped on non Unicode perl\n" foreach 23..43;
541 EOT
542 }
543
544 close FH or die "close $testpl: $!\n";
545
546 # This is where the test numbers carry on after the test number above are
547 # relayed
548 my $test = 44;
549
550 ################ Makefile.PL
551 # We really need a Makefile.PL because make test for a no dynamic linking perl
552 # will run Makefile.PL again as part of the "make perl" target.
553 my $makefilePL = File::Spec->catdir($dir, "Makefile.PL");
554 push @files, "Makefile.PL";
555 open FH, ">$makefilePL" or die "open >$makefilePL: $!\n";
556 print FH <<"EOT";
557 #!$perl -w
558 use ExtUtils::MakeMaker;
559 WriteMakefile(
560               'NAME'            => "$package",
561               'VERSION_FROM'    => "$package.pm", # finds \$VERSION
562               (\$] >= 5.005 ?
563                (#ABSTRACT_FROM => "$package.pm", # XXX add this
564                 AUTHOR     => "$0") : ())
565              );
566 EOT
567
568 close FH or die "close $makefilePL: $!\n";
569
570 ################ MANIFEST
571 # We really need a MANIFEST because make distclean checks it.
572 my $manifest = File::Spec->catdir($dir, "MANIFEST");
573 push @files, "MANIFEST";
574 open FH, ">$manifest" or die "open >$manifest: $!\n";
575 print FH "$_\n" foreach @files;
576 close FH or die "close $manifest: $!\n";
577
578 chdir $dir or die $!; push @INC,  '../../lib';
579 END {chdir ".." or warn $!};
580
581 my $core = $ENV{PERL_CORE} ? ' PERL_CORE=1' : '';
582 my @perlout = `$runperl Makefile.PL $core`;
583 if ($?) {
584   print "not ok 1 # $runperl Makefile.PL failed: $?\n";
585   print "# $_" foreach @perlout;
586   exit($?);
587 } else {
588   print "ok 1\n";
589 }
590
591
592 my $makefile = ($^O eq 'VMS' ? 'descrip' : 'Makefile');
593 my $makefile_ext = ($^O eq 'VMS' ? '.mms' : '');
594 if (-f "$makefile$makefile_ext") {
595   print "ok 2\n";
596 } else {
597   print "not ok 2\n";
598 }
599
600 # Renamed by make clean
601 my $makefile_rename = $makefile . ($^O eq 'VMS' ? '.mms' : '.old');
602
603 my $make = $Config{make};
604
605 $make = $ENV{MAKE} if exists $ENV{MAKE};
606
607 if ($^O eq 'MSWin32' && $make eq 'nmake') { $make .= " -nologo"; }
608
609 my @makeout;
610
611 if ($^O eq 'VMS') { $make .= ' all'; }
612 print "# make = '$make'\n";
613 @makeout = `$make`;
614 if ($?) {
615   print "not ok 3 # $make failed: $?\n";
616   print "# $_" foreach @makeout;
617   exit($?);
618 } else {
619   print "ok 3\n";
620 }
621
622 if ($^O eq 'VMS') { $make =~ s{ all}{}; }
623
624 if ($Config{usedl}) {
625   print "ok 4\n";
626 } else {
627   my $makeperl = "$make perl";
628   print "# make = '$makeperl'\n";
629   @makeout = `$makeperl`;
630   if ($?) {
631     print "not ok 4 # $makeperl failed: $?\n";
632   print "# $_" foreach @makeout;
633     exit($?);
634   } else {
635     print "ok 4\n";
636   }
637 }
638
639 my $maketest = "$make test";
640 print "# make = '$maketest'\n";
641
642 @makeout = `$maketest`;
643
644 if (open OUTPUT, "<$output") {
645   print while <OUTPUT>;
646   close OUTPUT or print "# Close $output failed: $!\n";
647 } else {
648   # Harness will report missing test results at this point.
649   print "# Open <$output failed: $!\n";
650 }
651
652 if ($?) {
653   print "not ok $test # $maketest failed: $?\n";
654   print "# $_" foreach @makeout;
655 } else {
656   print "ok $test - maketest\n";
657 }
658 $test++;
659
660
661 # -x is busted on Win32 < 5.6.1, so we emulate it.
662 my $regen;
663 if( $^O eq 'MSWin32' && $] <= 5.006001 ) {
664     open(REGENTMP, ">regentmp") or die $!;
665     open(XS, "$package.xs")     or die $!;
666     my $saw_shebang;
667     while(<XS>) {
668         $saw_shebang++ if /^#!.*/i ;
669         print REGENTMP $_ if $saw_shebang;
670     }
671     close XS;  close REGENTMP;
672     $regen = `$runperl regentmp`;
673     unlink 'regentmp';
674 }
675 else {
676     $regen = `$runperl -x $package.xs`;
677 }
678 if ($?) {
679   print "not ok $test # $runperl -x $package.xs failed: $?\n";
680 } else {
681   print "ok $test - regen\n";
682 }
683 $test++;
684
685 my $expect = $constant_types . $C_constant .
686   "\n#### XS Section:\n" . $XS_constant;
687
688 if ($expect eq $regen) {
689   print "ok $test - regen worked\n";
690 } else {
691   print "not ok $test - regen worked\n";
692   # open FOO, ">expect"; print FOO $expect;
693   # open FOO, ">regen"; print FOO $regen; close FOO;
694 }
695 $test++;
696
697 my $makeclean = "$make clean";
698 print "# make = '$makeclean'\n";
699 @makeout = `$makeclean`;
700 if ($?) {
701   print "not ok $test # $make failed: $?\n";
702   print "# $_" foreach @makeout;
703 } else {
704   print "ok $test\n";
705 }
706 $test++;
707
708 sub check_for_bonus_files {
709   my $dir = shift;
710   my %expect = map {($^O eq 'VMS' ? lc($_) : $_), 1} @_;
711
712   my $fail;
713   opendir DIR, $dir or die "opendir '$dir': $!";
714   while (defined (my $entry = readdir DIR)) {
715     $entry =~ s/\.$// if $^O eq 'VMS';  # delete trailing dot that indicates no extension
716     next if $expect{$entry};
717     print "# Extra file '$entry'\n";
718     $fail = 1;
719   }
720
721   closedir DIR or warn "closedir '.': $!";
722   if ($fail) {
723     print "not ok $test\n";
724   } else {
725     print "ok $test\n";
726   }
727   $test++;
728 }
729
730 check_for_bonus_files ('.', @files, $output, $makefile_rename, '.', '..');
731
732 rename $makefile_rename, $makefile
733  or die "Can't rename '$makefile_rename' to '$makefile': $!";
734
735 unlink $output or warn "Can't unlink '$output': $!";
736
737 # Need to make distclean to remove ../../lib/ExtTest.pm
738 my $makedistclean = "$make distclean";
739 print "# make = '$makedistclean'\n";
740 @makeout = `$makedistclean`;
741 if ($?) {
742   print "not ok $test # $make failed: $?\n";
743   print "# $_" foreach @makeout;
744 } else {
745   print "ok $test\n";
746 }
747 $test++;
748
749 check_for_bonus_files ('.', @files, '.', '..');
750
751 unless ($keep_files) {
752   foreach (@files) {
753     unlink $_ or warn "unlink $_: $!";
754   }
755 }
756
757 check_for_bonus_files ('.', '.', '..');
758
759 # This was causing an assertion failure (a C<confess>ion)
760 C_constant ($package, undef, undef, undef, undef, undef, chr 255);
761
762 print "ok $test\n"; $test++;