[Compbench-devel] CompBenchmarks++/CBM-PI/t 05-KB-Options.pl, NONE, 1.1
Brought to you by:
xfred
From: Frederic T. <xf...@us...> - 2007-03-12 21:48:06
|
Update of /cvsroot/compbench/CompBenchmarks++/CBM-PI/t In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv4375 Added Files: 05-KB-Options.pl Log Message: First import. --- NEW FILE: 05-KB-Options.pl --- #!/usr/bin/perl -w -I .. use strict; use CBM; my $sys; my $kb_srcdir; push(@INC, "lib"); require "libtest.pl"; my @OPTIONS_O = ( ['O0', "gcxc", "2.97.0", "g++ or gcc needed"], ['O0', "gcxc", "2.91.0", "g++ or gcc needed"], ['O0', "gcc", "2.92.0", "g++ or gcc >= 2.95.0 needed"], ['O0', "gcc", "2.95.0", "1"], ['reset'], ['O0', "gcc", "2.99.0", "1"], ['reset'], ['O0', "gcc", "2.92.0", "g++ or gcc >= 2.95.0 needed"], ['O0', "gcc", "2.95.0", "1"], ['reset'], ['O0', "gcc", "2.95.0", "1"], ['O0', "gcc", "2.95.0", "-O0 has already been set"], ['reset'], ['O0', "gcc", "2.95.0", "1"], ['reset'], ['O0', "gcc", "2.96.0", "1"], ['reset'], ['O0', "gcc", "3.3.0", "1"], ['reset'], ['O0', "gcc", "4.1.0", "1"], ['reset'], ['Os', "gcc", "2.92.0", "g++ or gcc >= 2.95.0 needed"], ['reset'], ['Os', "gcc", "2.95.0", "1"], ['reset'], ['Os', "gcc", "2.96.0", "1"], ['reset'], ['Os', "gcc", "3.3.0", "1"], ['reset'], ['Os', "gcc", "4.1.0", "1"], ['reset'], ['Os', "gcc", "4.1.0", "1"], ['O0', "gcc", "4.1.0", "-O0 is incompatible with -Os"], ); use Test::More; sub plan_count_O_tests { my $n = 0; foreach(@OPTIONS_O) { if ((@{$_}+0)==4) { $n++; } else { $n++; } } return($n); } plan tests => (plan_count_O_tests() + 1); our $top_srcdir; my $T; my $F; sub call_reset { my $fc = new CBM::CelFunctionCall(); my $fcn = new CBM::CelStr("kb-common-option-reset"); $fc->add($fcn); my $e = $fc->Evaluate(); return($e); } sub call_option_function { my $function = shift; my $compiler_id = shift; my $version = shift; my $BL = new CBM::CelBlock(); my $fc = new CBM::CelFunctionCall(); my $fcn = new CBM::CelStr("kb-gxx-option-$function-is-compatible"); my $comp = new CBM::CelStr($compiler_id); my $ver = new CBM::CelVersion($version); my $SP0 = new CBM::CelStackPush(); $SP0->add($comp); $BL->add($SP0); my $SP1 = new CBM::CelStackPush(); $SP1->add($ver); $BL->add($SP1); $fc->add($fcn); $BL->add($fc); my $e = $BL->Evaluate(); return($e); } sub test_options_O { my $f = "$kb_srcdir/gxx/options.xml"; my $R = new CBM::CelReader($f); my $D = $R->parse(); ok(defined($D), "$f can be parsed"); $D->Evaluate(); my $o; foreach $o (@OPTIONS_O) { my ($option_compat_function, $compiler, $version, $msg) = @{$o}; if ($option_compat_function ne "reset") { my $e = call_option_function($option_compat_function, $compiler, $version); ok($e eq "$msg", "Testing $option_compat_function with compiler $compiler (version $version); expected : '$msg', has '$e'"); } else { my $e = call_reset(); ok($e eq "1", "CEL reset from common.xml gives 1"); } } } my $p = `pwd`; chomp($p); $sys = CBM::Init(); $kb_srcdir="$top_srcdir/../../libcompbenchmarks/share/KB"; test_options_O(); $sys->done(); |