this repo has no description
at develop 3.7 kB view raw
1#!/usr/bin/perl 2# 3# Main authors: 4# Guido Tack <tack@gecode.org> 5# 6# Copyright: 7# Guido Tack, 2008 8# 9# This file is part of Gecode, the generic constraint 10# development environment: 11# http://www.gecode.org 12# 13# Permission is hereby granted, free of charge, to any person obtaining 14# a copy of this software and associated documentation files (the 15# "Software"), to deal in the Software without restriction, including 16# without limitation the rights to use, copy, modify, merge, publish, 17# distribute, sublicense, and/or sell copies of the Software, and to 18# permit persons to whom the Software is furnished to do so, subject to 19# the following conditions: 20# 21# The above copyright notice and this permission notice shall be 22# included in all copies or substantial portions of the Software. 23# 24# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 25# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 26# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 27# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 28# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 29# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 30# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 31# 32# 33 34use File::Basename; 35 36open (TESTS, "./test/test -list |"); 37 38my %tests; 39 40my $blockSize = 40; 41 42while ($l = <TESTS>) { 43 chomp($l); 44 $tests{$l} = ""; 45} 46close (TESTS); 47 48$size = 0; 49foreach my $k (keys %tests) { 50 $size++; 51} 52 53my $targets = $size / $blockSize; 54 55open (EXAMPLES, "find ./examples -maxdepth 1 -type f ! -name '*.*' |"); 56 57my @examples; 58while (my $x = <EXAMPLES>) { 59 chomp($x); 60 my ($filename, $dummydir, $suffix) = fileparse($x); 61 62 open (HELP, "$x -help 2>&1 |"); 63 my @prop; 64 my @model; 65 while (my $l = <HELP>) { 66 if ($l =~ /-propagation \((.*)\)/) { 67 $l1 = $1; 68 $l1 =~ s/ //g; 69 @prop = split(/,/, $l1); 70 } elsif ($l =~ /-model \((.*)\)/) { 71 $l1 = $1; 72 $l1 =~ s/ //g; 73 @model = split(/,/, $l1); 74 } 75 } 76 if (scalar(@prop) == 0) { 77 if (scalar(@model) == 0) { 78 push(@examples, $filename); 79 } else { 80 foreach $m (@model) { 81 push(@examples, "$filename -model $m"); 82 } 83 } 84 } else { 85 foreach $p (@prop) { 86 if (scalar(@model) == 0) { 87 push(@examples, "$filename -propagation $p"); 88 } else { 89 foreach $m (@model) { 90 push(@examples, "$filename -propagation $p -model $m"); 91 } 92 } 93 } 94 } 95 close (HELP); 96} 97close (EXAMPLES); 98 99print "LCOVOUTDIR = /srv/gecode/httpd/html/Internal/gcov-trunk\n\n"; 100print "all: tests examples\n"; 101print "\tlcov --directory \$(PWD) --base-directory \$(PWD) --capture \\\n"; 102print "\t --output-file testsandexamples.info\n"; 103print "\tgenhtml -t \"Gecode tests and examples\" testsandexamples.info -o \$(LCOVOUTDIR) -p \$(PWD)\n\n"; 104 105print "tests: \\\n"; 106for (my $tcount = 0; $tcount <= $targets; $tcount++) { 107 print "\ttest$tcount \\\n"; 108} 109print "\tdone\n\n"; 110print "examples: \\\n"; 111foreach $e (@examples) { 112 $etarget = $e; 113 $etarget =~ s/[ -]/_/g; 114 print "\t$etarget \\\n"; 115} 116print "\tdone\n\n"; 117 118$tcount = 1; 119$count = 0; 120print "test0:\n"; 121print "\t./test/test \\\n"; 122foreach my $k (keys %tests) { 123 if ($count == $blockSize) { 124 print "\t\t\$(TESTOPTIONS)\n\n"; 125 print "test$tcount:\n"; 126 print "\t./test/test \\\n"; 127 $count = 0; 128 $tcount++; 129 } 130 print "\t\t-test ".$k." \\\n"; 131 $count++; 132} 133if ($count < $blockSize) { 134 print "\t\t\$(TESTOPTIONS)\n\n"; 135} 136 137foreach $e (@examples) { 138 $etarget = $e; 139 $etarget =~ s/[ -]/_/g; 140 print "$etarget:\n"; 141 print "\t./examples/$e -time 240000\n\n"; 142} 143 144print "done:\n";