Update of /cvsroot/compbench/CompBenchmarks++/CBM-PI/t
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30447
Modified Files:
05-KB-Option-Descriptions.pl
Log Message:
Two-pass options handled.
Many more tests.
Verbosity to ease debugging (on error).
Index: 05-KB-Option-Descriptions.pl
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/05-KB-Option-Descriptions.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** 05-KB-Option-Descriptions.pl 12 Apr 2007 19:58:04 -0000 1.1
--- 05-KB-Option-Descriptions.pl 17 Apr 2007 20:09:32 -0000 1.2
***************
*** 29,33 ****
foreach $c (@COMPILER_FAKE_INTERFACES) {
my $expect = compiler_option_number_expected($COMPILER_FAKE_INTERFACES{$c});
! $n+=(3+($expect*6));
}
return($n);
--- 29,34 ----
foreach $c (@COMPILER_FAKE_INTERFACES) {
my $expect = compiler_option_number_expected($COMPILER_FAKE_INTERFACES{$c});
! $n+=(3+($expect*7));
! $n+=compiler_option_test_number_expected_twopasses($COMPILER_FAKE_INTERFACES{$c});
}
return($n);
***************
*** 41,47 ****
--- 42,100 ----
my $F;
+ sub show_differences {
+ my $OD = shift;
+ my $ref_compiler = shift;
+
+ my %OD_def;
+ my %ref_def;
+
+ my $D;
+
+ my $i;
+ my $n;
+
+ print STDERR "\n";
+
+ $n=$OD->DescriptionNumber();
+ for($i=0;$i<$n;$i++) {
+ $D=$OD->Description($i);
+ $OD_def{$D->Id()}=1;
+ }
+
+ foreach(keys %{$ref_compiler}) {
+ $ref_def{$_}=1;
+ }
+
+ my @missing_in_od;
+ foreach(keys %ref_def) {
+ if (!defined($OD_def{$_})) {
+ push(@missing_in_od,
+ $_);
+ }
+ }
+
+ my @missing_in_ref;
+ foreach(keys %OD_def) {
+ if (!defined($ref_def{$_})) {
+ push(@missing_in_ref,
+ $_);
+ }
+ }
+
+ if (@missing_in_od+0) {
+ print STDERR "Options missing in XML descriptions : " .
+ join(',', @missing_in_od) . "\n";
+ }
+
+ if (@missing_in_ref+0) {
+ print STDERR "Options missing in compiler.pl reference file : " .
+ join(',', @missing_in_ref) . "\n";
+ }
+ }
+
sub test_options_descriptions {
my $OD = shift;
my $compiler = shift;
+ my %first_passes;
my $n;
***************
*** 51,54 ****
--- 104,111 ----
ok($n eq $expect, "$compiler: DescriptionNumber() returns $expect (has $n in " . $OD->DescriptionFile() . ")");
+ if ($n ne $expect) {
+ show_differences($OD,
+ \%{$COMPILER_FAKE_OPTIONS{$compiler}});
+ }
my $i;
***************
*** 60,78 ****
my $D;
for($i=0; $i<$n; $i++) {
$D = $OD->Description($i);
ok($D->Id() ne "", "$compiler: D$i has identifier");
$unique_id{$D->Id()}++;
ok($D->ShortDescription() ne "",
! "$compiler: D$i has short description");
ok($D->EditorDescription() ne "",
! "$compiler: D$i has editor's description");
ok($D->Option() ne "",
! "$compiler: D$i has option (value)");
! $unique_id{$D->Option()}++;
! # !!!
! # my $fid = "kb-$c-option-" . $D->Id() . "-is-compatible";
! # ok(defined(CBM::celFunctionGet($fid)), "$fid defined");
}
--- 117,150 ----
my $D;
+
+ for($i=0; $i<$n; $i++) {
+ $D = $OD->Description($i);
+ ok($D->Id() ne "", "$compiler: D$i has identifier");
+ if ((($D->CompilationTwoPassNeeded()) &&
+ ($D->CompilationPass()==1))) {
+ $first_passes{$D->Id()}=1;
+ }
+ }
+
for($i=0; $i<$n; $i++) {
$D = $OD->Description($i);
ok($D->Id() ne "", "$compiler: D$i has identifier");
+ my $did = $D->Id();
+
$unique_id{$D->Id()}++;
ok($D->ShortDescription() ne "",
! "$compiler: $did has short description");
ok($D->EditorDescription() ne "",
! "$compiler: $did has editor's description");
ok($D->Option() ne "",
! "$compiler: $did has option (value)");
! if (($D->CompilationTwoPassNeeded() &&
! $D->CompilationPass()==2)) {
! ok(defined($first_passes{$D->CompilationFirstPassOption()}),
! "Two-passes: " . $D->CompilationFirstPassOption() . " first pass defined");
! }
!
! $unique_id{$D->Option()}++;
}
|