mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-4.1-ndb
into ndbmaster.mysql.com:/ndb/clone-mysql-4.1-ndb-daily-2004-06-14
This commit is contained in:
commit
819b0e13fd
1 changed files with 77 additions and 325 deletions
|
@ -1,106 +1,23 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# NAME
|
|
||||||
# make-html-reports.sh
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
# make-html-reports.sh [-q] [ -R <YYYY-MM-DD> ] [ -s <src dir> ] [ -d <dst dir> ] [ -c <conf dir> ]
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# OPTIONS
|
|
||||||
#
|
|
||||||
# EXAMPLES
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# ENVIRONMENT
|
|
||||||
# NDB_PROJ_HOME Home dir for ndb
|
|
||||||
#
|
|
||||||
# FILES
|
|
||||||
# $NDB_PROJ_HOME/lib/funcs.sh general shell script functions
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# SEE ALSO
|
|
||||||
#
|
|
||||||
# DIAGNOSTICTS
|
|
||||||
#
|
|
||||||
# VERSION
|
|
||||||
# 1.0
|
|
||||||
#
|
|
||||||
# AUTHOR
|
|
||||||
# Jonas Oreland
|
|
||||||
#
|
|
||||||
|
|
||||||
progname=`basename $0`
|
src_dir=$1
|
||||||
synopsis="make-html-reports.sh [ -R <YYYY-MM-DD> ] [ -s <src dir> ] [ -d <dst dir> ] [ -c <conf dir> ]"
|
run=$2
|
||||||
|
date=$3
|
||||||
|
src_file=$src_dir/report.txt
|
||||||
|
|
||||||
: ${NDB_PROJ_HOME:?} # If undefined, exit with error message
|
if [ ! -f $src_dir/report.txt ]
|
||||||
|
then
|
||||||
: ${NDB_LOCAL_BUILD_OPTIONS:=--} # If undef, set to --. Keeps getopts happy.
|
echo "$src_dir/report.txt is missing"
|
||||||
# You may have to experiment a bit
|
exit 1
|
||||||
# to get quoting right (if you need it).
|
fi
|
||||||
|
|
||||||
|
|
||||||
. $NDB_PROJ_HOME/lib/funcs.sh # Load some good stuff
|
|
||||||
|
|
||||||
# defaults for options related variables
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
src_dir=`pwd`
|
|
||||||
dst_dir=`pwd`
|
|
||||||
conf_dir=`pwd`
|
|
||||||
report_date=`date '+%Y-%m-%d'`
|
|
||||||
uniq_id=$$.$$
|
|
||||||
verbose=yes
|
|
||||||
|
|
||||||
# used if error when parsing the options environment variable
|
|
||||||
#
|
|
||||||
env_opterr="options environment variable: <<$options>>"
|
|
||||||
|
|
||||||
# Option parsing, for the options variable as well as the command line.
|
|
||||||
#
|
|
||||||
# We want to be able to set options in an environment variable,
|
|
||||||
# as well as on the command line. In order not to have to repeat
|
|
||||||
# the same getopts information twice, we loop two times over the
|
|
||||||
# getopts while loop. The first time, we process options from
|
|
||||||
# the options environment variable, the second time we process
|
|
||||||
# options from the command line.
|
|
||||||
#
|
|
||||||
# The things to change are the actual options and what they do.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
|
|
||||||
for optstring in "$options" "" # 1. options variable 2. cmd line
|
|
||||||
do
|
|
||||||
|
|
||||||
while getopts q:s:R:d:c: i $optstring # optstring empty => no arg => cmd line
|
|
||||||
do
|
|
||||||
case $i in
|
|
||||||
|
|
||||||
q) verbose="";; # echo important things
|
|
||||||
d) dst_dir=$OPTARG;; # Destination directory
|
|
||||||
s) src_dir=$OPTARG;; # Destination directory
|
|
||||||
c) conf_dir=$OPTARG;; #
|
|
||||||
R) report_date=$OPTARG;; #
|
|
||||||
\?) syndie $env_opterr;; # print synopsis and exit
|
|
||||||
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
[ -n "$optstring" ] && OPTIND=1 # Reset for round 2, cmdline options
|
|
||||||
|
|
||||||
env_opterr= # Round 2 should not use the value
|
|
||||||
|
|
||||||
done
|
|
||||||
shift `expr $OPTIND - 1`
|
|
||||||
|
|
||||||
src_dir=`abspath $src_dir`
|
|
||||||
dst_dir=`abspath $dst_dir`
|
|
||||||
conf_dir=`abspath $conf_dir`
|
|
||||||
|
|
||||||
###
|
###
|
||||||
#
|
#
|
||||||
# General html functions
|
# General html functions
|
||||||
|
trim(){
|
||||||
|
echo $*
|
||||||
|
}
|
||||||
|
|
||||||
header(){
|
header(){
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
<html><head><title>$*</title></head>
|
<html><head><title>$*</title></head>
|
||||||
|
@ -166,64 +83,7 @@ hr(){
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- option parsing done ---
|
|
||||||
|
|
||||||
# -- Verify
|
# -- Verify
|
||||||
trace "Verifying arguments"
|
|
||||||
summary_file=$src_dir/reports/summary.$report_date
|
|
||||||
|
|
||||||
if [ ! -r $summary_file ]
|
|
||||||
then
|
|
||||||
syndie "Invalid src directory or report date: $summary_file not found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d $conf_dir/configurations ]
|
|
||||||
then
|
|
||||||
syndie "Invalid src directory: $conf_dir/configurations not found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d $conf_dir/testcases ]
|
|
||||||
then
|
|
||||||
syndie "Invalid src directory: $conf_dir/testcases not found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d $dst_dir ]
|
|
||||||
then
|
|
||||||
syndie "Invalid dst dir..."
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- option verifying done ---
|
|
||||||
|
|
||||||
trace "src_dir: $src_dir"
|
|
||||||
trace "dst_dir: $dst_dir"
|
|
||||||
trace "conf_dir: $conf_dir"
|
|
||||||
trace "report date: $report_date"
|
|
||||||
|
|
||||||
###
|
|
||||||
config_spec(){
|
|
||||||
cat <<EOF
|
|
||||||
<a href=#$1>$1</a>
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
config_spec_include(){
|
|
||||||
# Print the $1 file to the file we are generating
|
|
||||||
cat <<EOF
|
|
||||||
<a name=$1><pre>
|
|
||||||
EOF
|
|
||||||
if [ -r $conf_dir/configurations/$1 ]
|
|
||||||
then
|
|
||||||
cat -E $conf_dir/configurations/$1 | sed 's/\$/<BR>/g'
|
|
||||||
else
|
|
||||||
cat <<EOF
|
|
||||||
Config spec $1 not found
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
cat <<EOF
|
|
||||||
</pre></a>
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
time_spec(){
|
time_spec(){
|
||||||
# $1 - secs
|
# $1 - secs
|
||||||
_ts_tmp=$1
|
_ts_tmp=$1
|
||||||
|
@ -232,8 +92,14 @@ time_spec(){
|
||||||
_ts_tmp=`expr $_ts_tmp / 60`
|
_ts_tmp=`expr $_ts_tmp / 60`
|
||||||
|
|
||||||
_ts_m=`expr $_ts_tmp % 60`
|
_ts_m=`expr $_ts_tmp % 60`
|
||||||
_ts_tmp=`expr $_ts_tmp / 60`
|
if [ $_ts_tmp -ge 60 ]
|
||||||
|
then
|
||||||
|
_ts_tmp=`expr $_ts_tmp / 60`
|
||||||
|
else
|
||||||
|
_ts_tmp=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
a=3
|
||||||
_ts_h=$_ts_tmp
|
_ts_h=$_ts_tmp
|
||||||
|
|
||||||
if [ $_ts_h -gt 0 ]
|
if [ $_ts_h -gt 0 ]
|
||||||
|
@ -247,191 +113,77 @@ time_spec(){
|
||||||
echo $ret
|
echo $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
log_spec(){
|
|
||||||
_ff_=$src_dir/log/$report_date/$1.$2/test.$3.out
|
|
||||||
if [ -r $_ff_ ] && [ -s $_ff_ ]
|
|
||||||
then
|
|
||||||
_f2_=$dst_dir/log.$report_date.$1.$2.$3.out.gz
|
|
||||||
if [ -r $_f2_ ]
|
|
||||||
then
|
|
||||||
rm $_f2_
|
|
||||||
fi
|
|
||||||
cp $_ff_ $dst_dir/log.$report_date.$1.$2.$3.out
|
|
||||||
gzip $dst_dir/log.$report_date.$1.$2.$3.out
|
|
||||||
rm -f $dst_dir/log.$report_date.$1.$2.$3.out
|
|
||||||
echo "<a href=log.$report_date.$1.$2.$3.out.gz>Log file</a>"
|
|
||||||
else
|
|
||||||
echo "-"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
err_spec(){
|
|
||||||
_ff_=$src_dir/log/$report_date/$1.$2/test.$3.err.tar
|
|
||||||
if [ -r $_ff_ ] && [ -s $_ff_ ]
|
|
||||||
then
|
|
||||||
cp $_ff_ $dst_dir/err.$report_date.$1.$2.$3.err.tar
|
|
||||||
gzip $dst_dir/err.$report_date.$1.$2.$3.err.tar
|
|
||||||
rm -f $dst_dir/err.$report_date.$1.$2.$3.err.tar
|
|
||||||
echo "<a href=err.$report_date.$1.$2.$3.err.tar.gz>Error tarball</a>"
|
|
||||||
else
|
|
||||||
echo "-"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
command_spec(){
|
|
||||||
echo $* | sed 's/;/<BR>/g'
|
|
||||||
}
|
|
||||||
|
|
||||||
### Main
|
### Main
|
||||||
|
|
||||||
html_summary_file=$dst_dir/summary.$report_date.html
|
report_file=$src_dir/report.html
|
||||||
|
summary_file=$src_dir/summary.html
|
||||||
|
|
||||||
|
passed=0
|
||||||
|
failed=0
|
||||||
|
total=0
|
||||||
|
|
||||||
|
pass(){
|
||||||
|
passed=`expr $passed + 1`
|
||||||
|
}
|
||||||
|
|
||||||
|
fail(){
|
||||||
|
failed=`expr $failed + 1`
|
||||||
|
}
|
||||||
|
|
||||||
trace "Creating summary"
|
|
||||||
(
|
(
|
||||||
eval `grep "TOTAL" $summary_file | awk -F";" '{ printf("test_file=\"%s\"; elapsed=\"%s\"; started=\"%s\"; stopped=\"%s\"", $2, $3, $4, $5); }'`
|
header Report $run $date
|
||||||
|
table "border=1"
|
||||||
header "Autotest summary $report_date"
|
|
||||||
heading 1 "Autotest summary $report_date"
|
|
||||||
table
|
|
||||||
row ; column `bold test file: `; column $test_file ; end_row
|
|
||||||
row ; column `bold Started:` ; column "$started "; end_row
|
|
||||||
row ; column `bold Stopped:` ; column "$stopped "; end_row
|
|
||||||
row ; column `bold Elapsed:` ; column "`time_spec $elapsed secs`" ; end_row
|
|
||||||
end_table
|
|
||||||
hr
|
|
||||||
|
|
||||||
table "border=1"
|
|
||||||
row
|
|
||||||
c_column `bold Report`
|
|
||||||
c_column `bold Tag`
|
|
||||||
c_column `bold Version`
|
|
||||||
c_column `bold Distr-Config`
|
|
||||||
c_column `bold Db-Config`
|
|
||||||
c_column `bold Type`
|
|
||||||
c_column `bold Test file`
|
|
||||||
c_column `bold Make`
|
|
||||||
c_column `bold Config`
|
|
||||||
c_column `bold Test time`
|
|
||||||
c_column `bold Passed`
|
|
||||||
c_column `bold Failed`
|
|
||||||
end_row
|
|
||||||
|
|
||||||
grep -v "^#" $summary_file | grep -v TOTAL | sed 's/;/ /g' | \
|
|
||||||
while read tag version config template type test_file make_res make_time conf_res conf_time test_time passed failed
|
|
||||||
do
|
|
||||||
row
|
row
|
||||||
if [ -r $src_dir/reports/report.$tag.$version.$config.$template.$type.$test_file.$report_date ]
|
column `bold Test case`
|
||||||
then
|
column `bold Result`
|
||||||
column "<a href=\"report.$tag.$version.$config.$template.$type.$test_file.$report_date.html\">report</a>"
|
column `bold Elapsed`
|
||||||
else
|
column `bold Log`
|
||||||
column "-"
|
|
||||||
fi
|
|
||||||
|
|
||||||
column $tag
|
|
||||||
column $version
|
|
||||||
column $config
|
|
||||||
column $template
|
|
||||||
column $type
|
|
||||||
column $test_file
|
|
||||||
column "$make_res(`time_spec $make_time`)"
|
|
||||||
column "$conf_res(`time_spec $conf_time`)"
|
|
||||||
c_column "`time_spec $test_time`"
|
|
||||||
c_column `bold $passed`
|
|
||||||
c_column `bold $failed`
|
|
||||||
end_row
|
end_row
|
||||||
done
|
) > $report_file
|
||||||
end_table
|
|
||||||
|
|
||||||
footer
|
cat $src_file | while read line
|
||||||
) > $html_summary_file
|
|
||||||
|
|
||||||
for i in $src_dir/reports/report.*.$report_date
|
|
||||||
do
|
do
|
||||||
f=`basename $i`
|
eval `echo $line | awk -F";" '{ printf("prg=\"%s\"; no=\"%s\"; res=\"%s\"; time=\"%s\"", $1, $2, $3, $4); }'`
|
||||||
trace "Creating report: $f"
|
|
||||||
eval `echo $f | awk -F"." '{printf("tag=%s;version=%s;config=%s;template=%s;type=%s;test_file=%s", $2, $3, $4, $5, $6, $7);}'`
|
|
||||||
|
|
||||||
(
|
prg=`trim $prg`
|
||||||
header "Autotest report $report_date"
|
no=`trim $no`
|
||||||
heading 1 "Autotest report $report_date"
|
res=`trim $res`
|
||||||
table #"border=1"
|
time=`trim $time`
|
||||||
row ; column `bold Tag:`; column $tag ; end_row
|
res_dir="<a href=\"result-$run/$date/result.$no/\">log</a>"
|
||||||
row ; column `bold Version:` ; column $version ; end_row
|
|
||||||
row ; column `bold Configuration:` ; column `config_spec $config`; end_row
|
|
||||||
row ; column `bold Template:` ; column `config_spec $template`; end_row
|
|
||||||
row ; column `bold Type:` ; column $type ; end_row
|
|
||||||
row ; column `bold Test file:` ; column $test_file; end_row
|
|
||||||
end_table
|
|
||||||
hr
|
|
||||||
|
|
||||||
table "border=1"
|
ts=`time_spec $time`
|
||||||
row
|
res_txt=""
|
||||||
c_column `bold Test case`
|
case $res in
|
||||||
c_column `bold Result`
|
0) pass; res_txt="PASSED"; res_dir=" ";;
|
||||||
c_column `bold Test time`
|
*) fail; res_txt="FAILED";;
|
||||||
c_column `bold Logfile`
|
esac
|
||||||
c_column `bold Error tarfile`
|
total=`expr $total + $time`
|
||||||
end_row
|
|
||||||
|
|
||||||
grep -v "^#" $i | sed 's/;/ /g' | \
|
(
|
||||||
while read test_no test_res test_time cmd
|
row
|
||||||
do
|
column $prg
|
||||||
row
|
column $res_txt
|
||||||
column "`command_spec $cmd`"
|
column $ts
|
||||||
case "$test_res" in
|
column $res_dir
|
||||||
0)
|
end_row
|
||||||
column "PASSED";;
|
) >> $report_file
|
||||||
1001)
|
|
||||||
column "API error";;
|
|
||||||
1002)
|
|
||||||
column "Max time expired";;
|
|
||||||
1003)
|
|
||||||
column "Mgm port busy";;
|
|
||||||
*)
|
|
||||||
column "Unknown: $test_res";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
column "`time_spec $test_time`"
|
(
|
||||||
|
row
|
||||||
column "`log_spec $tag $version $test_no`"
|
column $run
|
||||||
column "`err_spec $tag $version $test_no`"
|
column $date
|
||||||
end_row
|
column $passed
|
||||||
done
|
column $failed
|
||||||
end_table
|
column `time_spec $total`
|
||||||
|
column "<a href=\"result-$run/$date/report.html\">report</a>"
|
||||||
# Last on page we include spec
|
column "<a href=\"result-$run/$date/log.txt\">log.txt</a>"
|
||||||
# of used machines and template for config
|
end_row
|
||||||
# for future reference
|
) > $summary_file
|
||||||
hr
|
|
||||||
table "border=1"
|
|
||||||
row; column `bold Configuration:` $config; end_row
|
|
||||||
row; column `config_spec_include $config`; end_row
|
|
||||||
end_table
|
|
||||||
hr
|
|
||||||
table "border=1"
|
|
||||||
row; column `bold Template:` $template; end_row
|
|
||||||
row; column `config_spec_include $template`; end_row
|
|
||||||
end_table
|
|
||||||
|
|
||||||
footer
|
|
||||||
|
|
||||||
) > $dst_dir/$f.html
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# Re creating index
|
|
||||||
trace "Recreating index"
|
|
||||||
(
|
(
|
||||||
header "Autotest super-duper index"
|
end_table
|
||||||
heading 1 "<center>Autotest super-duper index</center>"
|
footer
|
||||||
hr
|
) >> $report_file
|
||||||
for i in `ls $dst_dir/summary.*.html | sort -r -n`
|
|
||||||
do
|
|
||||||
f=`basename $i`
|
|
||||||
cat <<EOF
|
|
||||||
<p><a href=$f>$f</a></p>
|
|
||||||
EOF
|
|
||||||
done
|
|
||||||
footer
|
|
||||||
) > $dst_dir/index.html
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Add table
Reference in a new issue