Thread: [Compbench-devel] CompBenchmarks++/CBM-PI/t 00-CBMSystem-public.pl, 1.5, 1.6 03-CBMCompilerSelector
Brought to you by:
xfred
Update of /cvsroot/compbench/CompBenchmarks++/CBM-PI/t In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv28058 Modified Files: 00-CBMSystem-public.pl 03-CBMCompilerSelector-public.pl 05-KB-Options.pl 05-Option-Descriptions.pl 07-compbenchmarks-core.pl Log Message: More tests. Index: 07-compbenchmarks-core.pl =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/07-compbenchmarks-core.pl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** 07-compbenchmarks-core.pl 19 Feb 2007 18:44:29 -0000 1.4 --- 07-compbenchmarks-core.pl 20 Mar 2007 20:29:56 -0000 1.5 *************** *** 11,15 **** use CBM::LibUI; ! use Test::Simple tests => 107; sub test_options { --- 11,15 ---- use CBM::LibUI; ! use Test::Simple tests => 111; sub test_options { *************** *** 27,30 **** --- 27,32 ---- ['-qc', 255, ''], ['-q -cgcc', 0, '.+'], + ['-qac gcc', 0, '.+'], + ['-qac g++', 0, '.+'], ['-qx', 0, '.+'], ['-qab', 0, '.+'], Index: 03-CBMCompilerSelector-public.pl =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/03-CBMCompilerSelector-public.pl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** 03-CBMCompilerSelector-public.pl 6 Feb 2007 19:42:51 -0000 1.6 --- 03-CBMCompilerSelector-public.pl 20 Mar 2007 20:29:55 -0000 1.7 *************** *** 14,18 **** 'compiler' => 'g++', 'compilerName' => 'g++ (GCC) 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)', ! 'compilerVersion' => '4.1.2 20060901 (prerelease)' }, 'compiler-fake-gcc-4.1.1-13' => --- 14,26 ---- 'compiler' => 'g++', 'compilerName' => 'g++ (GCC) 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)', ! 'compilerVersion' => '4.1.2 20060901 (prerelease)', ! 'vanilla' => '4.1.2' ! }, ! 'compiler-fake-gcc-3.2.3-20-rh' => ! {'language' => 'C', ! 'compiler' => 'gcc', ! 'compilerName' => 'gcc (GCC) 3.2.3 20030502 (Red Hat Linux 3.2.3-20)', ! 'compilerVersion' => '3.2.3', ! 'vanilla' => '3.2.3' }, 'compiler-fake-gcc-4.1.1-13' => *************** *** 20,24 **** 'compiler' => 'gcc', 'compilerName' => 'gcc (GCC) 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)', ! 'compilerVersion' => '4.1.2 20060901 (prerelease)' }, 'compiler-fake-tcc-0.9.23', --- 28,33 ---- 'compiler' => 'gcc', 'compilerName' => 'gcc (GCC) 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)', ! 'compilerVersion' => '4.1.2 20060901 (prerelease)', ! 'vanilla' => '4.1.2' }, 'compiler-fake-tcc-0.9.23', *************** *** 26,34 **** 'compiler' => 'tcc', 'compilerName' => 'Tiny C Compiler tcc version 0.9.23', ! 'compilerVersion' => 'tcc version 0.9.23' } ); ! plan tests => (keys %references)*4; $sys = CBM::Init(); --- 35,44 ---- 'compiler' => 'tcc', 'compilerName' => 'Tiny C Compiler tcc version 0.9.23', ! 'compilerVersion' => 'tcc version 0.9.23', ! 'vanilla' => '0.9.23' } ); ! plan tests => (keys %references)*5; $sys = CBM::Init(); *************** *** 43,50 **** %refdata=%{$references{$reffile}}; ! ok($refdata{language} eq $co->Language()); ! ok($refdata{compiler} eq $co->compiler()); ! ok($refdata{compilerName} eq $co->Name()); ! ok($refdata{compilerVersion} eq $co->Version()); } --- 53,61 ---- %refdata=%{$references{$reffile}}; ! ok($refdata{language} eq $co->Language(), "$reffile: Language is $refdata{language}"); ! ok($refdata{compiler} eq $co->compiler(), "$reffile: compiler is $refdata{compiler} (has " . $co->compiler() . ")"); ! ok($refdata{compilerName} eq $co->Name(), , "$reffile: Name is $refdata{compilerName} (has " . $co->Name() . ")"); ! ok($refdata{compilerVersion} eq $co->Version(), "$reffile: compilerVersion is $refdata{compilerVersion} (has " . $co->Version() . ")"); ! ok($refdata{vanilla} eq $co->VanillaVersion(), "$reffile: vanilla is $refdata{vanilla} (has " . $co->VanillaVersion() . ")"); } Index: 05-KB-Options.pl =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/05-KB-Options.pl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** 05-KB-Options.pl 14 Mar 2007 19:44:50 -0000 1.2 --- 05-KB-Options.pl 20 Mar 2007 20:29:56 -0000 1.3 *************** *** 447,451 **** sub test_options_O { ! my $f = "$kb_srcdir/gxx/options.xml"; my $R = new CBM::CelReader($f); --- 447,451 ---- sub test_options_O { ! my $f = "$kb_srcdir/gxx/2.95.x/options.xml"; my $R = new CBM::CelReader($f); Index: 05-Option-Descriptions.pl =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/05-Option-Descriptions.pl,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** 05-Option-Descriptions.pl 18 Mar 2007 21:46:19 -0000 1.3 --- 05-Option-Descriptions.pl 20 Mar 2007 20:29:56 -0000 1.4 *************** *** 4,8 **** my $sys; - my $kb_srcdir; push(@INC, "lib"); --- 4,7 ---- *************** *** 26,29 **** --- 25,35 ---- my @COMPILERS = ('gcc-2.95.0', 'gxx-2.95.0', 'gcc-2.95.0', 'g++-2.95.0'); + my %COMPILER_INTERFACES = ('compiler-fake-gcc-3.2.3-20-rh' => 'gcc-2.95.0', + 'compiler-fake-g++-4.1.1-13' => 'g++-2.95.0', + 'compiler-fake-gcc-4.1.1-13' => 'gcc-2.95.0' ); + + my @COMPILER_INTERFACES = ('compiler-fake-gcc-3.2.3-20-rh', + 'compiler-fake-g++-4.1.1-13', + 'compiler-fake-gcc-4.1.1-13'); use Test::More; *************** *** 36,39 **** --- 42,50 ---- $n+=(2+($expect*6)); } + + foreach $c (@COMPILER_INTERFACES) { + my $expect = $OPTIONS{$COMPILER_INTERFACES{$c}}->{expect}; + $n+=(3+($expect*6)); + } return($n); } *************** *** 46,55 **** my $F; ! sub test_options_compiler { my $compiler = shift; - my ($compiler_id, $version) = split('-', $compiler); - - my $OD = new CBM::CompilerOptionDescriptions($compiler_id, $version); - ok($OD, "descriptions' initialization works for $compiler_id"); my $n; --- 57,63 ---- my $F; ! sub test_options_descriptions { ! my $OD = shift; my $compiler = shift; my $n; *************** *** 86,89 **** --- 94,108 ---- } + sub test_options_compiler { + my $compiler = shift; + my ($compiler_id, $version) = split('-', $compiler); + + my $OD = new CBM::CompilerOptionDescriptions($compiler_id, $version); + ok($OD, "descriptions' initialization works for $compiler_id"); + + + test_options_descriptions($OD, $compiler); + } + sub test_options { foreach(@COMPILERS) { *************** *** 91,96 **** --- 110,133 ---- } } + + sub test_compilers { + my $fake; + + my $CS = CBM::CompilerSelector->new($sys); + + foreach(@COMPILER_INTERFACES) { + $fake="$top_srcdir/reference/$_"; + ok(-x $fake, "$fake is an executable"); + my $C = $CS->select("$fake"); + ok(defined($C)); + + test_options_descriptions($C->OptionDescriptions(), + $COMPILER_INTERFACES{$_}); + } + } + $sys = CBM::Init(); test_options(); + test_compilers(); $sys->done(); Index: 00-CBMSystem-public.pl =================================================================== RCS file: /cvsroot/compbench/CompBenchmarks++/CBM-PI/t/00-CBMSystem-public.pl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** 00-CBMSystem-public.pl 30 Jan 2007 19:58:11 -0000 1.5 --- 00-CBMSystem-public.pl 20 Mar 2007 20:29:55 -0000 1.6 *************** *** 5,9 **** require "libtest.pl"; ! use Test::Simple tests => 27; my $sys; --- 5,9 ---- require "libtest.pl"; ! use Test::Simple tests => 32; my $sys; *************** *** 15,18 **** --- 15,24 ---- ok($sys->Split("a\nb", "\n", 1) eq "b"); ok($sys->Split("a\nb\n", "\n", 1) eq "b"); + + ok($sys->Split("4.2.1", ".", 0) eq "4"); + ok($sys->Split("4.2.1", ".", 1) eq "2"); + ok($sys->Split("4.2.1", ".", 2) eq "1"); + ok($sys->Split("4.2.1", " ", 0) eq "", "Split('4.2.1', ' ', 0) is ''"); + ok($sys->Split("4.2.1", " ", 1) eq "", "Split('4.2.1', ' ', 1) is ''"); } |