From c53d861702513480879fa91aa6c508e91dae997b Mon Sep 17 00:00:00 2001 From: Jonathan Lambrechts <jonathan.lambrechts@uclouvain.be> Date: Mon, 18 Jan 2010 09:33:48 +0000 Subject: [PATCH] dg: add validation scripts in the svn --- .../validation_scripts/benchmarks.css | 43 ++++++++++ .../validation_scripts/benchmarks.php | 83 +++++++++++++++++++ .../gmsh_validation_init_script.sh | 4 + .../validation_scripts/results/.svn/entries | 28 +++++++ .../TESTCASES/validation_scripts/run_test.sh | 26 ++++++ .../validation_scripts/send_mail.php | 13 +++ .../TESTCASES/validation_scripts/test_all.sh | 59 +++++++++++++ .../validation_scripts/test_benchmarks.sh | 12 +++ .../validation_scripts/test_compilation.sh | 12 +++ 9 files changed, 280 insertions(+) create mode 100644 Solver/TESTCASES/validation_scripts/benchmarks.css create mode 100755 Solver/TESTCASES/validation_scripts/benchmarks.php create mode 100755 Solver/TESTCASES/validation_scripts/gmsh_validation_init_script.sh create mode 100644 Solver/TESTCASES/validation_scripts/results/.svn/entries create mode 100644 Solver/TESTCASES/validation_scripts/run_test.sh create mode 100755 Solver/TESTCASES/validation_scripts/send_mail.php create mode 100755 Solver/TESTCASES/validation_scripts/test_all.sh create mode 100755 Solver/TESTCASES/validation_scripts/test_benchmarks.sh create mode 100755 Solver/TESTCASES/validation_scripts/test_compilation.sh diff --git a/Solver/TESTCASES/validation_scripts/benchmarks.css b/Solver/TESTCASES/validation_scripts/benchmarks.css new file mode 100644 index 0000000000..749fa73958 --- /dev/null +++ b/Solver/TESTCASES/validation_scripts/benchmarks.css @@ -0,0 +1,43 @@ +body { + margin: 2em; + text-align: center; +} +table { + margin-left: auto; + margin-right: auto; +} +a { + text-decoration: none; +} +a:hover, a:visited { + color: inherit; +} +td { + text-align: center; +} +table{ + border-collapse: collapse; +} +td.first_col { + text-align: left; + padding-right: 1em; +} +tr.even_line td { + background-color: #F0F0F0; +} +th { + padding-left: 0.5em; + padding-right: 0.5em; + border-bottom: solid black 1px; +} +td.slim_benchmark_failed { + color: red; + font-weight: bold; +} +td.slim_benchmark_passed { + color: green; +} +td.slim_benchmark_running { + color: orange; + font-weight: bold; +} diff --git a/Solver/TESTCASES/validation_scripts/benchmarks.php b/Solver/TESTCASES/validation_scripts/benchmarks.php new file mode 100755 index 0000000000..34ae2a7fb4 --- /dev/null +++ b/Solver/TESTCASES/validation_scripts/benchmarks.php @@ -0,0 +1,83 @@ +<?php +if($_SERVER["argc"]>1) + $server_path=$_SERVER["argv"][1]; +else + $server_path="."; + +echo <<<END +<html><head><title>GMSH/DG validation</title></head> +<style> + +END; +include("benchmarks.css"); +echo <<<END +</style> +<body> +<h3><a href="$server_path/index.php">GMSH/DG automatic testing report</a></h3> +<table class="slim_validation_table"> +<tr class="odd_line"> + <th class="first_col">test name</th> + <th>status</th> + <th>last tested</th> + <th>last passed</th> + <th>first failed</th> + <th>time</th> + <th>diff</th> +</tr> +END; + function read_file($filename){ + if(file_exists($filename)){ + $fh=fopen($filename,'r'); + fscanf($fh,"%s",$r); + fclose($fh); + return $r; + }else{ + return "none"; + } + } + function print_with_log($rev,$log){ + global $server_path; + if(file_exists($log)){ + echo " <td><a href=$server_path/$log>$rev</a></td>\n"; + }else{ + echo " <td>$rev</td>\n"; + } + } + $dir=opendir("results"); + $all_test=scandir("results"); + natcasesort($all_test); + foreach ($all_test as $test) { + if($test!="." && $test!=".."){ + $status=read_file("results/".$test."/status",'r'); + $last_tested=read_file("results/".$test."/last_tested",'r'); + $last_passed=read_file("results/".$test."/last_passed",'r'); + $first_failed=read_file("results/".$test."/first_failed",'r'); + $time=read_file("results/".$test."/time",'r'); + if($i%2==0) + echo"<tr class=\"even_line\">\n"; + else + echo"<tr class=\"odd_line\">\n"; + if(file_exists("results/".$test."/datafile")){ + echo " <td class=\"first_col\"><a href=$server_path/results/$test/datafile>$test</a></td>\n"; + }else{ + echo " <td class=\"first_col\">$test</td>\n"; + } + echo " <td class=\"slim_benchmark_$status\">$status</td>\n"; + print_with_log($last_tested,"results/$test/log"); + print_with_log($last_passed,"results/$test/log_last_passed"); + print_with_log($first_failed,"results/$test/log_first_failed"); + echo "<td>".$time."</td>\n"; + echo "<td>\n"; + if($first_failed!="none" && $last_passed!="none"){ + echo "<a href=\"https://geuz.org/trac/gmsh/changeset?old_path=/trunk&old=$last_passed&new_path=/trunk&new=$first_failed\">$last_passed:$first_failed</a>"; + } + echo "</td>\n"; + echo "</tr>\n"; + } + } +echo <<<END +</table> +</body> +</html> +END +?> diff --git a/Solver/TESTCASES/validation_scripts/gmsh_validation_init_script.sh b/Solver/TESTCASES/validation_scripts/gmsh_validation_init_script.sh new file mode 100755 index 0000000000..0333fa1d5f --- /dev/null +++ b/Solver/TESTCASES/validation_scripts/gmsh_validation_init_script.sh @@ -0,0 +1,4 @@ +#!/bin/bash +while true; do + ./test_all.sh +done diff --git a/Solver/TESTCASES/validation_scripts/results/.svn/entries b/Solver/TESTCASES/validation_scripts/results/.svn/entries new file mode 100644 index 0000000000..071bd46c39 --- /dev/null +++ b/Solver/TESTCASES/validation_scripts/results/.svn/entries @@ -0,0 +1,28 @@ +10 + +dir +0 +https://geuz.org/svn/gmsh/trunk/Solver/TESTCASES/validation_scripts/results +https://geuz.org/svn/gmsh +add + + + + + + + + + + + + + + + + + + + +59c8cabf-10d6-4a28-b43f-3936b85956c4 + diff --git a/Solver/TESTCASES/validation_scripts/run_test.sh b/Solver/TESTCASES/validation_scripts/run_test.sh new file mode 100644 index 0000000000..43a19f0be3 --- /dev/null +++ b/Solver/TESTCASES/validation_scripts/run_test.sh @@ -0,0 +1,26 @@ +# $1 command $2 name $3 rev $4 dir +run_test() { + start_time=`date "+%s"` + ulimit -t 600 + echo running "$2" + dir="$4/$2" + mkdir -p $dir + echo "$3" >"$dir/last_tested" + echo "running" > "$dir/status" + if $1 &>"$dir/log" ; then + echo "$3" >"$dir/last_passed" + rm -f $dir/first_failed + rm -f $dir/log_first_failed + cp "$dir/log" "$dir/log_last_passed" + echo "passed" |tee "$dir/status" + else + if [ ! -e "$dir/first_failed" ]; then + echo "$3" > "$dir/first_failed" + cp "$dir/log" "$dir/log_first_failed" + fi + echo "failed" |tee "$dir/status" + let nfailed=$nfailed+1 + fi + end_time=`date "+%s"` + echo $(($end_time-$start_time)) > "$dir/time" +} diff --git a/Solver/TESTCASES/validation_scripts/send_mail.php b/Solver/TESTCASES/validation_scripts/send_mail.php new file mode 100755 index 0000000000..99e5aff771 --- /dev/null +++ b/Solver/TESTCASES/validation_scripts/send_mail.php @@ -0,0 +1,13 @@ +#!/usr/bin/php5 +<?php +function concat($i,$j){ + return "$i\n$j"; +} +exec("/usr/bin/php5 -q benchmarks.php https://subversion.mema.ucl.ac.be/~slimdata",$result); +$mail_content=array_reduce($result,"concat"); +$emails="richard.comblen@uclouvain.be,olivier.lietaer@uclouvain.be,sylvain.bouillon@uclouvain.be,olivier.gourgue@uclouvain.be,sebastien.blaise@uclouvain.be,benjamin.debrye@uclouvain.be,tuomas.karna@uclouvain.be,jonathanlambrechts@gmail.com"; +$headers = 'MIME-Version: 1.0' . "\r\n"; +$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; +$headers .= 'From: slim validation manager <richard.comblen@uclouvain.be>' . "\r\n"; +mail($emails,"[slim automatic validation]",$mail_content,$headers); +?> diff --git a/Solver/TESTCASES/validation_scripts/test_all.sh b/Solver/TESTCASES/validation_scripts/test_all.sh new file mode 100755 index 0000000000..59450f1fbe --- /dev/null +++ b/Solver/TESTCASES/validation_scripts/test_all.sh @@ -0,0 +1,59 @@ +#!/bin/bash +dir_list="../gmsh" +export LC_ALL=C + +get_revision(){ + rev=-1 + for i in $dir_list; do + cd $i + svn up + nrev=`LC_ALL=C svn info |grep Revision|awk '{print $2}'` + if [ $nrev -gt $rev ]; then + rev=$nrev + fi + cd - >/dev/null + done +} + +source run_test.sh +if [ -e results/_global/last_tested ]; then + old_rev=`cat results/_global/last_tested` +else + old_rev=-1 +fi +get_revision +if [ $rev -gt $old_rev ]; then + start_time_global=`date "+%s"` + nfailed=0 + mkdir -p "results/_global" + echo "running" > "results/_global/status" + source ./test_compilation.sh $rev + source ./test_benchmarks.sh $rev + #generate _global entry + if [ $nfailed -gt 0 ];then + run_test '[ 1 -eq 0 ]' "_global" $rev results +# ./send_mail.php + else +# # send an email for first succeeded test +# if [ -e results/_global/first_failed ];then +# ./send_mail.php +# fi + run_test '[ 0 -eq 0 ]' "_global" $rev results + fi + end_time_global=`date "+%s"` + echo $(($end_time_global-$start_time_global)) > "results/_global/time" + #remove old test case's directories + for i in results/*; do + if [ -e $i/last_tested ] + then + lasttested=`cat $i/last_tested` + else + lasttested=-1 + fi + if [ ! $lasttested -eq $rev ]; then + rm -rf $i + fi + done +else + sleep 20 +fi diff --git a/Solver/TESTCASES/validation_scripts/test_benchmarks.sh b/Solver/TESTCASES/validation_scripts/test_benchmarks.sh new file mode 100755 index 0000000000..ec532fdd8a --- /dev/null +++ b/Solver/TESTCASES/validation_scripts/test_benchmarks.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# $1 svn revision id (ex 0) +source run_test.sh +result=true; +CDIR=$PWD +cd ../gmsh/Solver/TESTCASES/validation +for i in `find . -name '*.lua' | grep -v '.svn' | sort`; do + NAME=$(basename $i .lua) + echo $NAME + run_test "$CDIR/../build/default/gmsh $i -" "$NAME" "$1" "$CDIR/results" +done +cd $CDIR diff --git a/Solver/TESTCASES/validation_scripts/test_compilation.sh b/Solver/TESTCASES/validation_scripts/test_compilation.sh new file mode 100755 index 0000000000..cf1f72e491 --- /dev/null +++ b/Solver/TESTCASES/validation_scripts/test_compilation.sh @@ -0,0 +1,12 @@ +#!/bin/bash +#$1 svn revision id +source run_test.sh +mkdir -p ../build +CDIR=$PWD +for i in ../build/*; do + cd $i + NAME=`basename $i` + run_test "make -j3" "compilation_$NAME" "$1" $HOME/validation/results + cd $CDIR +done + -- GitLab