EOF
}
print_table ()
{
categories=""
for c in $1; do
categories="${categories} categories[\"${c}\"] = 1 ;"
done
# Remember to prune the dir prefix from projects files
# ari.*.idx: ::
cat ${wwwdir}/ari.idx | $AWK >> ${newari} '
function qsort (table,
middle, tmp, left, nr_left, right, nr_right, result) {
middle = ""
for (middle in table) { break; }
nr_left = 0;
nr_right = 0;
for (tmp in table) {
if (tolower(tmp) < tolower(middle)) {
nr_left++
left[tmp] = tmp
} else if (tolower(tmp) > tolower(middle)) {
nr_right++
right[tmp] = tmp
}
}
#print "qsort " nr_left " " middle " " nr_right > "/dev/stderr"
result = ""
if (nr_left > 0) {
result = qsort(left) SUBSEP
}
result = result middle
if (nr_right > 0) {
result = result SUBSEP qsort(right)
}
return result
}
function print_heading (nb_file, where, bug_i) {
print ""
print ""
print "File " nb_file " | "
print "Total | "
print " | "
for (bug_i = 1; bug_i <= nr_bug; bug_i++) {
bug = i2bug[bug_i];
printf ""
# The title names are offset by one. Otherwize, when the browser
# jumps to the name it leaves out half the relevant column.
#printf " ", bug
printf " ", i2bug[bug_i-1]
printf "", bug
printf "%s", gensub(/_/, " ", "g", bug)
printf "\n"
printf " | \n"
}
#print " | "
printf " | \n", i2bug[bug_i-1]
print "Total | "
print "File " nb_file " | "
print "
"
}
function print_totals (where, bug_i) {
print "Totals | "
printf ""
printf "%s", total
printf ">"
printf " | \n"
print " | ";
for (bug_i = 1; bug_i <= nr_bug; bug_i++) {
bug = i2bug[bug_i];
printf ""
printf ""
printf "%d", bug, bug_total[bug]
printf "";
printf "^", prev_file[bug, where], bug
printf "v", next_file[bug, where], bug
printf " ", where, bug
printf " | ";
print ""
}
print " | "
printf ""
printf "%s", total
printf "<"
printf " | \n"
print "Totals | "
print ""
}
BEGIN {
FS = ":"
'"${categories}"'
nr_file = 0;
nr_bug = 0;
}
{
# ari.*.idx: ::
bug = $1
file = $2
category = $3
# Interested in this
if (!(category in categories)) next
# Totals
db[bug, file] += 1
bug_total[bug] += 1
file_total[file] += 1
total += 1
}
END {
# Sort the files and bugs creating indexed lists.
nr_bug = split(qsort(bug_total), i2bug, SUBSEP);
nr_file = split(qsort(file_total), i2file, SUBSEP);
# Dummy entries for first/last
i2file[0] = 0
i2file[-1] = -1
i2bug[0] = 0
i2bug[-1] = -1
# Construct a cycle of next/prev links. The file/bug "0" and "-1"
# are used to identify the start/end of the cycle. Consequently,
# prev(0) = -1 (prev of start is the end) and next(-1) = 0 (next
# of end is the start).
# For all the bugs, create a cycle that goes to the prev / next file.
for (bug_i = 1; bug_i <= nr_bug; bug_i++) {
bug = i2bug[bug_i]
prev = 0
prev_file[bug, 0] = -1
next_file[bug, -1] = 0
for (file_i = 1; file_i <= nr_file; file_i++) {
file = i2file[file_i]
if ((bug, file) in db) {
prev_file[bug, file] = prev
next_file[bug, prev] = file
prev = file
}
}
prev_file[bug, -1] = prev
next_file[bug, prev] = -1
}
# For all the files, create a cycle that goes to the prev / next bug.
for (file_i = 1; file_i <= nr_file; file_i++) {
file = i2file[file_i]
prev = 0
prev_bug[file, 0] = -1
next_bug[file, -1] = 0
for (bug_i = 1; bug_i <= nr_bug; bug_i++) {
bug = i2bug[bug_i]
if ((bug, file) in db) {
prev_bug[file, bug] = prev
next_bug[file, prev] = bug
prev = bug
}
}
prev_bug[file, -1] = prev
next_bug[file, prev] = -1
}
print ""
print "
"
print_heading(nr_file, 0);
print "
"
print_totals(0);
print "
"
for (file_i = 1; file_i <= nr_file; file_i++) {
file = i2file[file_i];
pfile = gensub(/^'${project}'\//, "", 1, file)
print ""
print ""
print "" pfile " | "
printf ""
printf "%s", file_total[file]
printf ">", file, next_bug[file, 0]
printf " | \n"
print " | "
for (bug_i = 1; bug_i <= nr_bug; bug_i++) {
bug = i2bug[bug_i];
if ((bug, file) in db) {
printf ""
printf "%d", bug, db[bug, file]
printf "^", prev_file[bug, file], bug
printf "v", next_file[bug, file], bug
printf " ", file, bug
printf " | "
print ""
} else {
print " | "
#print " | "
}
}
print " | "
printf ""
printf "%s", file_total[file]
printf "<", file, prev_bug[file, -1]
printf " | \n"
print "" pfile " | "
print "
"
}
print "
"
print_totals(-1)
print "
"
print_heading(nr_file, -1);
print "
"
print ""
print "
"
print ""
}
'
}
# Make the scripts available
cp ${aridir}/gdb_*.sh ${wwwdir}
nb_files=`cd "${srcdir}" && /bin/sh ${aridir}/gdb_find.sh "${project}" | wc -l`
echo "Total number of tested files is $nb_files"
if [ "x$debug_awk" = "x" ]
then
debug_awk=0
fi
# Compute the ARI index - ratio of zero vs non-zero problems.
indexes=`${AWK} -v debug=${debug_awk} -v nr="$nb_files" '
BEGIN {
FS=":"
}
{
# ari.*.doc: :::
bug = $1; count = $2; category = $3; doc = $4
# legacy type error have at least one entry,
#corresponding to the declaration.
if (bug ~ /^legacy /) legacy++
# Idem for deprecated_XXX symbols/functions.
if (bug ~ /^deprecated /) deprecated++
if (category !~ /^gdbarch$/) {
bugs += count
nrtests += 1
}
if (count == 0) {
oks++
}
}
END {
if (debug == 1) {
print "nb files: " nr
print "tests/oks: " nrtests "/" oks
print "bugs/tests: " bugs "/" nrtests
print "bugs/oks: " bugs "/" oks
print bugs "/ (" oks "+" legacy "+" deprecated ")"
}
# This value should be as low as possible
print bugs / ( oks + legacy + deprecated )
}
' ${wwwdir}/ari.doc`
# Merge, generating the ARI tables.
if ${update_web_p}
then
echo "Create the ARI table" 1>&2
oldari=${wwwdir}/old.html
ari=${wwwdir}/index.html
newari=${wwwdir}/new.html
rm -f ${newari} ${newari}.gz
cat <> ${newari}
A.R. Index for GDB version ${version}
A.R. Index for GDB version ${version}
${indexes}
You can not take this seriously!
Also available:
most recent branch
|
current
|
last release
Last updated: `date -u`
EOF
print_toc 0 1 "internal regression" Critical <> ${newari} '
BEGIN {
FS = ":"
'"$alls"'
}
{
# ari.*.doc: :::
bug = $1
count = $2
category = $3
doc = $4
if (!(category in all)) {
print "" category ": no documentation
"
}
}
'
cat >> ${newari} <
Input files:
`( cd ${wwwdir} && ls ari.*.bug ari.idx ari.doc ) | while read f
do
echo "${f}"
done`
Scripts:
`( cd ${wwwdir} && ls *.sh ) | while read f
do
echo "${f}"
done`
EOF
for i in . .. ../..; do
x=${wwwdir}/${i}/index.sh
if test -x $x; then
$x ${newari}
break
fi
done
gzip -c -v -9 ${newari} > ${newari}.gz
cp ${ari} ${oldari}
cp ${ari}.gz ${oldari}.gz
cp ${newari} ${ari}
cp ${newari}.gz ${ari}.gz
fi # update_web_p
# ls -l ${wwwdir}
exit 0