7 die "update_plist_test <test file> <plist file>\n" if ($#ARGV < 1);
8 my $testFile = shift @ARGV;
9 die "error: cannot read file $testFile\n" if (! -r
$testFile);
10 my $plistFile = shift @ARGV;
11 die "error: cannot read file $plistFile\n" if (! -r
$plistFile);
13 # Create a temp file for the new test.
14 my $fh = File
::Temp
->new();
15 my $filename = $fh->filename;
16 $fh->unlink_on_destroy(1);
18 # Copy the existing temp file, skipping the FileCheck comments.
19 open (IN
, $testFile) or die "cannot open $testFile\n";
21 next if (/^\/\
/ CHECK/);
26 # Copy the plist data, and specially format it.
27 open (IN
, $plistFile) or die "cannot open $plistFile\n";
31 # Skip everything not indented.
33 # Skip the first array entry, which is for files.
35 if (/<\/array
>/) { $firstArray = 0; }
38 # Format the CHECK lines.
40 print $fh "// CHECK: ";
44 print $fh "// CHECK-NEXT: ";
51 `cp $filename $testFile`;
52 print "updated $testFile\n";