]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - tests/unit/prepare_pl
Allow bold, italics or underlined for numbers
[SourceForge/phpwiki.git] / tests / unit / prepare_pl
1 #!/bin/sh
2 # Memory regression helper.
3 # Create a .data file from a .result file, which can then be processed by combine_define.pl
4 # If the 2nd arg is not -nopl some ploticus file is also created.
5
6 result=$1
7 if [ ! -e $result.result ]; then 
8   if [ -e $result ]; then result="`echo $result|sed s,.result,,`"
9   else
10     echo "$result.result missing" 
11     exit
12   fi
13 fi
14
15 perl -ne '
16     BEGIN { $i=1; print "//inc\tmem\tmsg\n"; }
17     chomp;
18     if (/^-- MEMORY USAGE: (\d+)/) {
19         print "$i\t$1\t$msg\n"; $i++;
20     } elsif (/^(\w+)=(\S+)$/) {
21         $vars .= "// $_\n";
22     } else {
23       $msg = $_;
24     }
25     END { print "\n// PARAMS:\n",$vars; }
26 ' $result.result > $result.data
27
28 today=`date`
29 echo "// CREATED=$today" >> $result.data
30
31 # pl -png -o vbars.png -prefab vbars data=all_dba.data x=2 y=1 barwidth=line vals=yes ylbl="memory (kb)" title="dba cli-4.3.9WIN" xlbl="consecutive tests" stubvert=yes ygrid=yes ylbldet="adjust=-0.1,0" xlbldet="adjust=0,-1.2"
32
33 # pl -png -o stack.png -prefab stack data=all_dba.data x=2 y=1 barwidth=line ylbl="memory (kb)" title="dba cli-4.3.9WIN" ygrid=yes ylbldet="adjust=-0.1,0" stubvert=yes stackarea=yes name=file name2=file name3=SQL name4=ADODB
34
35 # pl -png -o all_$db.png -prefab vbars data=all_$db.data x=2 y=1 barwidth=line yfield=1 fill=redorange pointsym=none pointsym2=none 
36
37 if [ "x$2" = "x-nopl" ]; then exit; fi
38
39 php_const() {
40   grep $1 $2|cut -d= -f2
41 }
42 PHP_SAPI=`php_const PHP_SAPI $result.result`
43 PHP_SAPI=${PHP_SAPI:-cli}
44 PHP_OS=`php_const PHP_OS $result.result`
45 PHP_VERSION=`php_const PHP_VERSION $result.result`
46 PHPWIKI_VERSION=`php_const PHPWIKI_VERSION $result.result`
47 title="$PHP_SAPI-$PHP_OS-$PHP_VERSION $PHPWIKI_VERSION"
48 legendvars=`grep "// " $result.data|cut -c4-`
49
50 # echo "Usage: pl -png -o $result.png $result.ploticus"
51 # basic memory usage graph for single test
52 cat > $result.ploticus <<EOF
53 // Usage: pl -png -o $result.png $result.ploticus
54 #proc page
55   pagesize: 11 8.5 
56   #if \@DEVICE in gif,png
57     scale: 0.7
58   #endif
59   textsize: 10
60   title: $title 
61          $result
62
63 #endproc
64
65 #set resultdata = $result.data
66 #include _mem_pl.ploticus
67
68 #proc annotate
69   location: @legend
70   textdetails: size=7, align=L
71   text: $legendvars
72   
73 #endproc
74
75 EOF