Option --priv_cmd for releng/manual_burn and releng/manual_devices

This commit is contained in:
Thomas Schmitt 2011-08-11 16:47:51 +00:00
parent 8d971b0537
commit 2043d7ee66
3 changed files with 69 additions and 12 deletions

View File

@ -33,6 +33,8 @@ can be configured and built. It is not mandatory that libisoburn is already
installed. The tests may use an installed xorriso program as well as a
freshly built one.
>>> Do we really need to be glued to bash ?
+++ auto and manual tests
@ -69,6 +71,8 @@ go to directory ./releng, and execute
or if you want to use an installed xorriso program:
./run_all_auto -x $(which xorriso)
resp.
./run_all_auto -x $(type -p xorriso)
@ -102,16 +106,23 @@ the user or require sysadmin considerations before they are run:
when libisofs was built. libjte is part of package jigit, version >= 1.18,
available at:
http://www.einval.com/~steve/software/JTE/
For building it you will need gmake (which is default "make" on GNU/Linux).
./manual_devices -x ../xorriso/xorriso [-- [--dev device_file_to_use]]
./manual_devices -x ../xorriso/xorriso [-- [--dev device_file_to_use]
[--priv_cmd 'command [arg [arg ...]]']]
Exercises listing of all accessible optical drives and the examination of
a one of these drives. The user needs the permission to operate the CD
drives. This might involve the need for superuser authority.
The media tray of the examined drive will get loaded if it is not already.
If no option --dev is given, then the user gets asked which of the listed
drives to examine more closely.
If a privilege command and optional arguments are given with --priv_cmd,
then this command and arguments are used to laynch the xorriso runs.
Command and arguments must be single words and be submitted alltogether
as one single argument. On Solaris use: --priv_cmd pfexec
./manual_burn -x ../xorriso/xorriso [-- [--dev device_file_to_use]
[--priv_cmd 'command [arg [arg ...]]']
[--what ...directory...] [--any_media]]
Burns the content of the directory given with --what onto re-usable
media: CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE.
@ -120,6 +131,10 @@ the user or require sysadmin considerations before they are run:
The result gets check read and compared with the state of the input
directory. MD5 mismatch causes a test failure. Differences to the directory
state are reported but still regarded as success.
If a privilege command and optional arguments are given with --priv_cmd,
then this command and arguments are used to laynch the xorriso runs.
Command and arguments must be single words and be submitted alltogether
as one single argument. On Solaris use: --priv_cmd pfexec
>>> ./run_all_manual
@ -127,6 +142,17 @@ the user or require sysadmin considerations before they are run:
>>> + Any auto_* script can be run on its own, regardless.
>>> List auto tests
./auto_cxx
Exercises inclusion of xorriso/xorriso.h and libisoburn/libisoburn.h
in C++ programs and linking of the libraries. It might be necessary
to set compiler options by shell variable CFLAGS before running the test.
E.g. if the include headers libisofs.h and libburn.h are not found:
export CFLAGS="-I/usr/local/include"
>>> ./auto_isocontent
>>> ./auto_printsize
+++ give hints what to do with FAIL results.
@ -258,3 +284,7 @@ TODO:
* auto_ tests should know whether they work underneath run_all_auto
or whether they run standalone
* Port releng to FreeBSD.
- Make it run with /bin/sh . Remove all bashisms and GNU gimmicks.

View File

@ -17,6 +17,11 @@ Specific options:
--any_media allow non re-usable MMC media, like CD-R or DVD+R.
Allow paths to non-existing files, but disallow paths
to existing regular files.
--priv_cmd 'command [arg [arg ...]]'
With drive operations execute xorriso as argument
of the given command (e.g. pfexec, sudo) with the
optionally given arguments: command arg arg xorriso ...
Command and arguments must be single words.
Overview:
Test burning to re-usable media CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE.
By default, one-time usable media will be rejected deliberately.
@ -45,6 +50,7 @@ fi
dev=/dev/cdrw
what=../xorriso
any_media=0
priv_cmd=
# Interpret specific options, they begin after the first --.
next_is=ignore
for i in "$@"
@ -63,6 +69,10 @@ do
then
what="$i"
next_is=""
elif test "$next_is" = "priv_cmd"
then
priv_cmd="$i"
next_is=""
elif test "$i" = "--dev"
then
next_is="dev"
@ -72,6 +82,9 @@ do
elif test "$i" = "--any_media"
then
any_media=1
elif test "$i" = "--priv_cmd"
then
next_is="priv_cmd"
else
echo >&2
echo "Unknown test specific option: $i" >&2
@ -119,13 +132,13 @@ fi
# Inspect media
set +e
res=$("$RELENG_XORRISO" -outdev "$dev" 2>&1)
res=$(${priv_cmd} "$RELENG_XORRISO" -outdev "$dev" 2>&1)
ret=$?
set -e
if test "$ret" -ne 0
then
echo "$res" >&2
echo "FAIL : ${SELF} : Non-zero exit value $ret with: $RELENG_XORRISO -outdev $dev"
echo "FAIL : ${SELF} : Non-zero exit value $ret with: ${priv_cmd} $RELENG_XORRISO -outdev $dev"
echo
cleanup
exit 1
@ -157,9 +170,9 @@ then
fi
# Perform burn run
echo "$RELENG_XORRISO" -for_backup -outdev "$dev" -blank as_needed -map "$what" /test
echo ${priv_cmd} "$RELENG_XORRISO" -for_backup -outdev "$dev" -blank as_needed -map "$what" /test
set +e
"$RELENG_XORRISO" \
${priv_cmd} "$RELENG_XORRISO" \
-for_backup \
-outdev "$dev" \
-blank as_needed \
@ -189,10 +202,10 @@ then
fi
# Check read
echo "$RELENG_XORRISO" -for_backup -indev "$dev" \
echo ${priv_cmd} "$RELENG_XORRISO" -for_backup -indev "$dev" \
-check_media event=FATAL -- \ -check_md5_r FATAL / --
set +e
"$RELENG_XORRISO" \
${priv_cmd} "$RELENG_XORRISO" \
-for_backup \
-indev "$dev" \
-print '---check_media:' -check_media event=FATAL -- \

View File

@ -10,6 +10,11 @@ print_specific_help() {
cat << HLP
Specific options:
--dev path Suppress dialog and use path as drive address.
--priv_cmd 'command [arg [arg ...]]'
With drive operations execute xorriso as argument
of the given command (e.g. pfexec, sudo) with the
optionally given arguments: command arg arg xorriso ...
Command and arguments must be single words.
Overview:
Test device scanning and list of speeds.
HLP
@ -37,6 +42,7 @@ fi
# Interpret private options, they begin after the first --.
dev=
priv_cmd=
next_is=ignore
for i in "$@"
do
@ -50,9 +56,16 @@ do
then
dev="$i"
next_is=""
elif test "$next_is" = "priv_cmd"
then
priv_cmd="$i"
next_is=""
elif test "$i" = "--dev"
then
next_is="dev"
elif test "$i" = "--priv_cmd"
then
next_is="priv_cmd"
else
echo >&2
echo "Unknown test specific option: $i" >&2
@ -75,8 +88,8 @@ 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" \
echo -e "\n${SELF}: Running: ${priv_cmd} ${RELENG_XORRISO} -report_about WARNING -outdev ${1} -toc -list_formats -list_profiles out -list_speeds"
${priv_cmd} "$RELENG_XORRISO" -report_about WARNING -outdev "$1" \
-print '---toc :' -toc \
-print '---list_formats :' -list_formats \
-print '---list_profiles :' -list_profiles out \
@ -98,7 +111,7 @@ get_devices() {
then
DEVICES="$1"
else
DEVICES=$("$RELENG_XORRISO" $devices_opt 2>/dev/null | grep "\-dev")
DEVICES=$( ${priv_cmd} "$RELENG_XORRISO" $devices_opt 2>/dev/null | grep "\-dev")
fi
NUM_DEV=$(cat_var "$DEVICES" | wc -l)
case "${NUM_DEV}" in
@ -142,7 +155,7 @@ get_devices() {
# main
"$RELENG_XORRISO" -version
echo -e "\n${SELF}: Running: $RELENG_XORRISO $devices_opt ..."
devices=$("$RELENG_XORRISO" -report_about WARNING $devices_opt | grep "\-dev")
devices=$( ${priv_cmd} "$RELENG_XORRISO" -report_about WARNING $devices_opt | grep "\-dev")
RET="$?"
if test "$SIMULATE_FAILURE" = 1
then
@ -165,10 +178,11 @@ case ${RET} in
;;
*)
boldify
echo -ne "\n${SELF}: ${RELENG_XORRISO} $devices_opt returned ${RET}."
echo -ne "\n${SELF}: ${priv_cmd} ${RELENG_XORRISO} $devices_opt returned ${RET}."
unboldify
echo -e "\n${SELF}: Already mounted?"
df -kh
exit 1
esac
exit 0