2011-06-28 20:58:56 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-07-11 09:40:23 +00:00
|
|
|
# Copyright 2011 George Danchev <danchev@spnet.net>
|
2011-07-15 06:05:57 +00:00
|
|
|
# Licensed under GNU GPL version 2 or later
|
2011-07-11 09:40:23 +00:00
|
|
|
|
2011-06-28 20:58:56 +00:00
|
|
|
set -e
|
|
|
|
|
2011-07-13 11:24:32 +00:00
|
|
|
not_in_releng_exit() {
|
|
|
|
printf "\nPlease execute the tests from releng directory.\n\n"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2011-07-08 14:18:54 +00:00
|
|
|
# Include common bits
|
2011-07-13 11:24:32 +00:00
|
|
|
. inc/releng_getopts.inc || not_in_releng_exit
|
2011-07-08 14:18:54 +00:00
|
|
|
|
2011-07-20 12:23:40 +00:00
|
|
|
print_specific_help() {
|
|
|
|
cat << HLP
|
|
|
|
Specific options:
|
|
|
|
none yet.
|
|
|
|
Overview:
|
|
|
|
Test performance of print_size against various input tree.
|
|
|
|
Optionally compare with genisoimage and mkisofs.
|
|
|
|
HLP
|
|
|
|
}
|
2011-07-18 17:22:59 +00:00
|
|
|
|
|
|
|
if test "$SPECIFIC_HELP" = 1; then
|
2011-07-20 12:23:40 +00:00
|
|
|
print_specific_help
|
2011-07-18 17:22:59 +00:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2011-07-18 12:26:30 +00:00
|
|
|
# Each test should decide whether or not it needs
|
2011-07-08 14:18:54 +00:00
|
|
|
# a xorriso binary to test, since some do compilations only.
|
|
|
|
if [ ! -x $RELENG_XORRISO ]; then
|
|
|
|
print_help
|
|
|
|
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n"
|
|
|
|
exit 31
|
|
|
|
fi
|
|
|
|
|
|
|
|
# check data dir, if any and after checking -x xorriso
|
|
|
|
if [ -d "${GEN_DATA_DIR}" ]; then
|
|
|
|
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
|
2011-07-15 18:07:02 +00:00
|
|
|
printf "\n${SELF}: use '${SELF} -c' to remove.\n"
|
2011-07-08 14:18:54 +00:00
|
|
|
exit 8
|
|
|
|
else
|
|
|
|
mkdir "${GEN_DATA_DIR}"
|
|
|
|
fi
|
|
|
|
|
2011-07-09 14:42:18 +00:00
|
|
|
#
|
2011-07-27 12:04:07 +00:00
|
|
|
DIR_UPPER=32
|
|
|
|
FILE_UPPER=10
|
2011-07-08 14:18:54 +00:00
|
|
|
|
|
|
|
# All must be set at this point
|
2011-07-10 20:02:07 +00:00
|
|
|
# TODO: work out a smarter way to quickly generate different
|
|
|
|
# types of trees (long, deep, etc)
|
2011-07-17 13:40:10 +00:00
|
|
|
printf "\n${SELF}: Generating sample tree in ${GEN_DATA_DIR} :\n"
|
2011-07-27 12:04:07 +00:00
|
|
|
count=0
|
|
|
|
date
|
2011-08-09 19:38:16 +00:00
|
|
|
|
|
|
|
# Hopefully the for-loops are much faster than while-loops with arithmetics
|
|
|
|
# This needs 7/4*DIR_UPPER+FILE_UPPER (= 66) while-iterations
|
|
|
|
#
|
|
|
|
i1_list=
|
|
|
|
i1=0
|
|
|
|
o1=$(expr ${DIR_UPPER} / 4)
|
|
|
|
while test $i1 -lt $o1
|
|
|
|
do
|
|
|
|
i1_list="$i1_list $i1"
|
|
|
|
i1=$(expr $i1 + 1)
|
|
|
|
done
|
|
|
|
i2_list=
|
|
|
|
i2=0
|
|
|
|
o2=$(expr ${DIR_UPPER} / 2)
|
|
|
|
while test $i2 -lt $o2
|
2011-06-28 20:58:56 +00:00
|
|
|
do
|
2011-08-09 19:38:16 +00:00
|
|
|
i2_list="$i2_list $i2"
|
|
|
|
i2=$(expr $i2 + 1)
|
|
|
|
done
|
|
|
|
i3_list=
|
|
|
|
i3=0
|
|
|
|
while test $i3 -lt ${DIR_UPPER}
|
|
|
|
do
|
|
|
|
i3_list="$i3_list $i3"
|
|
|
|
i3=$(expr $i3 + 1)
|
|
|
|
done
|
|
|
|
i_file_list=
|
|
|
|
i_file=0
|
|
|
|
while test $i_file -lt ${FILE_UPPER}
|
|
|
|
do
|
|
|
|
i_file_list="$i_file_list $i_file"
|
|
|
|
i_file=$(expr $i_file + 1)
|
|
|
|
done
|
|
|
|
#
|
|
|
|
# plus 1/8*DIR_UPPER*DIR_UPPER*DIR_UPPER*FILE_UPPER (= 40960) for-iterations
|
|
|
|
#
|
|
|
|
for i1 in $i1_list
|
|
|
|
do
|
|
|
|
for i2 in $i2_list
|
2011-06-28 20:58:56 +00:00
|
|
|
do
|
2011-08-09 19:38:16 +00:00
|
|
|
for i3 in $i3_list
|
2011-06-28 20:58:56 +00:00
|
|
|
do
|
2011-07-27 12:04:07 +00:00
|
|
|
mkdir -p ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3
|
2011-08-09 19:38:16 +00:00
|
|
|
for i_file in $i_file_list
|
2011-07-27 12:04:07 +00:00
|
|
|
do
|
|
|
|
echo -n \
|
|
|
|
> ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3/File_${i_file}
|
|
|
|
count=$((count + 1))
|
|
|
|
done
|
2011-06-28 20:58:56 +00:00
|
|
|
done
|
|
|
|
done
|
2011-07-27 12:04:07 +00:00
|
|
|
echo " ${count} files created ..."
|
2011-06-28 20:58:56 +00:00
|
|
|
done
|
2011-08-09 19:38:16 +00:00
|
|
|
|
2011-07-06 11:30:10 +00:00
|
|
|
printf "done.\n"
|
2011-07-27 12:04:07 +00:00
|
|
|
date
|
|
|
|
du -s "${GEN_DATA_DIR}"
|
2011-06-28 20:58:56 +00:00
|
|
|
|
2011-07-09 10:17:29 +00:00
|
|
|
printf "\n${SELF}: Performing several print size runs to neutralize possible disk cache impact.\n"
|
|
|
|
|
2011-07-09 14:42:18 +00:00
|
|
|
# run xorriso
|
2011-06-28 20:58:56 +00:00
|
|
|
if [ -x ${RELENG_XORRISO} ]; then
|
2011-07-09 10:17:29 +00:00
|
|
|
for run in 1 2 3; do
|
|
|
|
printf "\n${SELF}: Running ${RELENG_XORRISO} -as mkisofs -quiet -print-size ${GEN_DATA_DIR}. Trial: ${run}.\n"
|
|
|
|
time ${RELENG_XORRISO} -as mkisofs -quiet -print-size ${GEN_DATA_DIR}
|
|
|
|
done
|
2011-06-28 20:58:56 +00:00
|
|
|
fi
|
|
|
|
|
2011-07-09 14:42:18 +00:00
|
|
|
# try to run genisoimage
|
|
|
|
if which genisoimage >/dev/null 2>&1; then
|
|
|
|
RELENG_GENISOIMAGE=`which genisoimage`
|
2011-07-09 10:17:29 +00:00
|
|
|
for run in 1 2 3; do
|
|
|
|
printf "\n${SELF}: Running ${RELENG_GENISOIMAGE} -quiet -print-size ${GEN_DATA_DIR}. Trial: ${run}.\n"
|
|
|
|
time ${RELENG_GENISOIMAGE} -quiet -print-size ${GEN_DATA_DIR}
|
|
|
|
done
|
2011-06-28 20:58:56 +00:00
|
|
|
fi
|
|
|
|
|
2011-07-09 14:42:18 +00:00
|
|
|
# try to run mkisofs
|
|
|
|
if which mkisofs >/dev/null 2>&1; then
|
|
|
|
RELENG_MKISOFS=`which mkisofs`
|
2011-07-09 10:17:29 +00:00
|
|
|
for run in 1 2 3; do
|
|
|
|
printf "\n${SELF}: Running ${RELENG_MKISOFS} -quiet -print-size ${GEN_DATA_DIR}. Trial: ${run}.\n"
|
|
|
|
time ${RELENG_MKISOFS} -quiet -print-size ${GEN_DATA_DIR}
|
|
|
|
done
|
2011-06-28 20:58:56 +00:00
|
|
|
fi
|
|
|
|
|
2011-07-09 09:27:12 +00:00
|
|
|
#
|
|
|
|
cleanup
|
2011-06-28 20:58:56 +00:00
|
|
|
|
2011-07-09 09:27:12 +00:00
|
|
|
#
|
2011-06-29 17:44:03 +00:00
|
|
|
exit 0
|