Various fixes for create-sbu_du-report.sh
- Check that there is enough material to calculate a SBU (!) - Prevent an error if REALSBU does not occur in jhalfs.config - Remove double square bracket: they change semantics and I cannot memorize what the change is (but e.g. file* is not expanded even if there is some filexxx in the dir).
This commit is contained in:
parent
0f3b1c317c
commit
03b24b2a45
1 changed files with 12 additions and 9 deletions
|
@ -9,26 +9,30 @@ DATE=$3
|
||||||
LINE="================================================================================"
|
LINE="================================================================================"
|
||||||
|
|
||||||
# Make sure that we have a directory as first argument
|
# Make sure that we have a directory as first argument
|
||||||
[[ ! -d "$LOGSDIR" ]] && \
|
[ ! -d "$LOGSDIR" ] && \
|
||||||
echo -e "\nUSAGE: create-sbu_du-report.sh logs_directory [book_version] [date]\n" && exit
|
echo -e "\nUSAGE: create-sbu_du-report.sh logs_directory [book_version] [date]\n" && exit
|
||||||
|
|
||||||
# Make sure that the first argument is a jhalfs logs directory
|
# Make sure that the first argument is a jhalfs logs directory
|
||||||
[[ ! -f "$LOGSDIR"/000-masterscript.log ]] && \
|
[ ! -f "$LOGSDIR"/000-masterscript.log ] && \
|
||||||
echo -e "\nLooks like $LOGSDIR isn't a jhalfs logs directory.\n" && exit
|
echo -e "\nLooks like $LOGSDIR isn't a jhalfs logs directory.\n" && exit
|
||||||
|
|
||||||
|
# Make sure something has been built otherwise no need for report :)
|
||||||
|
[ ! -f "$LOGSDIR"/???-binutils-pass1* ] && \
|
||||||
|
echo -e "\nLooks like nothing has been built yet. Aborting report.\n" && exit
|
||||||
|
|
||||||
# If this script is run manually, the book version may be unknown
|
# If this script is run manually, the book version may be unknown
|
||||||
[[ -z "$VERSION" ]] && VERSION=unknown
|
[ -z "$VERSION" ] && VERSION=unknown
|
||||||
[[ -z "$DATE" ]] && DATE=$(date --iso-8601)
|
[ -z "$DATE" ] && DATE=$(date --iso-8601)
|
||||||
|
|
||||||
# If there is iteration logs directories, copy the logs inside iteration-1
|
# If there is iteration logs directories, copy the logs inside iteration-1
|
||||||
# to the top level dir
|
# to the top level dir
|
||||||
[[ -d "$LOGSDIR"/build_1 ]] && \
|
[ -d "$LOGSDIR"/build_1 ] && \
|
||||||
cp $LOGSDIR/build_1/* $LOGSDIR
|
cp $LOGSDIR/build_1/* $LOGSDIR
|
||||||
|
|
||||||
# Set the report file
|
# Set the report file
|
||||||
REPORT="$VERSION"-SBU_DU-"$DATE".report
|
REPORT="$VERSION"-SBU_DU-"$DATE".report
|
||||||
|
|
||||||
[ -f $REPORT ] && : >$REPORT
|
[ -f "$REPORT" ] && : >$REPORT
|
||||||
|
|
||||||
# Dump generation time stamp and book version
|
# Dump generation time stamp and book version
|
||||||
echo -e "\n`date`\n" > "$REPORT"
|
echo -e "\n`date`\n" > "$REPORT"
|
||||||
|
@ -59,15 +63,14 @@ echo -e "\nUsing ${BASELOG#*[[:digit:]]-} to obtain the SBU unit value."
|
||||||
SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG`
|
SBU_UNIT=`sed -n 's/^Totalseconds:\s\([[:digit:]]*\)$/\1/p' $BASELOG`
|
||||||
popd
|
popd
|
||||||
# Get the -j value of the SBU
|
# Get the -j value of the SBU
|
||||||
if [ $(sed -n '/REALSBU/s/.*\([yn]\).*/\1/p' "$REPORT") = y ]; then
|
if [ "$(sed -n '/REALSBU/s/.*\([yn]\).*/\1/p' "$REPORT")" = y ]; then
|
||||||
J_VALUE="1"
|
J_VALUE="1"
|
||||||
else
|
else
|
||||||
J_VALUE=$(sed -n '/N_PARALLEL/s/.*<\([^>]*\).*/\1/p' "$REPORT")
|
J_VALUE=$(sed -n '/N_PARALLEL/s/.*<\([^>]*\).*/\1/p' "$REPORT")
|
||||||
fi
|
fi
|
||||||
# if jhalfs.config does not exist, or OPTIMIZE is 0, then J_VALUE is
|
# if jhalfs.config does not exist, or OPTIMIZE is 0, then J_VALUE is
|
||||||
# still empty. Assume 1 in that case
|
# still empty. Assume 1 in that case
|
||||||
if [ -z "$J_VALUE" ]; then J_VALUE=1; fi
|
echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds at -j${J_VALUE:=1}.\n"
|
||||||
echo -e "\nThe SBU unit value is equal to $SBU_UNIT seconds at -j$J_VALUE.\n"
|
|
||||||
echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds at -j$J_VALUE.\n" >> "$REPORT"
|
echo -e "\n\n$LINE\n\nThe SBU unit value is equal to $SBU_UNIT seconds at -j$J_VALUE.\n" >> "$REPORT"
|
||||||
|
|
||||||
# Set the first value to 0 for grand totals calculation
|
# Set the first value to 0 for grand totals calculation
|
||||||
|
|
Reference in a new issue