merge back enhancements from Thomas
This commit is contained in:
parent
5b87ddb4cb
commit
392f6ba0a0
@ -1,11 +1,13 @@
|
|||||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
# Copyright 2011 George Danchev <danchev@spnet.net>
|
||||||
# Licensed under GNU GPL version 2
|
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net>
|
||||||
|
# Licensed under GNU GPL version 2 or later
|
||||||
|
|
||||||
SELF=$(basename $0)
|
SELF=$(basename $0)
|
||||||
RELENG_XORRISO=0
|
RELENG_XORRISO=0
|
||||||
KEEP=0
|
KEEP=0
|
||||||
SIMULATE_FAILURE=0
|
SIMULATE_FAILURE=0
|
||||||
CLEANUP=1
|
CLEANUP=1
|
||||||
|
RELENG_PRINTED_HELP=0
|
||||||
|
|
||||||
START_DIR_DONT_CHANGE=`pwd`
|
START_DIR_DONT_CHANGE=`pwd`
|
||||||
GEN_DATA_DIR=releng_generated_data/${SELF}
|
GEN_DATA_DIR=releng_generated_data/${SELF}
|
||||||
@ -14,12 +16,15 @@ GEN_DATA_DIR=releng_generated_data/${SELF}
|
|||||||
print_help() {
|
print_help() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
|
|
||||||
Usage: $SELF -x path/to/xorriso [-k0|1] [-f0|1] [-h]
|
Usage: $SELF -x path/to/xorriso [-k0|1] [-f0|1] [-c0|1] [-h]
|
||||||
|
[-- ...test specific options...]
|
||||||
|
General options:
|
||||||
-x absolute or relative path to binary to be run.
|
-x absolute or relative path to binary to be run.
|
||||||
-k keep selfgenerated data (values 0,1, default 0).
|
-k keep selfgenerated data (values 0,1, default 0).
|
||||||
-c cleanup selfgenerated data kept from previous
|
-c cleanup selfgenerated data kept from previous
|
||||||
run and exit (values 0,1, default 0).
|
run and exit (values 0,1, default 0).
|
||||||
-f simulate failure (values 0,1, default 0).
|
-f simulate failure (values 0,1, default 0).
|
||||||
|
-- end of general options, begin of test specific options.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,9 +84,73 @@ cleanup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#############################################
|
#############################################
|
||||||
|
|
||||||
|
no_getopts=1
|
||||||
|
if test "$no_getopts" = 1
|
||||||
|
then
|
||||||
|
|
||||||
|
next_is=
|
||||||
|
for i in "$@"
|
||||||
|
do
|
||||||
|
if test "$next_is" = "ignore"
|
||||||
|
then
|
||||||
|
dummy=dummy
|
||||||
|
elif test "$next_is" = "x"
|
||||||
|
then
|
||||||
|
RELENG_XORRISO="$i"
|
||||||
|
next_is=
|
||||||
|
elif test x"$i" = x"-x"
|
||||||
|
then
|
||||||
|
next_is="x"
|
||||||
|
elif test x"$i" = x"-k" -o x"$i" = x"-k0"
|
||||||
|
then
|
||||||
|
KEEP=0
|
||||||
|
elif test x"$i" = x"-k1"
|
||||||
|
then
|
||||||
|
KEEP=1
|
||||||
|
elif test x"$i" = x"-c" -o x"$i" = x"-c0"
|
||||||
|
then
|
||||||
|
CLEANUP=0
|
||||||
|
elif test x"$i" = x"-c1"
|
||||||
|
then
|
||||||
|
CLEANUP=1
|
||||||
|
elif test x"$i" = x"-f" -o x"$i" = x"-f0"
|
||||||
|
then
|
||||||
|
SIMULATE_FAILURE=0
|
||||||
|
elif test x"$i" = x"-f1"
|
||||||
|
then
|
||||||
|
SIMULATE_FAILURE=1
|
||||||
|
elif test x"$i" = x"-h"
|
||||||
|
then
|
||||||
|
print_help
|
||||||
|
RELENG_PRINTED_HELP=1
|
||||||
|
elif test x"$i" = x"--"
|
||||||
|
then
|
||||||
|
# Begin of private arguments for caller
|
||||||
|
next_is="ignore"
|
||||||
|
else
|
||||||
|
echo >&2
|
||||||
|
echo "Unknown general option: $i" >&2
|
||||||
|
print_help
|
||||||
|
exit 31
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if test "$next_is" = x
|
||||||
|
then
|
||||||
|
echo >&2
|
||||||
|
echo "Option -x expects an argument (the path to the xorriso program)" >&2
|
||||||
|
print_help
|
||||||
|
exit 31
|
||||||
|
fi
|
||||||
|
|
||||||
|
# no_getopts = 1
|
||||||
|
else
|
||||||
|
# no_getopts != 1
|
||||||
|
|
||||||
while getopts "x:k:c:f:h" OPTION
|
while getopts "x:k:c:f:h" OPTION
|
||||||
do
|
do
|
||||||
case $OPTION in
|
case $OPTION in
|
||||||
x)
|
x)
|
||||||
RELENG_XORRISO=$OPTARG
|
RELENG_XORRISO=$OPTARG
|
||||||
;;
|
;;
|
||||||
@ -101,12 +170,16 @@ do
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
print_help
|
# print_help
|
||||||
exit 31
|
# exit 31
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# no_getopts != 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Each releng_ test should decide whether or not to check that
|
# Each releng_ test should decide whether or not to check that
|
||||||
#if [ ! -x $RELENG_XORRISO ]; then
|
#if [ ! -x $RELENG_XORRISO ]; then
|
||||||
# print_help
|
# print_help
|
||||||
@ -126,6 +199,8 @@ if [ x"$CLEANUP" != x"0" -a x"$CLEANUP" != x"1" ]; then
|
|||||||
exit 31
|
exit 31
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# <<< This cannot happen if $no_getopts = 1
|
||||||
if [ x"$SIMULATE_FAILURE" != x"0" -a x"$SIMULATE_FAILURE" != x"1" ]; then
|
if [ x"$SIMULATE_FAILURE" != x"0" -a x"$SIMULATE_FAILURE" != x"1" ]; then
|
||||||
print_help
|
print_help
|
||||||
printf "\n${SELF}: -f simulate failure.\n\n"
|
printf "\n${SELF}: -f simulate failure.\n\n"
|
||||||
|
@ -1,208 +0,0 @@
|
|||||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
|
||||||
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net>
|
|
||||||
# Licensed under GNU GPL version 2 or later
|
|
||||||
|
|
||||||
SELF=$(basename $0)
|
|
||||||
RELENG_XORRISO=0
|
|
||||||
KEEP=0
|
|
||||||
SIMULATE_FAILURE=0
|
|
||||||
CLEANUP=1
|
|
||||||
RELENG_PRINTED_HELP=0
|
|
||||||
|
|
||||||
START_DIR_DONT_CHANGE=`pwd`
|
|
||||||
GEN_DATA_DIR=releng_generated_data/${SELF}
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
print_help() {
|
|
||||||
cat << EOF
|
|
||||||
|
|
||||||
Usage: $SELF -x path/to/xorriso [-k0|1] [-f0|1] [-c0|1] [-h]
|
|
||||||
[-- ...test specific options...]
|
|
||||||
General options:
|
|
||||||
-x absolute or relative path to binary to be run.
|
|
||||||
-k keep selfgenerated data (values 0,1, default 0).
|
|
||||||
-c cleanup selfgenerated data kept from previous
|
|
||||||
run and exit (values 0,1, default 0).
|
|
||||||
-f simulate failure (values 0,1, default 0).
|
|
||||||
-- end of general options, begin of test specific options.
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
boldify() {
|
|
||||||
if which tput >/dev/null 2>&1; then tput smso; fi
|
|
||||||
}
|
|
||||||
|
|
||||||
unboldify() {
|
|
||||||
if which tput >/dev/null 2>&1; then tput rmso; fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
cleanup() {
|
|
||||||
if [ ${KEEP} -eq 0 -a ${CLEANUP} -eq 1 ]; then
|
|
||||||
# safety net, just in case -> we want to be in the starting
|
|
||||||
# directory before removing whatever self-generated stuff
|
|
||||||
if [ -d "${GEN_DATA_DIR}" ]; then
|
|
||||||
cd "${START_DIR_DONT_CHANGE}" || exit 2
|
|
||||||
|
|
||||||
# Verify once again we are in the releng_generated_data directory
|
|
||||||
# Check for both returned code of grep and returned matching string
|
|
||||||
READ_CANON_EXISTS=`readlink -e "${GEN_DATA_DIR}"`
|
|
||||||
DIR_NAME_GEN_DATA=`dirname "${READ_CANON_EXISTS}"`
|
|
||||||
set +e
|
|
||||||
RET_NON_EMPTY_STRING=`echo "${DIR_NAME_GEN_DATA}" | grep -P "\w+\/releng_generated_data$"`
|
|
||||||
GREP_RET_GEN_DATA="$?"
|
|
||||||
case "${GREP_RET_GEN_DATA}" in
|
|
||||||
0)
|
|
||||||
if [ x"${RET_NON_EMPTY_STRING}" != x"" ]; then
|
|
||||||
# now call the nastiness
|
|
||||||
chmod +w -R ${GEN_DATA_DIR}
|
|
||||||
rm -rf ${GEN_DATA_DIR}
|
|
||||||
boldify
|
|
||||||
printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}
|
|
||||||
unboldify
|
|
||||||
else
|
|
||||||
printf "${SELF}: FAIL: Safety check for being in releng_generated_data directory.\n"
|
|
||||||
printf "${SELF}: FAIL: GREP returned empty string: ${RET_NON_EMPTY_STRING}.\n"
|
|
||||||
printf "${SELF}: FAIL: Skipped trying to remove ${GEN_DATA_DIR} directory. Exiting.\n"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
printf "${SELF}: FAIL: Safety check for being in releng_generated_data directory.\n"
|
|
||||||
printf "${SELF}: FAIL: GREP returned code: ${GREP_RET_GEN_DATA}.\n"
|
|
||||||
printf "${SELF}: FAIL: Skipped trying to remove ${GEN_DATA_DIR} directory. Exiting.\n"
|
|
||||||
exit 30
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
printf "${SELF}: ${GEN_DATA_DIR} does not exist. Nothing to clean.\n"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
boldify
|
|
||||||
printf "${SELF}: Leaving (self-generated) %s\n" ${GEN_DATA_DIR}
|
|
||||||
unboldify
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#############################################
|
|
||||||
|
|
||||||
no_getopts=1
|
|
||||||
if test "$no_getopts" = 1
|
|
||||||
then
|
|
||||||
|
|
||||||
next_is=
|
|
||||||
for i in "$@"
|
|
||||||
do
|
|
||||||
if test "$next_is" = "ignore"
|
|
||||||
then
|
|
||||||
dummy=dummy
|
|
||||||
elif test "$next_is" = "x"
|
|
||||||
then
|
|
||||||
RELENG_XORRISO="$i"
|
|
||||||
next_is=
|
|
||||||
elif test x"$i" = x"-x"
|
|
||||||
then
|
|
||||||
next_is="x"
|
|
||||||
elif test x"$i" = x"-k" -o x"$i" = x"-k0"
|
|
||||||
then
|
|
||||||
KEEP=0
|
|
||||||
elif test x"$i" = x"-k1"
|
|
||||||
then
|
|
||||||
KEEP=1
|
|
||||||
elif test x"$i" = x"-c" -o x"$i" = x"-c0"
|
|
||||||
then
|
|
||||||
CLEANUP=0
|
|
||||||
elif test x"$i" = x"-c1"
|
|
||||||
then
|
|
||||||
CLEANUP=1
|
|
||||||
elif test x"$i" = x"-f" -o x"$i" = x"-f0"
|
|
||||||
then
|
|
||||||
SIMULATE_FAILURE=0
|
|
||||||
elif test x"$i" = x"-f1"
|
|
||||||
then
|
|
||||||
SIMULATE_FAILURE=1
|
|
||||||
elif test x"$i" = x"-h"
|
|
||||||
then
|
|
||||||
print_help
|
|
||||||
RELENG_PRINTED_HELP=1
|
|
||||||
elif test x"$i" = x"--"
|
|
||||||
then
|
|
||||||
# Begin of private arguments for caller
|
|
||||||
next_is="ignore"
|
|
||||||
else
|
|
||||||
echo >&2
|
|
||||||
echo "Unknown general option: $i" >&2
|
|
||||||
print_help
|
|
||||||
exit 31
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if test "$next_is" = x
|
|
||||||
then
|
|
||||||
echo >&2
|
|
||||||
echo "Option -x expects an argument (the path to the xorriso program)" >&2
|
|
||||||
print_help
|
|
||||||
exit 31
|
|
||||||
fi
|
|
||||||
|
|
||||||
# no_getopts = 1
|
|
||||||
else
|
|
||||||
# no_getopts != 1
|
|
||||||
|
|
||||||
while getopts "x:k:c:f:h" OPTION
|
|
||||||
do
|
|
||||||
case $OPTION in
|
|
||||||
x)
|
|
||||||
RELENG_XORRISO=$OPTARG
|
|
||||||
;;
|
|
||||||
k)
|
|
||||||
KEEP=$OPTARG
|
|
||||||
;;
|
|
||||||
c)
|
|
||||||
CLEANUP=$OPTARG
|
|
||||||
cleanup
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
f)
|
|
||||||
SIMULATE_FAILURE=$OPTARG
|
|
||||||
;;
|
|
||||||
h)
|
|
||||||
print_help
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# print_help
|
|
||||||
# exit 31
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
# no_getopts != 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Each releng_ test should decide whether or not to check that
|
|
||||||
#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
|
|
||||||
|
|
||||||
if [ x"$KEEP" != x"0" -a x"$KEEP" != x"1" ]; then
|
|
||||||
print_help
|
|
||||||
printf "\n${SELF}: -k keep selfgenerated data.\n\n"
|
|
||||||
exit 31
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ x"$CLEANUP" != x"0" -a x"$CLEANUP" != x"1" ]; then
|
|
||||||
print_help
|
|
||||||
printf "\n${SELF}: -c cleanup selfgenerated data kept from previous run.\n\n"
|
|
||||||
exit 31
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# <<< This cannot happen if $no_getopts = 1
|
|
||||||
if [ x"$SIMULATE_FAILURE" != x"0" -a x"$SIMULATE_FAILURE" != x"1" ]; then
|
|
||||||
print_help
|
|
||||||
printf "\n${SELF}: -f simulate failure.\n\n"
|
|
||||||
exit 31
|
|
||||||
fi
|
|
@ -1,21 +1,74 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
# Copyright 2011 George Danchev <danchev@spnet.net>
|
||||||
# Licensed under GNU GPL version 2
|
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net>
|
||||||
|
# Licensed under GNU GPL version 2 or later
|
||||||
|
|
||||||
# set -e
|
# set -e
|
||||||
|
|
||||||
not_in_releng_exit() {
|
print_specific_help() {
|
||||||
printf "\nPlease execute the tests from releng directory.\n\n"
|
# Print own help text
|
||||||
exit 1
|
echo "Test specific options:"
|
||||||
|
echo " --dev path Suppress dialog and use path as drive address."
|
||||||
|
echo "This test insists in getting a path to xorriso by option -x."
|
||||||
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
# Include common bits
|
# Include common bits and interpret general options
|
||||||
. inc/releng_getopts.inc || not_in_releng_exit
|
getopts_ts=1
|
||||||
|
if test "$getopts_ts" = 1
|
||||||
|
then
|
||||||
|
getopts_inc=inc/releng_getopts_ts.inc
|
||||||
|
else
|
||||||
|
getopts_inc=inc/releng_getopts.inc
|
||||||
|
fi
|
||||||
|
if test -e "$getopts_inc"
|
||||||
|
then
|
||||||
|
. "$getopts_inc"
|
||||||
|
|
||||||
# Each releng_ test should decide whether or not it needs
|
if test "$RELENG_PRINTED_HELP" = 1
|
||||||
# a xorriso binary to test, since some do compilations only.
|
then
|
||||||
if [ ! -x $RELENG_XORRISO ]; then
|
print_specific_help
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo >&2
|
||||||
|
echo "File not found: $getopts_inc" >&2
|
||||||
|
echo "Are we in the ./releng directory of a libisoburn SVN checkout ?" >&2
|
||||||
|
echo "(Please execute the tests from that ./releng directory.)" >&2
|
||||||
|
echo >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Interpret private options, they begin after the first --.
|
||||||
|
dev=
|
||||||
|
next_is=ignore
|
||||||
|
for i in "$@"
|
||||||
|
do
|
||||||
|
if test "$next_is" = "ignore"
|
||||||
|
then
|
||||||
|
if test "$i" = "--"
|
||||||
|
then
|
||||||
|
next_is=""
|
||||||
|
fi
|
||||||
|
elif test "$next_is" = "dev"
|
||||||
|
then
|
||||||
|
dev="$i"
|
||||||
|
next_is=""
|
||||||
|
elif test "$i" = "--dev"
|
||||||
|
then
|
||||||
|
next_is="dev"
|
||||||
|
else
|
||||||
|
echo >&2
|
||||||
|
echo "Unknown test specific option: $i" >&2
|
||||||
|
print_help
|
||||||
|
print_specific_help
|
||||||
|
exit 31
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Insist in having a xorriso
|
||||||
|
if [ ! -x "$RELENG_XORRISO" ]; then
|
||||||
print_help
|
print_help
|
||||||
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n"
|
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n"
|
||||||
exit 31
|
exit 31
|
||||||
@ -23,60 +76,101 @@ fi
|
|||||||
|
|
||||||
#
|
#
|
||||||
get_speeds() {
|
get_speeds() {
|
||||||
echo -e "\n${SELF}: Running: ${RELENG_XORRISO} -outdev ${1} -list_speeds"
|
echo -e "\n${SELF}: Running: ${RELENG_XORRISO} -report_about WARNING -outdev ${1} -toc -list_formats -list_profiles out -list_speeds"
|
||||||
${RELENG_XORRISO} -outdev ${1} -list_speeds
|
"$RELENG_XORRISO" -report_about WARNING -outdev "$1" \
|
||||||
RET_SPEEDS="$?"
|
-print '---toc :' -toc \
|
||||||
case ${RET_SPEEDS} in
|
-print '---list_formats :' -list_formats \
|
||||||
0)
|
-print '---list_profiles :' -list_profiles out \
|
||||||
;;
|
-print '---list_speeds :' -list_speeds
|
||||||
*)
|
}
|
||||||
boldify
|
|
||||||
echo -e "\n${SELF}: ${RELENG_XORRISO} -outdev ${1} -list_speeds returned ${RET_SPEEDS}."
|
cat_var() {
|
||||||
unboldify
|
# $1 = variable to put out with line feeds
|
||||||
;;
|
cat <<+
|
||||||
esac
|
$1
|
||||||
|
+
|
||||||
}
|
}
|
||||||
|
|
||||||
get_devices() {
|
get_devices() {
|
||||||
echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices 2>/dev/null | grep \"\-dev\""
|
# $1 = if not empty: device lines from xorriso -devices
|
||||||
DEVICES=`$RELENG_XORRISO -devices 2>/dev/null | grep "\-dev"`
|
# $2 = if not empty: suppress dialog and use $2 as input
|
||||||
NUM_DEV=`(cat <<+
|
|
||||||
${DEVICES}
|
|
||||||
+
|
|
||||||
) | wc -l`
|
|
||||||
|
|
||||||
|
if test -n "$1"
|
||||||
|
then
|
||||||
|
DEVICES="$1"
|
||||||
|
else
|
||||||
|
DEVICES=$("$RELENG_XORRISO" -devices 2>/dev/null | grep "\-dev")
|
||||||
|
fi
|
||||||
|
NUM_DEV=$(cat_var "$DEVICES" | wc -l)
|
||||||
case "${NUM_DEV}" in
|
case "${NUM_DEV}" in
|
||||||
0)
|
0)
|
||||||
echo -e "${SELF}: No drives found."
|
echo -e "\n${SELF}: No drives found."
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
echo -e "${SELF}: Single drive found:\n${DEVICES}"
|
echo -e "\n${SELF}: 1 drive found:\n"
|
||||||
OUTDEV=`${RELENG_XORRISO} -devices 2>/dev/null | perl -pe "s#^\d+\s+\-dev\s+\'## and s#\'.*##"`
|
|
||||||
get_speeds ${OUTDEV}
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo -e "${SELF}: Multiple drives found. NOT FINISHED YET."
|
echo -e "\n${SELF}: ${NUM_DEV} drives found:\n"
|
||||||
exit 2
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
echo =================================================================
|
||||||
|
echo "$DEVICES"
|
||||||
|
echo =================================================================
|
||||||
|
|
||||||
|
OUTDEV=$( cat_var "$DEVICES" | head -1 | \
|
||||||
|
sed -e "s/[0-9] *-dev '\//\//" -e "s/'.*$//" )
|
||||||
|
if test -n "$2"
|
||||||
|
then
|
||||||
|
x="$2"
|
||||||
|
else
|
||||||
|
echo >&2
|
||||||
|
echo "WARNING: The following tests might pull in the drive tray." >&2
|
||||||
|
echo " Best is if you now put in a suitable media and" >&2
|
||||||
|
echo " load it manually, so nobody gets surprised. :))" >&2
|
||||||
|
echo >&2
|
||||||
|
echo "Which drive to examine ? (Empty input = ${OUTDEV})" >&2
|
||||||
|
read x
|
||||||
|
fi
|
||||||
|
if test -n "$x"
|
||||||
|
then
|
||||||
|
OUTDEV="$x"
|
||||||
|
fi
|
||||||
|
|
||||||
|
get_speeds "$OUTDEV"
|
||||||
}
|
}
|
||||||
|
|
||||||
# main
|
# main
|
||||||
|
"$RELENG_XORRISO" -version
|
||||||
echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices..."
|
echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices..."
|
||||||
$RELENG_XORRISO -devices
|
devices=$("$RELENG_XORRISO" -report_about WARNING -devices | grep "\-dev")
|
||||||
RET_DEVICES="$?"
|
RET="$?"
|
||||||
case ${RET_DEVICES} in
|
if test "$SIMULATE_FAILURE" = 1
|
||||||
|
then
|
||||||
|
echo "===" >&2
|
||||||
|
echo "=== SIMULATING FAILURE BY OVERRIDING EXIT VALUE OF XORRISO" >&2
|
||||||
|
echo "===" >&2
|
||||||
|
echo "FAIL : ${SELF} : Simulated failure caused by option -f"
|
||||||
|
RET=1
|
||||||
|
fi
|
||||||
|
case ${RET} in
|
||||||
0)
|
0)
|
||||||
get_devices
|
get_devices "$devices" "$dev"
|
||||||
;;
|
RET="$?"
|
||||||
|
if test "$RET" = 0
|
||||||
|
then
|
||||||
|
dummy=dummy
|
||||||
|
else
|
||||||
|
echo "FAIL : ${SELF} : Device scan or single drive listing failed"
|
||||||
|
exit "$RET"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
boldify
|
boldify
|
||||||
echo -ne "\n${SELF}: ${RELENG_XORRISO} -devices returned ${RET_DEVICES}."
|
echo -ne "\n${SELF}: ${RELENG_XORRISO} -devices returned ${RET}."
|
||||||
unboldify
|
unboldify
|
||||||
echo -e "\n${SELF}: Already mounted?"
|
echo -e "\n${SELF}: Already mounted?"
|
||||||
df -kh
|
df -kh
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,176 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
|
||||||
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net>
|
|
||||||
# Licensed under GNU GPL version 2 or later
|
|
||||||
|
|
||||||
# set -e
|
|
||||||
|
|
||||||
print_specific_help() {
|
|
||||||
# Print own help text
|
|
||||||
echo "Test specific options:"
|
|
||||||
echo " --dev path Suppress dialog and use path as drive address."
|
|
||||||
echo "This test insists in getting a path to xorriso by option -x."
|
|
||||||
echo
|
|
||||||
}
|
|
||||||
|
|
||||||
# Include common bits and interpret general options
|
|
||||||
getopts_ts=1
|
|
||||||
if test "$getopts_ts" = 1
|
|
||||||
then
|
|
||||||
getopts_inc=inc/releng_getopts_ts.inc
|
|
||||||
else
|
|
||||||
getopts_inc=inc/releng_getopts.inc
|
|
||||||
fi
|
|
||||||
if test -e "$getopts_inc"
|
|
||||||
then
|
|
||||||
. "$getopts_inc"
|
|
||||||
|
|
||||||
if test "$RELENG_PRINTED_HELP" = 1
|
|
||||||
then
|
|
||||||
print_specific_help
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo >&2
|
|
||||||
echo "File not found: $getopts_inc" >&2
|
|
||||||
echo "Are we in the ./releng directory of a libisoburn SVN checkout ?" >&2
|
|
||||||
echo "(Please execute the tests from that ./releng directory.)" >&2
|
|
||||||
echo >&2
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Interpret private options, they begin after the first --.
|
|
||||||
dev=
|
|
||||||
next_is=ignore
|
|
||||||
for i in "$@"
|
|
||||||
do
|
|
||||||
if test "$next_is" = "ignore"
|
|
||||||
then
|
|
||||||
if test "$i" = "--"
|
|
||||||
then
|
|
||||||
next_is=""
|
|
||||||
fi
|
|
||||||
elif test "$next_is" = "dev"
|
|
||||||
then
|
|
||||||
dev="$i"
|
|
||||||
next_is=""
|
|
||||||
elif test "$i" = "--dev"
|
|
||||||
then
|
|
||||||
next_is="dev"
|
|
||||||
else
|
|
||||||
echo >&2
|
|
||||||
echo "Unknown test specific option: $i" >&2
|
|
||||||
print_help
|
|
||||||
print_specific_help
|
|
||||||
exit 31
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Insist in having a xorriso
|
|
||||||
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
|
|
||||||
|
|
||||||
#
|
|
||||||
get_speeds() {
|
|
||||||
echo -e "\n${SELF}: Running: ${RELENG_XORRISO} -report_about WARNING -outdev ${1} -toc -list_formats -list_profiles out -list_speeds"
|
|
||||||
"$RELENG_XORRISO" -report_about WARNING -outdev "$1" \
|
|
||||||
-print '---toc :' -toc \
|
|
||||||
-print '---list_formats :' -list_formats \
|
|
||||||
-print '---list_profiles :' -list_profiles out \
|
|
||||||
-print '---list_speeds :' -list_speeds
|
|
||||||
}
|
|
||||||
|
|
||||||
cat_var() {
|
|
||||||
# $1 = variable to put out with line feeds
|
|
||||||
cat <<+
|
|
||||||
$1
|
|
||||||
+
|
|
||||||
}
|
|
||||||
|
|
||||||
get_devices() {
|
|
||||||
# $1 = if not empty: device lines from xorriso -devices
|
|
||||||
# $2 = if not empty: suppress dialog and use $2 as input
|
|
||||||
|
|
||||||
if test -n "$1"
|
|
||||||
then
|
|
||||||
DEVICES="$1"
|
|
||||||
else
|
|
||||||
DEVICES=$("$RELENG_XORRISO" -devices 2>/dev/null | grep "\-dev")
|
|
||||||
fi
|
|
||||||
NUM_DEV=$(cat_var "$DEVICES" | wc -l)
|
|
||||||
case "${NUM_DEV}" in
|
|
||||||
0)
|
|
||||||
echo -e "\n${SELF}: No drives found."
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
1)
|
|
||||||
echo -e "\n${SELF}: 1 drive found:\n"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo -e "\n${SELF}: ${NUM_DEV} drives found:\n"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
echo =================================================================
|
|
||||||
echo "$DEVICES"
|
|
||||||
echo =================================================================
|
|
||||||
|
|
||||||
OUTDEV=$( cat_var "$DEVICES" | head -1 | \
|
|
||||||
sed -e "s/[0-9] *-dev '\//\//" -e "s/'.*$//" )
|
|
||||||
if test -n "$2"
|
|
||||||
then
|
|
||||||
x="$2"
|
|
||||||
else
|
|
||||||
echo >&2
|
|
||||||
echo "WARNING: The following tests might pull in the drive tray." >&2
|
|
||||||
echo " Best is if you now put in a suitable media and" >&2
|
|
||||||
echo " load it manually, so nobody gets surprised. :))" >&2
|
|
||||||
echo >&2
|
|
||||||
echo "Which drive to examine ? (Empty input = ${OUTDEV})" >&2
|
|
||||||
read x
|
|
||||||
fi
|
|
||||||
if test -n "$x"
|
|
||||||
then
|
|
||||||
OUTDEV="$x"
|
|
||||||
fi
|
|
||||||
|
|
||||||
get_speeds "$OUTDEV"
|
|
||||||
}
|
|
||||||
|
|
||||||
# main
|
|
||||||
"$RELENG_XORRISO" -version
|
|
||||||
echo -e "\n${SELF}: Running: $RELENG_XORRISO -devices..."
|
|
||||||
devices=$("$RELENG_XORRISO" -report_about WARNING -devices | grep "\-dev")
|
|
||||||
RET="$?"
|
|
||||||
if test "$SIMULATE_FAILURE" = 1
|
|
||||||
then
|
|
||||||
echo "===" >&2
|
|
||||||
echo "=== SIMULATING FAILURE BY OVERRIDING EXIT VALUE OF XORRISO" >&2
|
|
||||||
echo "===" >&2
|
|
||||||
echo "FAIL : ${SELF} : Simulated failure caused by option -f"
|
|
||||||
RET=1
|
|
||||||
fi
|
|
||||||
case ${RET} in
|
|
||||||
0)
|
|
||||||
get_devices "$devices" "$dev"
|
|
||||||
RET="$?"
|
|
||||||
if test "$RET" = 0
|
|
||||||
then
|
|
||||||
dummy=dummy
|
|
||||||
else
|
|
||||||
echo "FAIL : ${SELF} : Device scan or single drive listing failed"
|
|
||||||
exit "$RET"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
boldify
|
|
||||||
echo -ne "\n${SELF}: ${RELENG_XORRISO} -devices returned ${RET}."
|
|
||||||
unboldify
|
|
||||||
echo -e "\n${SELF}: Already mounted?"
|
|
||||||
df -kh
|
|
||||||
esac
|
|
||||||
|
|
||||||
exit 0
|
|
Loading…
Reference in New Issue
Block a user