Update of /cvsroot/compbench/CompBenchmarks++/CBM-PI/t
In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv30618
Modified Files:
05-KB-Option-Logics.pl
Log Message:
Two-pass options handled.
Index: 05-KB-Option-Logics.pl
===================================================================
RCS file: /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/05-KB-Option-Logics.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** 05-KB-Option-Logics.pl 12 Apr 2007 19:58:04 -0000 1.1
--- 05-KB-Option-Logics.pl 17 Apr 2007 20:10:11 -0000 1.2
***************
*** 60,63 ****
--- 60,97 ----
}
+ sub count_tests_fake_compiler_option_want {
+ my $fake_c;
+ my $c_branch;
+ my $count = 0;
+
+
+ foreach $fake_c (@COMPILER_FAKE_INTERFACES) {
+ my %set_variable_count;
+ my $option_set;
+
+ $c_branch=$COMPILER_FAKE_INTERFACES{$fake_c};
+ $option_set=$COMPILER_FAKE_OPTIONS{$c_branch};
+
+ my $opt;
+
+ foreach $opt (keys %{$option_set}) {
+ my @operations = @{$option_set->{$opt}};
+
+ my $o;
+ foreach $o (@operations) {
+ if ($o =~ /^option-want (.*?) (.*?)/) {
+ $set_variable_count{$1}++;
+ }
+ }
+ }
+
+ foreach(keys %set_variable_count) {
+ my $c = $set_variable_count{$_};
+ $count+=$c;
+ }
+ }
+
+ return($count);
+ }
sub count_tests_fake_compiler_option_implied_bys {
***************
*** 219,223 ****
my $x = "1\nOption $l1 is implied by $l0\n";
! ok($r eq $x, "Analyzing $opt_string on " .
$C->Name() . " : expects ($x) has ($r)\n");
}
--- 253,313 ----
my $x = "1\nOption $l1 is implied by $l0\n";
! ok($r eq $x, "Analyzing $opt_string from '$i' '$ib' on " .
! $C->Name() . " : expects ($x) has ($r)\n");
! }
! }
! }
! }
!
! sub test_option_want {
! my $fake_c;
! my $c_branch;
! my $option_set;
! my $opt;
! my $first_option;
!
! foreach $fake_c (@COMPILER_FAKE_INTERFACES) {
! $c_branch=$COMPILER_FAKE_INTERFACES{$fake_c};
! $option_set=$COMPILER_FAKE_OPTIONS{$c_branch};
! my %option_want;
!
! foreach $opt (keys %{$option_set}) {
! my @operations = @{$option_set->{$opt}};
! my $o;
! if (!defined($first_option)) {
! $first_option=$opt;
! }
! foreach $o (@operations) {
! if ($o =~ /^option-want (.*?) (.*)/) {
! $option_want{$opt}->{$1}=$2;
! }
! }
! }
!
! my $CS = new CBM::CompilerSelector($sys);
!
! my $fake_cmd = "$top_srcdir/reference/$fake_c";
! my $C = $CS->select($fake_cmd);
!
! my $i;
! my $o;
! my $lit_first = $C->OptionDescriptions()->Description($first_option)->Option();
! foreach $o (keys %option_want) {
! foreach $i (keys %{$option_want{$o}}) {
! my $l0 = compiler_option_litteral($C, $o);
! my $opt_string = "$l0";
!
! my $r = $C->analyzeOptions($opt_string);
! my $x = "1\n";
!
! ok($r eq $x, "Want (value) : analyzing $opt_string on " .
! $C->Name() . " : expects ($x) has ($r)\n");
!
! $C->colVarSet("$i", "$option_want{$o}->{$i}x", "$first_option");
!
! $r = $C->analyzeOptions($opt_string);
! $x = "Option " . $C->OptionDescriptions()->Description($o)->Option() . " is incompatible with $lit_first\n";
!
! ok($r eq $x, "Want (value, step2) : analyzing $opt_string on " .
$C->Name() . " : expects ($x) has ($r)\n");
}
***************
*** 228,231 ****
--- 318,322 ----
plan tests => (count_tests_fake_compiler_branches()*2+
count_tests_fake_compiler_option_using_vars()+
+ count_tests_fake_compiler_option_want()*2+
count_tests_fake_compiler_option_implied_bys());
***************
*** 234,237 ****
--- 325,329 ----
test_option_using_vars();
test_option_implied_bys();
+ test_option_want();
$sys->done();
|