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 bdfff66993
commit 0411d9bc01
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 installed. The tests may use an installed xorriso program as well as a
freshly built one. freshly built one.
>>> Do we really need to be glued to bash ?
+++ auto and manual tests +++ auto and manual tests
@ -69,6 +71,8 @@ go to directory ./releng, and execute
or if you want to use an installed xorriso program: or if you want to use an installed xorriso program:
./run_all_auto -x $(which xorriso)
resp.
./run_all_auto -x $(type -p xorriso) ./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, when libisofs was built. libjte is part of package jigit, version >= 1.18,
available at: available at:
http://www.einval.com/~steve/software/JTE/ 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 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 a one of these drives. The user needs the permission to operate the CD
drives. This might involve the need for superuser authority. drives. This might involve the need for superuser authority.
The media tray of the examined drive will get loaded if it is not already. 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 If no option --dev is given, then the user gets asked which of the listed
drives to examine more closely. 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] ./manual_burn -x ../xorriso/xorriso [-- [--dev device_file_to_use]
[--priv_cmd 'command [arg [arg ...]]']
[--what ...directory...] [--any_media]] [--what ...directory...] [--any_media]]
Burns the content of the directory given with --what onto re-usable Burns the content of the directory given with --what onto re-usable
media: CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE. 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 The result gets check read and compared with the state of the input
directory. MD5 mismatch causes a test failure. Differences to the directory directory. MD5 mismatch causes a test failure. Differences to the directory
state are reported but still regarded as success. 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 >>> ./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. >>> + Any auto_* script can be run on its own, regardless.
>>> List auto tests >>> 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. +++ give hints what to do with FAIL results.
@ -258,3 +284,7 @@ TODO:
* auto_ tests should know whether they work underneath run_all_auto * auto_ tests should know whether they work underneath run_all_auto
or whether they run standalone 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. --any_media allow non re-usable MMC media, like CD-R or DVD+R.
Allow paths to non-existing files, but disallow paths Allow paths to non-existing files, but disallow paths
to existing regular files. 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: Overview:
Test burning to re-usable media CD-RW, DVD-RW, DVD-RAM, DVD+RW, BD-RE. 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. By default, one-time usable media will be rejected deliberately.
@ -45,6 +50,7 @@ fi
dev=/dev/cdrw dev=/dev/cdrw
what=../xorriso what=../xorriso
any_media=0 any_media=0
priv_cmd=
# Interpret specific options, they begin after the first --. # Interpret specific options, they begin after the first --.
next_is=ignore next_is=ignore
for i in "$@" for i in "$@"
@ -63,6 +69,10 @@ do
then then
what="$i" what="$i"
next_is="" next_is=""
elif test "$next_is" = "priv_cmd"
then
priv_cmd="$i"
next_is=""
elif test "$i" = "--dev" elif test "$i" = "--dev"
then then
next_is="dev" next_is="dev"
@ -72,6 +82,9 @@ do
elif test "$i" = "--any_media" elif test "$i" = "--any_media"
then then
any_media=1 any_media=1
elif test "$i" = "--priv_cmd"
then
next_is="priv_cmd"
else else
echo >&2 echo >&2
echo "Unknown test specific option: $i" >&2 echo "Unknown test specific option: $i" >&2
@ -119,13 +132,13 @@ fi
# Inspect media # Inspect media
set +e set +e
res=$("$RELENG_XORRISO" -outdev "$dev" 2>&1) res=$(${priv_cmd} "$RELENG_XORRISO" -outdev "$dev" 2>&1)
ret=$? ret=$?
set -e set -e
if test "$ret" -ne 0 if test "$ret" -ne 0
then then
echo "$res" >&2 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 echo
cleanup cleanup
exit 1 exit 1
@ -157,9 +170,9 @@ then
fi fi
# Perform burn run # 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 set +e
"$RELENG_XORRISO" \ ${priv_cmd} "$RELENG_XORRISO" \
-for_backup \ -for_backup \
-outdev "$dev" \ -outdev "$dev" \
-blank as_needed \ -blank as_needed \
@ -189,10 +202,10 @@ then
fi fi
# Check read # 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 / -- -check_media event=FATAL -- \ -check_md5_r FATAL / --
set +e set +e
"$RELENG_XORRISO" \ ${priv_cmd} "$RELENG_XORRISO" \
-for_backup \ -for_backup \
-indev "$dev" \ -indev "$dev" \
-print '---check_media:' -check_media event=FATAL -- \ -print '---check_media:' -check_media event=FATAL -- \

View File

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