Branching for libisoburn release 1.3.2
This commit is contained in:
27
libisoburn/branches/1.3.2/releng/CHECKLIST
Normal file
27
libisoburn/branches/1.3.2/releng/CHECKLIST
Normal file
@ -0,0 +1,27 @@
|
||||
------------------------------------------------------------------------------
|
||||
http:libburnia-project.org
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Release Engineering Check List
|
||||
|
||||
TEST: releng
|
||||
auto_* tests could be run altogether by ./run_all_auto
|
||||
manual_* tests are to be run individually and manually
|
||||
LOGS: http://people.debian.org/~danchev/libburnia/logs/releng/
|
||||
|
||||
TEST: cppcheck - static code checker
|
||||
LOGS: http://people.debian.org/~danchev/libburnia/logs/cppcheck/
|
||||
|
||||
TEST: medistimator - checks the dialog mode of xorriso, size estimation
|
||||
facility, and its ability of processing large trees. Running this
|
||||
requires some specific knowledge of how the tool works, in order to
|
||||
interpret the results and compare them with these from any previous
|
||||
runs. The source is heavily commented.
|
||||
FILE: http://anonscm.debian.org/gitweb/?p=users/danchev/medistimator.git;a=summary
|
||||
LOGS: http://people.debian.org/~danchev/libburnia/logs/medistimator/
|
||||
|
||||
TEST: Debian ISO image builder logs
|
||||
LOGS: http://cdbuilder.debian.org/cdimage-log/
|
||||
|
||||
TEST: Debian build daemon logs - several hardware architectures and kernels
|
||||
LOGS: http://buildd.debian.org
|
297
libisoburn/branches/1.3.2/releng/README
Normal file
297
libisoburn/branches/1.3.2/releng/README
Normal file
@ -0,0 +1,297 @@
|
||||
------------------------------------------------------------------------------
|
||||
http:libburnia-project.org
|
||||
------------------------------------------------------------------------------
|
||||
libisoburn/releng. By George Danchev <danchev@spnet.net>
|
||||
and Thomas Schmitt <scdbackup@gmx.net>
|
||||
|
||||
Test suite for xorriso and libburnia libraries.
|
||||
Copyright (C) 2011 - 2012 George Danchev, Thomas Schmitt
|
||||
Provided under GPL version 2 or later.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
The impatient tester will build libisoburn according to its README and then do
|
||||
|
||||
cd ./releng
|
||||
./run_all_auto -x ../xorriso/xorriso
|
||||
|
||||
More patient testers will first read the following description.
|
||||
|
||||
Those who simply lack the interpreter /bin/bash, may do
|
||||
./change_shell_to_use
|
||||
and then retry.
|
||||
|
||||
|
||||
The test suite
|
||||
|
||||
Directory ./releng of libisoburn contains a collection of test scripts and
|
||||
auxiliary data. They exercise some typical use cases of building libisoburn
|
||||
applications and running the ISO 9660 filesystem manipulation and CD/DVD/BD
|
||||
burn program xorriso.
|
||||
|
||||
It is assumed that libburn and libisofs are installed, so that libisoburn
|
||||
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.
|
||||
|
||||
The test scripts explicitely demand /bin/bash as interpreter, although they
|
||||
would run on certain other shells too. If you get an error message like
|
||||
./run_all_auto: not found
|
||||
then consider to install /bin/bash.
|
||||
If you decide against that, see below "Alternative Shells".
|
||||
|
||||
|
||||
There are two groups of test scripts:
|
||||
|
||||
auto_* gets started and watched by script run_all_auto.
|
||||
These tests have a moderate resource consumption and do
|
||||
not cause mechanical movements of drive trays.
|
||||
|
||||
manual_* gets started by the user if desired.
|
||||
Manual tests may create larger sets of temporary files,
|
||||
may download test data from the internet, may need
|
||||
system privileges beyond the reach of a sandbox user,
|
||||
and operate the mechanics of a CD drive.
|
||||
|
||||
|
||||
Running automated tests
|
||||
|
||||
The test scripts expect to get run while the working directory is
|
||||
./releng
|
||||
of a libisoburn source tree. E.g.: libisoburn-1.1.4/releng
|
||||
They create all their temporary files underneath
|
||||
./releng/releng_generated_data
|
||||
Some of these files are persistent between tests.
|
||||
Nevertheless it is safe to empty ./releng/releng_generated_data after
|
||||
tests are done. The directory itself must be kept.
|
||||
|
||||
To run the unobtrusive automatic tests, build libisoburn and xorriso,
|
||||
go to directory ./releng, and execute
|
||||
|
||||
./run_all_auto -x ../xorriso/xorriso
|
||||
|
||||
or if you want to use an installed xorriso program:
|
||||
|
||||
./run_all_auto -x $(which xorriso)
|
||||
resp.
|
||||
./run_all_auto -x $(type -p xorriso)
|
||||
|
||||
There are several options which work with run_all_auto and any single test.
|
||||
-x absolute or relative path to xorriso binary to be run.
|
||||
-k keep self-generated data.
|
||||
-c cleanup temporary data kept from previous run and exit.
|
||||
-f simulate failure.
|
||||
-h print this help text.
|
||||
-- end of general options, begin of test specific options.
|
||||
After option "--", there may be given options which are specific to
|
||||
particular manually executable test scripts.
|
||||
|
||||
|
||||
Manually executable tests
|
||||
|
||||
Currently there are the following tests which should have the attention of
|
||||
the user or require sysadmin considerations before they are run:
|
||||
|
||||
./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 launch the xorriso runs.
|
||||
Command and arguments must be single words and be submitted altogether
|
||||
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.
|
||||
Other media types get refused, unless option --any_media is given.
|
||||
Data, which are possibly present on the media, get overwritten.
|
||||
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 launch the xorriso runs.
|
||||
Command and arguments must be single words and be submitted altogether
|
||||
as one single argument. On Solaris use:
|
||||
--priv_cmd pfexec
|
||||
|
||||
./manual_isojigdo -x ../xorriso/xorriso
|
||||
Exercises the production of a bootable Debian GNU/Linux image and its Jigdo
|
||||
files. This test downloads a Debian daily image for i386 of about 270 MB,
|
||||
extracts its content and composes a new image. Thus it needs about 850 MB
|
||||
of disk space in releng/releng_generated_data when unpacked. Adding the daily
|
||||
image size itself, the total space used would peak at about 1.2 GB.
|
||||
This test will only work with GNU xorriso or if libjte was installed already
|
||||
when libisofs was built. Further it needs the program jigit-mkimage. Both
|
||||
are part of package jigit, version >= 1.18, available at:
|
||||
http://www.einval.com/~steve/software/JTE/
|
||||
Currently jigit builds only in GNU environments.
|
||||
|
||||
|
||||
Any auto_* script can be run on its own. Some of them demand option -x.
|
||||
All general options are accepted.
|
||||
|
||||
./auto_cxx
|
||||
Not included in GNU xorriso.
|
||||
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.
|
||||
It might be necessary to hand over the install directory of libburn and
|
||||
libisofs in shell variable LD_LIBRARY_PATH.
|
||||
E.g. if on FreeBSD the include headers libisofs.h , libburn.h are not found:
|
||||
export CFLAGS="-I/usr/local/include"
|
||||
E.g. on GNU/Hurd, where libburn and libisofs are not found by the linker:
|
||||
export LD_LIBRARY_PATH="/usr/local/lib"
|
||||
|
||||
./auto_isocontent -x ../xorriso/xorriso
|
||||
Tests whether xorriso is able to record and restore two familes of
|
||||
hard links.
|
||||
|
||||
./auto_printsize -x ../xorriso/xorriso
|
||||
Tests how long xorriso needs to compose a medium sized directory tree.
|
||||
If programs mkisofs and/or genisomage are availaible, then the same test
|
||||
is done with them.
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
What to do with FAIL results
|
||||
|
||||
The text output of the automatic tests is recorded in file
|
||||
releng_generated_data/log.run_all_auto
|
||||
|
||||
Script ./run_all_auto will detect failure of particular tests and report
|
||||
lines from the log file which contain problem indicating keywords:
|
||||
NEVER,ABORT,FATAL,FAILURE,MISHAP,SORRY,WARNING,HINT,FAIL,ERROR,WRONG
|
||||
|
||||
If the program messages in log.run_all_auto do not explain the failure,
|
||||
please contact mailing list libburn-hackers@pykix.org .
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Alternative Shells
|
||||
|
||||
If you decided against installing /bin/bash, you may try to use your
|
||||
current $SHELL by running
|
||||
./change_shell_to_use
|
||||
which will modify the test scripts named run_all_auto , auto_* ,manual_*.
|
||||
|
||||
Known to be suitable are the following shells
|
||||
GNU/Linux: /bin/bash
|
||||
FreeBSD 8: /bin/sh
|
||||
Solaris: /bin/bash , /bin/i86/ksh93
|
||||
In general, the shell should have Bourne shell ancestry.
|
||||
|
||||
The script does not choose an interpreter explicitely and is safe to be run
|
||||
inline:
|
||||
. ./change_shell_to_use
|
||||
One may set any interpreter path by running a sub shell and changing its
|
||||
variable SHELL. E.g. by:
|
||||
( SHELL=/bin/my_shell" ; . ./change_shell_to_use )
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Creating a new test script
|
||||
|
||||
If you want to provide an own test, manual or auto, then first invent a name
|
||||
for it
|
||||
test_name="releng/manual_"...some.name...
|
||||
or
|
||||
test_name="releng/auto_"...some.name...
|
||||
Then copy file releng/template_new to $test_name.
|
||||
Edit $test_name and process any line that begins by "# === TEMPLATE:".
|
||||
Do what the line prescribes and then remove it from the script. You are
|
||||
not done as long as such a line remains.
|
||||
|
||||
Your test must not start if no file
|
||||
./inc/releng_getopts.inc
|
||||
exists, i.e. if the current working directory is not ./releng.
|
||||
If your test creates own files on disk, then it must do this underneath
|
||||
directory
|
||||
./releng_generated_data/$test_name (resp. $GEN_DATA_DIR, see below).
|
||||
|
||||
In case of failure, issue a line to stdout that begins by the word "FAIL",
|
||||
followed by " : " and the name of the test (e.g. $SELF, see below).
|
||||
Make sure that the test script finally returns a non-zero exit value.
|
||||
This value should be between 1 and 28. Each type of failure should have its
|
||||
own exit value.
|
||||
Predefined are:
|
||||
31 = Unknown option or unusable argument with known option
|
||||
30 = Unexpected state of own directory for self generated files
|
||||
29 = Not in ./releng directory or missing essential parts of ./releng
|
||||
|
||||
When exiting prematurely, make sure to call function cleanup.
|
||||
|
||||
|
||||
Variables, general options, helper functions
|
||||
|
||||
The master script run_all_auto sets this variable:
|
||||
|
||||
RELENG_SCRIPT_RUN_BY_RUN_ALL_AUTO
|
||||
1=supervised, the script is run by run_all_auto script
|
||||
else=standalone, the script is run in standalone mode
|
||||
|
||||
The code piece inc/releng_getopts.inc should get executed inline at the
|
||||
start of a test script. It initializes the following variables and sets
|
||||
some of them according to the general options of the test suite:
|
||||
|
||||
SELF basename $0
|
||||
|
||||
GEN_DATA_DIR releng_generated_data/${SELF}
|
||||
|
||||
RELENG_XORRISO Path to xorriso binary. "" or "0" means no xorriso.
|
||||
Default "0". Adjustable by option -x.
|
||||
|
||||
SIMULATE_FAILURE 0=normal operation, 1=test script shall simulate a failure.
|
||||
Default 0. Setable to 1 by option -f.
|
||||
|
||||
CLEANUP 0=do not cleanup temporary data, 1=normal operation
|
||||
Default 1. Setable to 0 by option -k.
|
||||
|
||||
SPECIFIC_HELP 0=normal operation, 1=print help text of script and exit 0
|
||||
Default 0. Setable to 1 by option -h.
|
||||
|
||||
The code piece inc/releng_getopts.inc defines the following functions
|
||||
for use by the single tests:
|
||||
|
||||
standalone_or_supervised This is internally called routine to print out
|
||||
the running mode of the scripts - standalone,
|
||||
supervised by run_all_auto.
|
||||
No need to call it from the scripts themselves.
|
||||
|
||||
print_help Prints the help text for general options.
|
||||
|
||||
check_for_xorriso [-x]
|
||||
Will exit with value 31 if no path to a xorriso binary
|
||||
was defined by option -x of ./run_all_auto or a single
|
||||
test.
|
||||
Option -x of check_for_xorriso additionally tests whether
|
||||
the given path leads to an executable program.
|
||||
|
||||
cleanup Removes the directory tree GEN_DATA_DIR after making
|
||||
some safety checks.
|
||||
|
||||
boldify Try to set the terminal mode for future output to a more
|
||||
noticable style of writing.
|
||||
unboldify Reset terminal mode to normal style of writing.
|
||||
|
||||
|
||||
Specific options
|
||||
|
||||
Options which are specific to the test should begin with a double dash.
|
||||
They may have further arguments.
|
||||
Implement them in the prepared interpreter loop which begins after line
|
||||
next_is=ignore
|
||||
|
||||
Specific options shall only be interpreted by tests which get run manually.
|
||||
If you plan to introduce a specific option, look at the description of
|
||||
existing tests whether one of them would match your needs. In that case,
|
||||
please re-use the name of that existing option.
|
||||
|
42
libisoburn/branches/1.3.2/releng/TODO
Normal file
42
libisoburn/branches/1.3.2/releng/TODO
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
* Manpage examples turned into tests
|
||||
Convert most examples from xorriso(1) manpage into tests.
|
||||
|
||||
* Enhance 'auto_isocontent'
|
||||
Extend it to use some more demanding directory tree.
|
||||
MD5s should be checked.
|
||||
All file types as of stat(2) should be tested.
|
||||
Test various comparisons:
|
||||
xorriso provides built-in means for comparison:
|
||||
xorriso -compare_r disk_path iso_rr_path
|
||||
xorriso -indev my.iso -find / vs. find input_dir
|
||||
bsdtar -xf my.iso vs. input_dir
|
||||
|
||||
* Test for wrong CD sizes would need a new test and probably an
|
||||
automatic CD changer.
|
||||
|
||||
* Library unit tests - investigate the possibility to write some
|
||||
cunit-based tests (http://cunit.sourceforge.net) for both
|
||||
xorriso.h and libisoburn.h API's. The code samples could be put into
|
||||
codesamples/ directory and run by auto_cxx or a separate auto_ script.
|
||||
|
||||
* ??? Still to decide:
|
||||
Delete debian-testing-i386-businesscard.iso with ./run_all_auto -c
|
||||
Contra: Currently remaining large files (like downloaded ISO images) are
|
||||
simply left behind to be re-used and a boldified info message is shown
|
||||
so the users can decide for themselves what to remove or leave as well.
|
||||
Pro: Leaving 70 MB of image is quite obtrusive. Option -c is not run
|
||||
under normal circumstances. So it could well be used for total cleanup.
|
||||
Alternative: Specific option --remove_image.
|
||||
|
||||
* ??? Still to decide:
|
||||
Have a script ./run_all_manual
|
||||
Contra argument: if a releng sctipt is suitable to be run under a master
|
||||
script run_all*, then this releng script should be put into auto_*
|
||||
namespace , otherwise it is manual_*.
|
||||
Pro: Tests may be manual because they demand lots of resources, not
|
||||
because they need manual attention. In general the run_all_manual script
|
||||
shall spare the user the plight to read the documentation. Instead it
|
||||
shall present the manual tests, give an opportunity to skip the test,
|
||||
and ask for parameters,
|
||||
|
86
libisoburn/branches/1.3.2/releng/auto_cxx
Executable file
86
libisoburn/branches/1.3.2/releng/auto_cxx
Executable file
@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
||||
# Licensed under GNU GPL version 2 or later
|
||||
|
||||
set -e
|
||||
|
||||
not_in_releng_exit() {
|
||||
printf "\nPlease execute the tests from releng directory.\n\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
. inc/releng_getopts.inc || not_in_releng_exit
|
||||
|
||||
print_specific_help() {
|
||||
cat << HLP
|
||||
Specific options:
|
||||
none yet.
|
||||
Overview:
|
||||
Tests both xorriso/xorriso.h and libisoburn/libisoburn.h
|
||||
APIs for C++ cleanness.
|
||||
HLP
|
||||
}
|
||||
|
||||
if test "$SPECIFIC_HELP" = 1; then
|
||||
print_specific_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# xorriso binary is not needed for that particular test
|
||||
SAMPLE_CODE_DIR=codesamples
|
||||
CC=g++
|
||||
|
||||
# check compiler
|
||||
if ! which "${CC}" >/dev/null 2>&1; then
|
||||
printf "\n${SELF}: Not found: ${CC}. Install ${CC}.\n"
|
||||
cleanup
|
||||
exit 5
|
||||
fi
|
||||
|
||||
# check data dir
|
||||
if [ -d "${GEN_DATA_DIR}" ]; then
|
||||
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
|
||||
printf "\n${SELF}: use '${SELF} -c' to remove.\n"
|
||||
exit 6
|
||||
else
|
||||
mkdir "${GEN_DATA_DIR}"
|
||||
fi
|
||||
|
||||
# process sample code tests
|
||||
for SMPL in `ls "${SAMPLE_CODE_DIR}"/*.cpp`; do
|
||||
# CMD_CPL="${CC} -I../ -L ../libisoburn/.libs/ ${CFLAGS} -lisoburn -o ${SMPL}.obj ${SMPL}"
|
||||
CMD_CPL="${CC} -c -I../ -I../../libburn -I../../libisofs ${CFLAGS} -o ${SMPL}.obj ${SMPL}"
|
||||
printf "${SELF}: ${CMD_CPL}"
|
||||
set +e
|
||||
${CMD_CPL}
|
||||
RET_CPL="$?"
|
||||
if [ ${RET_CPL} = 0 -a -f ${SMPL}.obj ]; then
|
||||
mv ${SMPL}.obj ${GEN_DATA_DIR}
|
||||
printf "...ok\n"
|
||||
else
|
||||
printf "\nFAIL : ${SELF}: Compilation of ${SMPL}\n"
|
||||
cleanup
|
||||
exit 7
|
||||
fi
|
||||
# BASE=$(basename ${SMPL}.obj)
|
||||
# printf "${SELF}: Running LD_LIBRARY_PATH=../libisoburn/.libs/:${LD_LIBRARY_PATH} ${GEN_DATA_DIR}/${BASE}"
|
||||
# LD_LIBRARY_PATH=../libisoburn/.libs/:${LD_LIBRARY_PATH} ${GEN_DATA_DIR}/${BASE}
|
||||
# RET_SMPL="$?"
|
||||
# case ${RET_SMPL} in
|
||||
# 0)
|
||||
# printf "...ok\n"
|
||||
# ;;
|
||||
# *)
|
||||
# printf "exit code: ${RET_SMPL}\n"
|
||||
# cleanup
|
||||
# exit 8
|
||||
# ;;
|
||||
# esac
|
||||
set -e
|
||||
done
|
||||
|
||||
# clean
|
||||
cleanup
|
||||
|
||||
exit 0
|
400
libisoburn/branches/1.3.2/releng/auto_isocontent
Executable file
400
libisoburn/branches/1.3.2/releng/auto_isocontent
Executable file
@ -0,0 +1,400 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net>
|
||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
||||
# Licensed under GNU GPL version 2 or later
|
||||
|
||||
# Test the correct handling of hardlinks by xorriso options
|
||||
# -update_r , -hardlinks perform_update , and -extract
|
||||
# If there is support for ACLs or xattr in xorriso and on the local system,
|
||||
# then test recording and restoring of these features.
|
||||
|
||||
not_in_releng_exit() {
|
||||
printf "\nPlease execute the tests from releng directory.\n\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
. inc/releng_getopts.inc || not_in_releng_exit
|
||||
|
||||
print_specific_help() {
|
||||
cat << HLP
|
||||
Specific options:
|
||||
none yet.
|
||||
Overview:
|
||||
Tests ISO image contents by performing various
|
||||
image generation, extractions and comparisons.
|
||||
HLP
|
||||
}
|
||||
|
||||
if test "$SPECIFIC_HELP" = 1; then
|
||||
print_specific_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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}
|
||||
printf "\n${SELF}: use '${SELF} -c' to remove.\n"
|
||||
exit 8
|
||||
else
|
||||
mkdir "${GEN_DATA_DIR}"
|
||||
fi
|
||||
|
||||
export xorriso=${RELENG_XORRISO}
|
||||
export workdir=${GEN_DATA_DIR}
|
||||
export image_file="$workdir"/xorriso_hardlinks.iso
|
||||
export on_disk="$workdir"/xorriso_hardlinks_test_dir
|
||||
export in_iso=""
|
||||
export copy_on_disk="$workdir"/xorriso_hardlinks_copy_dir
|
||||
export failure=0
|
||||
export simulate_failure=${SIMULATE_FAILURE}
|
||||
export next_is_xorriso=0
|
||||
export next_is_rc=0
|
||||
export bad=0
|
||||
export report_about="-report_about UPDATE"
|
||||
|
||||
test -z "$in_iso" && in_iso="$on_disk"
|
||||
|
||||
# mkdir "$workdir" || bad=1
|
||||
mkdir "$on_disk" || bad=1
|
||||
if test "$bad" = 1
|
||||
then
|
||||
echo -e "\nFAIL : ${SELF} : Test environment error : Cannot make directories"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
|
||||
# All must be set at this point
|
||||
printf "\n${SELF}: Setting up $on_disk with several hardlinks\n" >&2
|
||||
echo test_content >"$on_disk"/file_1 || exit 1
|
||||
echo test_content >"$on_disk"/file_2 || exit 1
|
||||
ln "$on_disk"/file_1 "$on_disk"/file_1_link_a || exit 1
|
||||
ln "$on_disk"/file_1 "$on_disk"/file_1_link_b || exit 1
|
||||
ln "$on_disk"/file_2 "$on_disk"/file_2_link_a || exit 1
|
||||
|
||||
# trivial ISO 9660 image validation routine
|
||||
is_valid_iso9660() {
|
||||
ISOfile="$1"
|
||||
if ! which file >/dev/null 2>&1; then
|
||||
printf "\nFAIL : ${SELF}: Not found: file. Please install the file(1) utility.\n"
|
||||
failure=1
|
||||
return
|
||||
fi
|
||||
if [ ! -f ${ISOfile} ]; then
|
||||
failure=1
|
||||
printf "\nFAIL : ${SELF} : Not found: ${ISOfile}\n"
|
||||
return
|
||||
fi
|
||||
|
||||
file ${ISOfile}
|
||||
if file ${ISOfile} | grep "ISO *9660" >/dev/null 2>&1; then
|
||||
printf "\n${SELF}: Resulting ${ISOfile} OK. Looks like ISO 9660 filesystem.\n"
|
||||
else
|
||||
failure=1
|
||||
printf "\nFAIL : ${SELF} : ${ISOfile} DOES NOT look like ISO 9660 filesystem data.\n"
|
||||
fi
|
||||
}
|
||||
|
||||
# Retrieve and evaluate return value of command run under return_wrapper
|
||||
check_xorriso_return() {
|
||||
ret=$(cat "$return_value_file")
|
||||
rm "$return_value_file"
|
||||
if test "$ret" = 0
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
failure=1
|
||||
echo
|
||||
echo "FAIL : ${SELF} : xorriso run exited with value $ret"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Create test file and find out whether ACLs and/or xattr are available.
|
||||
#
|
||||
# Users known on GNU/Linux and FreeBSD: root games daemon man
|
||||
# Groups : daemon games bin sshd sys
|
||||
# On both systems, ACLs are manipulated by setfacl/getfacl
|
||||
#
|
||||
acl_xattr_test_file="$on_disk"/acl_xattr_test_file
|
||||
acl_xattr_copy_file="$copy_on_disk"/acl_xattr_test_file
|
||||
acl_xattr_test_dir="$on_disk"/acl_xattr_test_dir
|
||||
acl_xattr_iso_dir="$in_iso"/acl_xattr_test_dir
|
||||
acl_xattr_copy_dir="$copy_on_disk"/acl_xattr_test_dir
|
||||
mkdir "$acl_xattr_test_dir"
|
||||
echo echo hello world >"$acl_xattr_test_file" || exit 1
|
||||
sys=$(uname -s)
|
||||
acls=no
|
||||
default_acls=no
|
||||
setfacl_opts=""
|
||||
if ( setfacl -m u::rwx,g::r-x,o::---,u:root:rwx,g:sys:rwx,u:daemon:r--,mask::rwx \
|
||||
"$acl_xattr_test_file" ) >/dev/null 2>&1
|
||||
then
|
||||
if ( getfacl "$acl_xattr_test_file" ) >/dev/null 2>&1
|
||||
then
|
||||
if ( setfacl -m u::rwx,g::r-x,o::---,u:root:rwx,g:sys:rwx,u:daemon:r--,mask::rwx \
|
||||
"$acl_xattr_test_dir" ) >/dev/null 2>&1
|
||||
then
|
||||
acls=yes
|
||||
# Setting of "default" ACLs will fail on FreeBSD. It will nevertheless be
|
||||
# done in the image by a xorriso command. Restoring is supposed to skip
|
||||
# "default" ACLs if none could be recorded.
|
||||
if setfacl -m u::rwx,g::r-x,o::---,u:root:rwx,g:sys:rwx,u:daemon:r--,mask::rwx,d:u::rwx,d:g::r-x,d:o::---,d:u:root:rwx,d:g:sys:rwx,d:u:daemon:r--,d:mask::rwx "$acl_xattr_iso_dir" 2>/dev/null
|
||||
then
|
||||
default_acls=yes
|
||||
fi
|
||||
setfacl_opts="-setfacl u::rwx,g::r-x,o::---,u:root:rwx,g:sys:rwx,u:daemon:r--,mask::rwx,d:u::rwx,d:g::r-x,d:o::---,d:u:root:rwx,d:g:sys:rwx,d:u:daemon:r--,d:mask::rwx $acl_xattr_iso_dir --"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# GNU/Linux and FreeBSD have different tools for Extended Attributes
|
||||
xattrs=no
|
||||
extattrs=no
|
||||
# Try GNU/Linux style setattr/getattr
|
||||
if ( setfattr -n user.test_xattr -v test_value "$acl_xattr_test_file" ) \
|
||||
>/dev/null 2>&1
|
||||
then
|
||||
if ( getfattr -d "$acl_xattr_test_file" ) >/dev/null 2>&1
|
||||
then
|
||||
xattrs=yes
|
||||
setfattr -n user.long_data -v 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 "$acl_xattr_test_file"
|
||||
setfattr -n user.more_data -v 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 "$acl_xattr_test_file"
|
||||
fi
|
||||
fi
|
||||
if test "$xattrs" = no
|
||||
then
|
||||
# Try FreeBSD style setextattr
|
||||
if ( setextattr user test_xattr test_value "$acl_xattr_test_file" ) \
|
||||
>/dev/null 2>&1
|
||||
then
|
||||
if ( getextattr user test_xattr "$acl_xattr_test_file" ) >/dev/null 2>&1
|
||||
then
|
||||
setextattr user long_data 0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 "$acl_xattr_test_file"
|
||||
setextattr user more_data 01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 "$acl_xattr_test_file"
|
||||
if ( lsextattr user "$acl_xattr_test_file" ) >/dev/null 2>&1
|
||||
then
|
||||
extattrs=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "${SELF}: Detected sys='$sys' , acls=$acls , d_acls=$default_acls , xattrs=$xattrs , extattrs=$extattrs"
|
||||
|
||||
# Examine capabilities of xorriso
|
||||
xorriso_acls=no
|
||||
xorriso_xattrs=no
|
||||
extras=$("$xorriso" -list_extras all 2>/dev/null)
|
||||
if test "$?" = 0
|
||||
then
|
||||
if echo "$extras" | fgrep 'Local ACL : yes' >/dev/null 2>&1
|
||||
then
|
||||
xorriso_acls=yes
|
||||
fi
|
||||
if echo "$extras" | fgrep 'Local xattr : yes' >/dev/null 2>&1
|
||||
then
|
||||
xorriso_xattrs=yes
|
||||
fi
|
||||
fi
|
||||
if test "$xorriso_acls" = no
|
||||
then
|
||||
acls=no
|
||||
setfacl_opts=
|
||||
fi
|
||||
if test "$xorriso_xattrs" = no
|
||||
then
|
||||
xattrs=no
|
||||
extattrs=no
|
||||
fi
|
||||
|
||||
echo "${SELF}: Detected xorriso_acls=$xorriso_acls , xorriso_xattrs=$xorriso_xattrs"
|
||||
echo
|
||||
ls -l "$on_disk"/*
|
||||
|
||||
echo -e "\n${SELF}: Producing simple image via -o" >&2
|
||||
"$xorriso" -as mkisofs "$on_disk" -o "$workdir"/image_minus_o.iso
|
||||
is_valid_iso9660 "$workdir"/image_minus_o.iso
|
||||
|
||||
echo -e "\n${SELF}: Producing simple image via redirect" >&2
|
||||
"$xorriso" -as mkisofs "$on_disk" > "$workdir"/image_redirected.iso
|
||||
is_valid_iso9660 "$workdir"/image_redirected.iso
|
||||
|
||||
echo -e "\n${SELF}: Producing simple image via pipe" >&2
|
||||
return_wrapper "$xorriso" -as mkisofs "$on_disk" | \
|
||||
cat > "$workdir"/image_piped.iso
|
||||
check_xorriso_return
|
||||
is_valid_iso9660 "$workdir"/image_piped.iso
|
||||
|
||||
echo -e "\n${SELF}: Producing simple image with for_backup/update_r/hardlinks" >&2
|
||||
"$xorriso" \
|
||||
$report_about \
|
||||
-version \
|
||||
-for_backup \
|
||||
-padding 0 \
|
||||
-outdev "$image_file" \
|
||||
-volid TEST_AUTO_ISOCONTENT \
|
||||
-update_r "$on_disk" "$in_iso" \
|
||||
$setfacl_opts \
|
||||
-hardlinks perform_update
|
||||
ret=$?
|
||||
|
||||
if test "$ret" -gt 0 -a "$ret" -lt 32
|
||||
then
|
||||
printf "\nFAIL : ${SELF} : xorriso write run failed\n\n"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
is_valid_iso9660 "$image_file"
|
||||
|
||||
|
||||
# It must refuse to load and go on with -assert_volid and non-matching pattern.
|
||||
msg=$(\
|
||||
"$xorriso" \
|
||||
-abort_on FATAL \
|
||||
-return_with FAILURE 32 \
|
||||
-assert_volid 'NON_MATCHING*' FATAL \
|
||||
-indev "$image_file" \
|
||||
2>&1
|
||||
)
|
||||
ret=$?
|
||||
if test "$ret" -gt 0 -a "$ret" -lt 32
|
||||
then
|
||||
printf "\n${SELF}: Ok. -assert_volid snapped.\n"
|
||||
elif test "$ret" -ne 0
|
||||
then
|
||||
failure=1
|
||||
echo >&2
|
||||
echo "$msg" >&2
|
||||
printf "\nFAIL : ${SELF} : -assert_volid test not properly performed\n\n"
|
||||
else
|
||||
failure=1
|
||||
printf "\nFAIL : ${SELF} : -assert_volid did not snap\n\n" >&2
|
||||
fi
|
||||
|
||||
echo -e "\n${SELF}: Copying from image to temporary disk tree" >&2
|
||||
"$xorriso" \
|
||||
$report_about \
|
||||
-for_backup \
|
||||
-assert_volid 'TEST_AUTO_ISOCONT*' FATAL \
|
||||
-indev "$image_file" \
|
||||
-osirrox on \
|
||||
-find "$in_iso" -exec lsdl -- \
|
||||
-extract "$in_iso" "$copy_on_disk"
|
||||
ret=$?
|
||||
if test "$ret" -gt 0 -a "$ret" -lt 32
|
||||
then
|
||||
printf "\nFAIL : ${SELF} : xorriso file extraction run failed\n\n"
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "$simulate_failure" = 1
|
||||
then
|
||||
echo -e "\n${SELF}: SIMULATING FAILURE BY REMOVING AN EXTRACTED FILE" >&2
|
||||
echo -e "\nFAIL : ${SELF} : Simulated failure caused by option -fail"
|
||||
rm "$copy_on_disk"/file_1_link_b
|
||||
fi
|
||||
|
||||
|
||||
printf "\n${SELF}: Comparing original disk tree and temporary one..." >&2
|
||||
diff -r "$on_disk" "$copy_on_disk"
|
||||
if test "$?" -ne 0
|
||||
then
|
||||
echo -e "\nFAIL : ${SELF} : diff -r $on_disk $copy_on_disk reports differences" >&2
|
||||
echo -e "\nFAIL : ${SELF} : diff -r reports differences"
|
||||
failure=1
|
||||
else
|
||||
printf "OK" >&2
|
||||
fi
|
||||
|
||||
printf "\n${SELF}: Checking for hardlinks being siblings...\n"
|
||||
ls -l "$copy_on_disk"/*
|
||||
x=$(echo $(ls -ld "$copy_on_disk"/*file* | awk '{print $2}'))
|
||||
expected="1 3 3 3 2 2"
|
||||
if test x"$x" = x"$expected"
|
||||
then
|
||||
printf "${SELF}: Checking for hardlinks being siblings done: ok.\n" >&2
|
||||
else
|
||||
printf "\nFAIL : ${SELF} : Link count of extracted files is not as expected." >&2
|
||||
printf "\n${SELF}: Expected: $expected" >&2
|
||||
printf "\n${SELF}: Got : $x\n" >&2
|
||||
failure=1
|
||||
fi
|
||||
|
||||
if test "$acls" = yes
|
||||
then
|
||||
printf "\n${SELF}: Checking ACLs ...\n" >&2
|
||||
acl_on_disk=$(getfacl "$acl_xattr_test_file" | grep -v '^# file:' | sort)
|
||||
acl_in_copy=$(getfacl "$acl_xattr_copy_file" | grep -v '^# file:' | sort)
|
||||
if test "$acl_on_disk" = "$acl_in_copy"
|
||||
then
|
||||
printf "${SELF}: Checking ACLs done: ok.\n" >&2
|
||||
else
|
||||
printf "\nFAIL : ${SELF} : ACL mismatch between original and extracted copy\n"
|
||||
printf "\nOriginal:\n${acl_on_disk}\n"
|
||||
printf "\nCopy:\n${acl_in_copy}\n"
|
||||
failure=1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$xattrs" = yes
|
||||
then
|
||||
printf "\n${SELF}: Checking xattr via getfattr ...\n" >&2
|
||||
xattr_on_disk=$(getfattr "$acl_xattr_test_file" | \
|
||||
grep -v '^# file:' | grep -v '^$' | \sort)
|
||||
xattr_in_copy=$(getfattr "$acl_xattr_copy_file" |
|
||||
grep -v '^# file:' | grep -v '^$' | sort)
|
||||
if test "$xattr_on_disk" = "$xattr_in_copy"
|
||||
then
|
||||
num_xattr=$(echo "$xattr_on_disk" | wc -l)
|
||||
printf "${SELF}: Checking xattr done: $num_xattr attributes, ok.\n" >&2
|
||||
else
|
||||
printf "\nFAIL : ${SELF} : xattr mismatch between original and extracted copy\n"
|
||||
printf "\nOriginal:\n${xattr_on_disk}\n"
|
||||
printf "\nCopy:\n${xattr_in_copy}\n"
|
||||
failure=1
|
||||
fi
|
||||
elif test "$extattrs" = yes
|
||||
then
|
||||
printf "\n${SELF}: Checking xattr via lsextattr and getextattr ...\n" >&2
|
||||
lsext_on_disk=$(lsextattr -q user "$acl_xattr_test_file")
|
||||
xattr_on_disk=$(for i in $lsext_on_disk ; do echo $i $(getextattr -q user $i "$acl_xattr_test_file"); done | sort)
|
||||
lsext_in_copy=$(lsextattr -q user "$acl_xattr_copy_file")
|
||||
xattr_in_copy=$(for i in $lsext_in_copy ; do echo $i $(getextattr -q user $i "$acl_xattr_copy_file"); done | sort)
|
||||
if test "$xattr_on_disk" = "$xattr_in_copy"
|
||||
then
|
||||
num_xattr=$(echo "$xattr_on_disk" | wc -l)
|
||||
printf "${SELF}: Checking xattr done: $num_xattr attributes, ok.\n" >&2
|
||||
else
|
||||
printf "\nFAIL : ${SELF} : xattr mismatch between original and extracted copy\n"
|
||||
printf "\nOriginal:\n${xattr_on_disk}\n"
|
||||
printf "\nCopy:\n${xattr_in_copy}\n"
|
||||
failure=1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
#
|
||||
echo
|
||||
cleanup
|
||||
|
||||
# Report result
|
||||
echo
|
||||
if test "$failure" = 1
|
||||
then
|
||||
printf "${SELF}: FAILED"
|
||||
echo
|
||||
exit 1
|
||||
else
|
||||
printf "${SELF}: Passed"
|
||||
echo
|
||||
fi
|
||||
|
||||
exit 0
|
149
libisoburn/branches/1.3.2/releng/auto_printsize
Executable file
149
libisoburn/branches/1.3.2/releng/auto_printsize
Executable file
@ -0,0 +1,149 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
||||
# Licensed under GNU GPL version 2 or later
|
||||
|
||||
set -e
|
||||
|
||||
not_in_releng_exit() {
|
||||
printf "\nPlease execute the tests from releng directory.\n\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Include common bits
|
||||
. inc/releng_getopts.inc || not_in_releng_exit
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
if test "$SPECIFIC_HELP" = 1; then
|
||||
print_specific_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Each test should decide whether or not it needs
|
||||
# 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}
|
||||
printf "\n${SELF}: use '${SELF} -c' to remove.\n"
|
||||
exit 8
|
||||
else
|
||||
mkdir "${GEN_DATA_DIR}"
|
||||
fi
|
||||
|
||||
#
|
||||
DIR_UPPER=32
|
||||
FILE_UPPER=10
|
||||
|
||||
# All must be set at this point
|
||||
# TODO: work out a smarter way to quickly generate different
|
||||
# types of trees (long, deep, etc)
|
||||
printf "\n${SELF}: Generating sample tree in ${GEN_DATA_DIR} :\n"
|
||||
count=0
|
||||
date
|
||||
|
||||
# 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
|
||||
do
|
||||
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
|
||||
do
|
||||
for i3 in $i3_list
|
||||
do
|
||||
mkdir -p ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3
|
||||
for i_file in $i_file_list
|
||||
do
|
||||
echo -n \
|
||||
> ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3/File_${i_file}
|
||||
count=$((count + 1))
|
||||
done
|
||||
done
|
||||
done
|
||||
echo " ${count} files created ..."
|
||||
done
|
||||
|
||||
printf "done.\n"
|
||||
date
|
||||
du -s "${GEN_DATA_DIR}"
|
||||
|
||||
printf "\n${SELF}: Performing several print size runs to neutralize possible disk cache impact.\n"
|
||||
|
||||
# run xorriso
|
||||
if [ -x ${RELENG_XORRISO} ]; then
|
||||
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
|
||||
fi
|
||||
|
||||
# try to run genisoimage
|
||||
if which genisoimage >/dev/null 2>&1; then
|
||||
RELENG_GENISOIMAGE=`which genisoimage`
|
||||
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
|
||||
fi
|
||||
|
||||
# try to run mkisofs
|
||||
if which mkisofs >/dev/null 2>&1; then
|
||||
RELENG_MKISOFS=`which mkisofs`
|
||||
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
|
||||
fi
|
||||
|
||||
#
|
||||
cleanup
|
||||
|
||||
#
|
||||
exit 0
|
39
libisoburn/branches/1.3.2/releng/change_shell_to_use
Executable file
39
libisoburn/branches/1.3.2/releng/change_shell_to_use
Executable file
@ -0,0 +1,39 @@
|
||||
|
||||
# check whether we are in releng and create dir
|
||||
mkdir_ret=29
|
||||
if test -d releng_generated_data
|
||||
then
|
||||
if test -d releng_generated_data/change_shell_to_use
|
||||
then
|
||||
mkdir_ret=0
|
||||
else
|
||||
mkdir releng_generated_data/change_shell_to_use
|
||||
mkdir_ret=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$mkdir_ret" = 0
|
||||
then
|
||||
for i in run_all_auto auto_* manual_*
|
||||
do
|
||||
temp=releng_generated_data/change_shell_to_use/temp_file
|
||||
c=$(wc -l "$i" | awk '{print $1}')
|
||||
line=$(head -n 1 "$i")
|
||||
|
||||
if echo x"$line" | grep '^x#!' >/dev/null 2>&1
|
||||
then
|
||||
cp "$i" "$temp"
|
||||
echo '#!'"$SHELL" > "$temp"
|
||||
tail -n "$(expr $c - 1)" "$i" >> "$temp"
|
||||
mv "$temp" "$i"
|
||||
echo "Changed to #!$SHELL : $i"
|
||||
fi
|
||||
done
|
||||
rmdir releng_generated_data/change_shell_to_use
|
||||
else
|
||||
echo "change_shell_to_use: Missing directory ./releng_generated_data" >&2
|
||||
echo "or cannot create directory ./releng_generated_data/change_shell_to_use" >&2
|
||||
echo "change_shell_to_use: Run aborted"
|
||||
test 1 = 0
|
||||
fi
|
||||
|
34
libisoburn/branches/1.3.2/releng/codesamples/api_3lib.cpp
Normal file
34
libisoburn/branches/1.3.2/releng/codesamples/api_3lib.cpp
Normal file
@ -0,0 +1,34 @@
|
||||
// Just to ensure we are C++-clean. This should not spit too much noise
|
||||
|
||||
/* Copyright 2011 George Danchev <danchev@spnet.net>
|
||||
* Released into the public domain
|
||||
*/
|
||||
|
||||
#if __WORDSIZE == 32
|
||||
#define _LARGEFILE_SOURCE 1
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <inttypes.h>
|
||||
|
||||
//extern "C" {
|
||||
#include "libburn/libburn.h"
|
||||
#include "libisofs/libisofs.h"
|
||||
// using namespace burn;
|
||||
// (this was needed to before rev.4062 of libisoburn)
|
||||
#include "libisoburn/libisoburn.h"
|
||||
//}
|
||||
|
||||
int main() {
|
||||
int major=-1, minor=-1, micro=-1;
|
||||
isoburn_version(&major, &minor, µ);
|
||||
if (major<0 || minor<0 || micro<0)
|
||||
return -1;
|
||||
std::cout
|
||||
<< " major:" << major
|
||||
<< " minor:" << minor
|
||||
<< " micro:" << micro
|
||||
;
|
||||
return 0;
|
||||
}
|
30
libisoburn/branches/1.3.2/releng/codesamples/api_xorriso.cpp
Normal file
30
libisoburn/branches/1.3.2/releng/codesamples/api_xorriso.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
// Just to ensure we are C++-clean. This should not spit too much noise
|
||||
|
||||
/* Copyright 2011 George Danchev <danchev@spnet.net>
|
||||
* Released into the public domain
|
||||
*/
|
||||
|
||||
#if __WORDSIZE == 32
|
||||
#define _LARGEFILE_SOURCE 1
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <inttypes.h>
|
||||
|
||||
//extern "C" {
|
||||
#include "xorriso/xorriso.h"
|
||||
//}
|
||||
|
||||
int main() {
|
||||
int major=-1, minor=-1, micro=-1;
|
||||
Xorriso__version(&major, &minor, µ);
|
||||
if (major<0 || minor<0 || micro<0)
|
||||
return -1;
|
||||
std::cout
|
||||
<< " major:" << major
|
||||
<< " minor:" << minor
|
||||
<< " micro:" << micro
|
||||
;
|
||||
return 0;
|
||||
}
|
198
libisoburn/branches/1.3.2/releng/inc/releng_getopts.inc
Normal file
198
libisoburn/branches/1.3.2/releng/inc/releng_getopts.inc
Normal file
@ -0,0 +1,198 @@
|
||||
# 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
|
||||
SIMULATE_FAILURE=0
|
||||
CLEANUP=1
|
||||
SPECIFIC_HELP=0
|
||||
START_DIR_DONT_CHANGE=`pwd`
|
||||
GEN_DATA_DIR=releng_generated_data/${SELF}
|
||||
|
||||
#############################################
|
||||
standalone_or_supervised() {
|
||||
case "${RELENG_SCRIPT_RUN_BY_RUN_ALL_AUTO}" in
|
||||
1)
|
||||
echo "${SELF}: Running in Supervised mode"
|
||||
;;
|
||||
*)
|
||||
echo "${SELF}: Running in Standalone mode"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Unconditionally shout out the invocation mode - standalone or supervised
|
||||
standalone_or_supervised
|
||||
|
||||
#############################################
|
||||
print_help() {
|
||||
cat << EOF
|
||||
|
||||
Usage: $SELF -x path/to/xorriso [-k] [-f] [-c] [-h]
|
||||
[-- ...test specific options...]
|
||||
General options:
|
||||
-x absolute or relative path to xorriso binary to be run.
|
||||
-k keep self-generated data.
|
||||
-c cleanup self-generated data kept from previous run and exit.
|
||||
-f simulate failure.
|
||||
-h print this help text
|
||||
-- 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 [ ${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
|
||||
# There is no "readlink -e" on FreeBSD
|
||||
READ_CANON_EXISTS=`cd "${GEN_DATA_DIR}" 2>/dev/null && pwd`
|
||||
DIR_NAME_GEN_DATA=`dirname "${READ_CANON_EXISTS}"`
|
||||
set +e
|
||||
# There is no "grep -P" on FreeBSD
|
||||
RET_NON_EMPTY_STRING=`echo "${DIR_NAME_GEN_DATA}" | grep "[a-zA-Z0-9_][a-zA-Z0-9_]*/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 -R +w ${GEN_DATA_DIR}
|
||||
rm -rf ${GEN_DATA_DIR}
|
||||
# boldify
|
||||
printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}
|
||||
# unboldify
|
||||
else
|
||||
printf "FAIL : ${SELF} : Safety check for being in releng_generated_data directory.\n"
|
||||
printf "FAIL : ${SELF} : GREP returned empty string: ${RET_NON_EMPTY_STRING}.\n"
|
||||
printf "FAIL : ${SELF} : Skipped trying to remove ${GEN_DATA_DIR} directory. Exiting.\n"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
printf "FAIL : ${SELF} : Safety check for being in releng_generated_data directory.\n"
|
||||
printf "FAIL : ${SELF} : GREP returned code: ${GREP_RET_GEN_DATA}.\n"
|
||||
printf "FAIL : ${SELF} : 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
|
||||
}
|
||||
|
||||
#############################################
|
||||
check_for_xorriso() {
|
||||
# $1: if "-x" then check executability
|
||||
|
||||
if test -z "$RELENG_XORRISO" -o "$RELENG_XORRISO" = "0"
|
||||
then
|
||||
print_help
|
||||
# print_specific_help
|
||||
echo
|
||||
echo "${SELF}: Need -x absolute or relative path to xorriso binary."
|
||||
echo
|
||||
exit 31
|
||||
fi
|
||||
if [ x"$1" = x"-x" -a ! -x "$RELENG_XORRISO" ]
|
||||
then
|
||||
print_help
|
||||
# print_specific_help
|
||||
echo
|
||||
echo "${SELF}: Path given by option -x does not lead to an executable file."
|
||||
echo "Given is: '$RELENG_XORRISO'"
|
||||
if test "$RELENG_XORRISO" = "xorriso"
|
||||
then
|
||||
xorriso=$(type -p xorriso)
|
||||
if test -n "xorriso"
|
||||
then
|
||||
echo "Hint: Try '$xorriso'"
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
exit 31
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
#############################################
|
||||
|
||||
# To catch the exit value of a command in a pipe
|
||||
return_value_file="$GEN_DATA_DIR"/wrapper_"$$"_return_value
|
||||
return_wrapper()
|
||||
{
|
||||
cmd="$1"
|
||||
shift 1
|
||||
"$cmd" "$@"
|
||||
RET="$?"
|
||||
echo "$RET" >"$return_value_file"
|
||||
return "$RET"
|
||||
}
|
||||
|
||||
#############################################
|
||||
|
||||
next_is=
|
||||
for i in "$@"
|
||||
do
|
||||
if test "$next_is" = "ignore"
|
||||
then :
|
||||
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"
|
||||
then
|
||||
CLEANUP=0
|
||||
elif test x"$i" = x"-c"
|
||||
then
|
||||
CLEANUP=1
|
||||
cleanup
|
||||
exit 0
|
||||
elif test x"$i" = x"-f"
|
||||
then
|
||||
SIMULATE_FAILURE=1
|
||||
elif test x"$i" = x"-h"
|
||||
then
|
||||
print_help
|
||||
SPECIFIC_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
|
20
libisoburn/branches/1.3.2/releng/inc/test_releng_getopt
Executable file
20
libisoburn/branches/1.3.2/releng/inc/test_releng_getopt
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. releng_getopts.inc
|
||||
|
||||
boldify
|
||||
printf "\ntesting boldify and unboldify..."
|
||||
unboldify
|
||||
|
||||
printf "\nSELF =${SELF}"
|
||||
printf "\nRELENG_XORRISO =${RELENG_XORRISO}"
|
||||
printf "\nSIMULATE_FAILURE =${SIMULATE_FAILURE}"
|
||||
printf "\nCLEANUP =${CLEANUP}"
|
||||
printf "\nSPECIFIC_HELP =${SPECIFIC_HELP}"
|
||||
printf "\nSTART_DIR_DONT_CHANGE =${START_DIR_DONT_CHANGE}"
|
||||
printf "\nGEN_DATA_DIR =${GEN_DATA_DIR}"
|
||||
printf "\n"
|
||||
|
||||
exit 0
|
175
libisoburn/branches/1.3.2/releng/jigdo-gen-md5-list
Executable file
175
libisoburn/branches/1.3.2/releng/jigdo-gen-md5-list
Executable file
@ -0,0 +1,175 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2010, 2011 George Danchev <danchev@spnet.net>
|
||||
# Copyright (c) 2010, 2011 Thomas Schmitt <scdbackup@gmx.net>
|
||||
# This script is distributed according to the terms of the GNU GPL v2.
|
||||
# This should be better rewritten in C at some future point. Ref: pwd code.
|
||||
|
||||
# Create a list of MD5sums encoded in hexidecimal format and print to standard output
|
||||
|
||||
# Format Description
|
||||
# A line in the emerging file is to be composed as follows:
|
||||
#
|
||||
# The MD5 checksum of the file content must be encoded in 32 hex digits
|
||||
# [0-9afAF]
|
||||
#
|
||||
# Next come two blanks.
|
||||
#
|
||||
# The byte size of the file content must be encoded in 12 decimal digits
|
||||
# or blanks.
|
||||
#
|
||||
# Next come two blanks.
|
||||
#
|
||||
# The rest of the line up to the newline character is a semi-literal file
|
||||
# address. Its basename has to be the same as the basename of the data file
|
||||
# when it is used as one of the input files for the jigdo file generator.
|
||||
|
||||
# The semi-literal address and the address mapping define what will be
|
||||
# listed as file address in the jigdo file.
|
||||
# The address may bear at its start a literal text that shall be recognized by
|
||||
# the address mapping (e.g. -jigdo-map) of the jigdo file generator.
|
||||
# The rest of the address must be usable as file address in both situations:
|
||||
# When the jigdo file gets generated, and when the jigdo file gets read
|
||||
# to inflate the template file into the original payload image.
|
||||
# The address mappings at both occasions can be used to adapt to a change
|
||||
# of the absolute location of the listed files.
|
||||
# Between both mappings, the parent directory is represented by a symbolic
|
||||
# text, like "Debian:".
|
||||
|
||||
# A simple strategy to cope with this is to write absolute paths into the
|
||||
# .md5 file, and to use matching absolute paths in the -jigdo-map
|
||||
# directives. Keep in mind that mapping is purely literal. Symbolic links
|
||||
# are neither resolved nor can they confuse the mapping.
|
||||
|
||||
set -e
|
||||
|
||||
SELF=jigdo-gen-md5-list
|
||||
VER=0.2
|
||||
|
||||
OPT_ABSOLUTE=1
|
||||
|
||||
# On FreeBSD there is "md5" rather than "md5sum".
|
||||
# Furthermore, the FreeBSD shell reports missing commands to inherited stderr,
|
||||
# regardless that the attempt itself has redirected stderr. Thus a sub shell
|
||||
# is needed to hide the protest.
|
||||
if ( md5sum --help ) >/dev/null 2>&1
|
||||
then
|
||||
md5_cmd=md5sum
|
||||
elif ( md5 -s test ) >/dev/null 2>&1
|
||||
then
|
||||
md5_cmd=md5
|
||||
else
|
||||
echo "$0 : Programs md5sum and md5 failed to work" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
usage() {
|
||||
cat << USAGE
|
||||
usage: $SELF [option] DIR FILE ...
|
||||
-a, --make-absolute make absolute paths, avoiding any symlinks (default)
|
||||
-l, --keep-literal leave paths untouched, literally as supplied
|
||||
-v, --version print version
|
||||
-h, --help print help
|
||||
-e, --examples print examples
|
||||
USAGE
|
||||
}
|
||||
|
||||
examples() {
|
||||
cat << EXAMPLES
|
||||
examples:
|
||||
$SELF datadir datafile
|
||||
$SELF --keep-literal datadir datafile
|
||||
find . -type f | xargs $SELF
|
||||
find . -exec $SELF '{}' ';'
|
||||
EXAMPLES
|
||||
}
|
||||
|
||||
md5list() {
|
||||
item="$1"
|
||||
if test $OPT_ABSOLUTE -eq 1; then
|
||||
dn=`dirname "$item"` # dirname
|
||||
fn=`basename "$item"` # filename
|
||||
od=`pwd -P` # old dir
|
||||
cd "$dn" || exit 1
|
||||
item=`pwd -P`/"$fn" # absolute physical file path, avoiding all symlinks
|
||||
cd "$od" || exit 1
|
||||
fi
|
||||
if test "$md5_cmd" = "md5sum"
|
||||
then
|
||||
MD5=`md5sum "$item" | awk '{print $1}'`
|
||||
elif test "$md5_cmd" = "md5"
|
||||
then
|
||||
MD5=`md5 -q "$item"`
|
||||
else
|
||||
echo "$0 : No MD5 program found" >&2
|
||||
exit 2
|
||||
fi
|
||||
SIZ=`ls -ld "$item" | awk '{print $5}'`
|
||||
printf '%32s %12s %s\n' "$MD5" "$SIZ" "$item"
|
||||
}
|
||||
|
||||
walkdir() {
|
||||
DR="$1"
|
||||
for item in `find "$DR" -type f`
|
||||
do
|
||||
md5list "$item"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
# main()
|
||||
if test "$1" = "" ; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
--make-absolute|-a)
|
||||
OPT_ABSOLUTE=1;
|
||||
shift;
|
||||
;;
|
||||
--keep-literal|-l)
|
||||
OPT_ABSOLUTE=0;
|
||||
shift;
|
||||
;;
|
||||
--version|-v)
|
||||
printf '%s %s\n' "$SELF" "$VER"
|
||||
exit 0
|
||||
;;
|
||||
--help|-h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
--examples|-e)
|
||||
examples
|
||||
exit 0
|
||||
# *)
|
||||
# usage
|
||||
# exit 1
|
||||
# ;;
|
||||
esac
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
|
||||
if test -d "$i" ; then
|
||||
DR="$i"
|
||||
if test $OPT_ABSOLUTE -eq 1; then
|
||||
od=`pwd -P` # old dir
|
||||
cd "$DR" || exit 1
|
||||
DR=`pwd -P` # absolute physical dir path, avoiding all symlinks
|
||||
cd "$od" || exit 1
|
||||
fi
|
||||
walkdir "$DR"
|
||||
elif test -f "$i" ; then
|
||||
FL="$i"
|
||||
md5list "$FL"
|
||||
else
|
||||
usage
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
30
libisoburn/branches/1.3.2/releng/jigdo-gen-md5-list.1
Normal file
30
libisoburn/branches/1.3.2/releng/jigdo-gen-md5-list.1
Normal file
@ -0,0 +1,30 @@
|
||||
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.38.2.
|
||||
.TH JIGDO-GEN-MD5-LIST "1" "October 2010" "jigdo-gen-md5-list 0.1" "User Commands"
|
||||
.SH NAME
|
||||
jigdo-gen-md5-list \- create a list of MD5sums encoded in hexidecimal format and print to standard output
|
||||
.SH DESCRIPTION
|
||||
usage: jigdo\-gen\-md5\-list [option] DIR FILE ...
|
||||
.TP
|
||||
\fB\-a\fR, \fB\-\-make\-absolute\fR
|
||||
make absolute paths, avoiding any symlinks (default)
|
||||
.TP
|
||||
\fB\-l\fR, \fB\-\-keep\-literal\fR
|
||||
leave paths untouched, literally as supplied
|
||||
.TP
|
||||
\fB\-v\fR, \fB\-\-version\fR
|
||||
print version
|
||||
.TP
|
||||
\fB\-h\fR, \fB\-\-help\fR
|
||||
print help
|
||||
.TP
|
||||
\fB\-e\fR, \fB\-\-examples\fR
|
||||
print examples
|
||||
.SH FORMAT
|
||||
|
||||
File format is described in the beginning of the script itself.
|
||||
|
||||
.SH "SEE ALSO"
|
||||
xorriso(1), jigdo-lite(1), jigit-mkimage(1)
|
||||
|
||||
.SH AUTHOR
|
||||
Written by George Danchev <danchev@spnet.net> and Thomas Schmitt <scdbackup@gmx.net>
|
256
libisoburn/branches/1.3.2/releng/manual_burn
Executable file
256
libisoburn/branches/1.3.2/releng/manual_burn
Executable file
@ -0,0 +1,256 @@
|
||||
#!/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
|
||||
# set -x
|
||||
|
||||
print_specific_help() {
|
||||
cat << HLP
|
||||
Specific options:
|
||||
--dev path use path as drive address. Default: /dev/cdrw
|
||||
--what path use path as address of the directory which shall
|
||||
be copied into an ISO 9660 filesystem on media.
|
||||
--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.
|
||||
HLP
|
||||
}
|
||||
|
||||
wait_for_dev () {
|
||||
# $1 = device address
|
||||
timeout=30
|
||||
counter=0
|
||||
|
||||
while test "$counter" -lt "$timeout"
|
||||
do
|
||||
if test -e "$1"
|
||||
then
|
||||
echo
|
||||
return 0
|
||||
fi
|
||||
if test "$counter" = 0
|
||||
then
|
||||
echo
|
||||
echo "Not existing: $dev"
|
||||
echo "Will wait up to $timeout seconds for it to appear."
|
||||
fi
|
||||
counter=$(expr $counter + 1)
|
||||
echo -n "$counter "
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
return 1
|
||||
}
|
||||
|
||||
getopts_inc=inc/releng_getopts.inc
|
||||
if test -e "$getopts_inc"
|
||||
then
|
||||
. "$getopts_inc"
|
||||
if test "$SPECIFIC_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 29
|
||||
fi
|
||||
|
||||
# Set default values for specific option variables.
|
||||
dev=/dev/cdrw
|
||||
what=../xorriso
|
||||
any_media=0
|
||||
priv_cmd=
|
||||
# Interpret specific options, they begin after the first --.
|
||||
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 "$next_is" = "what"
|
||||
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"
|
||||
elif test "$i" = "--what"
|
||||
then
|
||||
next_is="what"
|
||||
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
|
||||
print_help
|
||||
print_specific_help
|
||||
exit 31
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
check_for_xorriso -x
|
||||
|
||||
|
||||
# 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}
|
||||
printf "\n${SELF}: use '${SELF} -c' to remove.\n"
|
||||
exit 30
|
||||
else
|
||||
mkdir "${GEN_DATA_DIR}"
|
||||
fi
|
||||
|
||||
|
||||
#####################################################################
|
||||
|
||||
# Inspect drive address
|
||||
if test -e "$dev"
|
||||
then
|
||||
if test "$any_media" = 1 -a -f "$dev"
|
||||
then
|
||||
echo "FAIL : ${SELF} : --dev $dev leads to an existing regular file"
|
||||
echo
|
||||
cleanup
|
||||
exit 31
|
||||
fi
|
||||
else
|
||||
if test "$any_media" = "0"
|
||||
then
|
||||
echo "FAIL : ${SELF} : --dev $dev does not lead to an existing file"
|
||||
echo
|
||||
cleanup
|
||||
exit 31
|
||||
fi
|
||||
fi
|
||||
|
||||
# Inspect media
|
||||
set +e
|
||||
wait_for_dev "$dev"
|
||||
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: ${priv_cmd} $RELENG_XORRISO -outdev $dev"
|
||||
echo
|
||||
cleanup
|
||||
exit 1
|
||||
elif echo "$res" | grep '^Media current:' >/dev/null 2>&1
|
||||
then
|
||||
media=$(echo "$res" | grep '^Media current:' | \
|
||||
sed -e 's/^Media current: //')
|
||||
echo "Detected media: '$media'"
|
||||
if test "$media" = "CD-RW" -o "$media" = "DVD-RW sequential recording" -o \
|
||||
"$media" = "DVD-RW restricted overwrite" -o "$media" = "DVD-RAM" -o \
|
||||
"$media" = "DVD+RW" -o "$media" = "BD-RE"
|
||||
then
|
||||
echo "Recognized as re-usable."
|
||||
elif test "$media" = "is not recognizable"
|
||||
then
|
||||
echo "FAIL : ${SELF} : No recognizable media detected in: '$dev'"
|
||||
echo
|
||||
cleanup
|
||||
exit 2
|
||||
elif test "$any_media" = 1
|
||||
then
|
||||
echo "Accepted media only because of option --any_media : '$media'"
|
||||
else
|
||||
echo "FAIL : ${SELF} : No re-usable media detected, but: '$media'"
|
||||
echo
|
||||
cleanup
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Perform burn run
|
||||
echo ${priv_cmd} "$RELENG_XORRISO" -for_backup -outdev "$dev" -blank as_needed -map "$what" /test
|
||||
set +e
|
||||
wait_for_dev "$dev"
|
||||
${priv_cmd} "$RELENG_XORRISO" \
|
||||
-for_backup \
|
||||
-outdev "$dev" \
|
||||
-blank as_needed \
|
||||
-map "$what" /test
|
||||
ret=$?
|
||||
set -e
|
||||
if test "$ret" -ne 0
|
||||
then
|
||||
echo "FAIL : ${SELF} : Non-zero exit value with burn run: $ret"
|
||||
echo
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test "$SIMULATE_FAILURE" = 1
|
||||
then
|
||||
echo "FAIL : ${SELF} : Simulated failure caused by option -f"
|
||||
if test -f "$dev"
|
||||
then
|
||||
# Alter image
|
||||
dd if=/dev/urandom bs=2K count=1 \
|
||||
of="$dev" conv=notrunc seek=400
|
||||
else
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check read
|
||||
echo ${priv_cmd} "$RELENG_XORRISO" -for_backup -indev "$dev" \
|
||||
-check_media event=FATAL -- \ -check_md5_r FATAL / --
|
||||
set +e
|
||||
wait_for_dev "$dev"
|
||||
${priv_cmd} "$RELENG_XORRISO" \
|
||||
-for_backup \
|
||||
-indev "$dev" \
|
||||
-print '---check_media:' -check_media event=FATAL -- \
|
||||
-print '---check_md5_r:' -check_md5_r FATAL / -- \
|
||||
-print '---compare_r:' -md5 off -compare_r "$what" /test
|
||||
ret=$?
|
||||
set -e
|
||||
if test "$ret" -ne 0
|
||||
then
|
||||
echo "FAIL : ${SELF} : Non-zero exit value with checkread run: $ret"
|
||||
echo
|
||||
cleanup
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Ok. Burn test passed."
|
||||
echo
|
||||
cleanup
|
||||
exit 0
|
188
libisoburn/branches/1.3.2/releng/manual_devices
Executable file
188
libisoburn/branches/1.3.2/releng/manual_devices
Executable file
@ -0,0 +1,188 @@
|
||||
#!/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() {
|
||||
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
|
||||
}
|
||||
|
||||
# Include common bits and interpret general options
|
||||
getopts_inc=inc/releng_getopts.inc
|
||||
if test -e "$getopts_inc"
|
||||
then
|
||||
. "$getopts_inc"
|
||||
|
||||
if test "$SPECIFIC_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=
|
||||
priv_cmd=
|
||||
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 "$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
|
||||
print_help
|
||||
print_specific_help
|
||||
exit 31
|
||||
fi
|
||||
done
|
||||
|
||||
# Insist in having a xorriso
|
||||
check_for_xorriso -x
|
||||
|
||||
has_device_links=$("$RELENG_XORRISO" -help 2>/dev/null | fgrep ' -device_links')
|
||||
if test -n "$has_device_links"
|
||||
then
|
||||
devices_opt="-device_links"
|
||||
else
|
||||
devices_opt="-devices"
|
||||
fi
|
||||
|
||||
#
|
||||
get_speeds() {
|
||||
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 \
|
||||
-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 or -device_links
|
||||
# $2 = if not empty: suppress dialog and use $2 as input
|
||||
|
||||
if test -n "$1"
|
||||
then
|
||||
DEVICES="$1"
|
||||
else
|
||||
DEVICES=$( ${priv_cmd} "$RELENG_XORRISO" $devices_opt 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_opt ..."
|
||||
devices=$( ${priv_cmd} "$RELENG_XORRISO" -report_about WARNING $devices_opt | 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 :
|
||||
else
|
||||
echo "FAIL : ${SELF} : Device scan or single drive listing failed"
|
||||
exit "$RET"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
boldify
|
||||
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
|
288
libisoburn/branches/1.3.2/releng/manual_isojigdo
Executable file
288
libisoburn/branches/1.3.2/releng/manual_isojigdo
Executable file
@ -0,0 +1,288 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net>
|
||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
||||
# Licensed under GNU GPL version 2 or later
|
||||
|
||||
set -e
|
||||
|
||||
not_in_releng_exit() {
|
||||
printf "\nPlease execute the tests from releng directory.\n\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
. inc/releng_getopts.inc || not_in_releng_exit
|
||||
|
||||
print_specific_help() {
|
||||
cat << HLP
|
||||
Specific options:
|
||||
none yet.
|
||||
Overview:
|
||||
Match the resulting ISO image representation
|
||||
against the jigdo representation.
|
||||
HLP
|
||||
}
|
||||
|
||||
if test "$SPECIFIC_HELP" = 1; then
|
||||
print_specific_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ ! -x $RELENG_XORRISO ]; then
|
||||
print_help
|
||||
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n"
|
||||
exit 30
|
||||
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}
|
||||
printf "\n${SELF}: use './${SELF} -c' to remove.\n"
|
||||
exit 1
|
||||
else
|
||||
mkdir "${GEN_DATA_DIR}"
|
||||
fi
|
||||
|
||||
TMP_DATA_DIR=releng_generated_data
|
||||
IMG_EXTRACT_DIR=${GEN_DATA_DIR}/${SELF}_extracted_tree
|
||||
RELENG_DIR="${IMG_EXTRACT_DIR}"
|
||||
RELENG_ISOLINUX_BIN="isolinux/isolinux.bin"
|
||||
RELENG_BOOT_CAT="isolinux/boot.cat"
|
||||
RELENG_IMG=t1
|
||||
RES=""
|
||||
REMOTE_URL="http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/i386/iso-cd"
|
||||
REMOTE_IMG="debian-testing-i386-netinst.iso"
|
||||
|
||||
# check for required items
|
||||
if [ "${RELENG_XORRISO}" = "" -o "${RELENG_DIR}" = "" -o "${RELENG_IMG}" = "" ]; then
|
||||
echo -e "\n${SELF}: xorriso_cmd IN_dir and OUT_image are required\n"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# All must be set at this point
|
||||
printf "${SELF}: Config items:"
|
||||
printf "\n\txorriso_cmd=${RELENG_XORRISO}\n\tIN_dir=${RELENG_DIR}\n\tOUT_image=${RELENG_IMG}.iso"
|
||||
printf "\n\tIN_isolinux=${RELENG_ISOLINUX_BIN}\n\tOUT_bootcat=${RELENG_BOOT_CAT}\n"
|
||||
RES="${RELENG_IMG}.iso ${RELENG_IMG}.new ${RELENG_IMG}.md5 ${RELENG_IMG}.jigdo ${RELENG_IMG}.template"
|
||||
|
||||
# xorriso version details, incl. underlying libraries
|
||||
# "${RELENG_XORRISO}" -version
|
||||
|
||||
# check whether the binary support JTE
|
||||
set +e
|
||||
RETSTR_VER_JTE=`"${RELENG_XORRISO}" --version 2>/dev/null | grep "libjte * in use"`
|
||||
RETCODE_VER_JTE="$?"
|
||||
set -e
|
||||
case ${RETCODE_VER_JTE} in
|
||||
0)
|
||||
printf "\n${SELF}: Found JTE support with ${RELENG_XORRISO} : ${RETSTR_VER_JTE}"
|
||||
;;
|
||||
*)
|
||||
printf "\nFAIL : ${SELF} : Not found JTE support in ${RELENG_XORRISO}. Quit."
|
||||
printf "\n${SELF}: JTE not supported with this xorriso build. Install jigit >=1.18 and rebuild."
|
||||
printf "\n${SELF}: http://www.einval.com/~steve/software/JTE/\n"
|
||||
cleanup
|
||||
exit 4
|
||||
;;
|
||||
esac
|
||||
|
||||
# grab remote ISO image, to decompose
|
||||
if [ ! -f "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then
|
||||
printf "\n${SELF}: Downloading ${REMOTE_URL}/${REMOTE_IMG}\n"
|
||||
if wget -V >/dev/null 2>&1
|
||||
then
|
||||
set +e
|
||||
wget --no-check-certificate -T20 -t3 \
|
||||
-O "${TMP_DATA_DIR}"/"${REMOTE_IMG}" "${REMOTE_URL}"/"${REMOTE_IMG}"
|
||||
WGET_RET="$?"
|
||||
set -e
|
||||
elif fetch -T 20 -o "${TMP_DATA_DIR}"/"${REMOTE_IMG}" \
|
||||
"${REMOTE_URL}"/"${REMOTE_IMG}"
|
||||
then
|
||||
WGET_RET=0
|
||||
else
|
||||
echo
|
||||
echo "FAIL: ${SELF} : Neither wget nor fetch are present and willing to work"
|
||||
cleanup
|
||||
exit 10
|
||||
fi
|
||||
case ${WGET_RET} in
|
||||
0)
|
||||
echo -e "\n${SELF}: Downloading successfully completed.\n"
|
||||
;;
|
||||
*)
|
||||
echo -e "\nFAIL : ${SELF} : wget returned code: $WGET_RET\n"
|
||||
rm "${TMP_DATA_DIR}"/"${REMOTE_IMG}"
|
||||
cleanup
|
||||
exit 5
|
||||
;;
|
||||
esac
|
||||
else
|
||||
printf "\n${SELF}: Found ISO image: ${TMP_DATA_DIR}/${REMOTE_IMG}\n"
|
||||
fi
|
||||
|
||||
# check for extraction directory existence
|
||||
if [ -d "${IMG_EXTRACT_DIR}" ]; then
|
||||
printf "\n${SELF}: Found ${IMG_EXTRACT_DIR}. Please cleanup.\n"
|
||||
cleanup
|
||||
exit 6
|
||||
else
|
||||
mkdir "${IMG_EXTRACT_DIR}"
|
||||
fi
|
||||
|
||||
# extract image content
|
||||
CMD_EXTRACT="${RELENG_XORRISO} -indev ${TMP_DATA_DIR}/${REMOTE_IMG} \
|
||||
-osirrox on:auto_chmod_on \
|
||||
-extract / ${IMG_EXTRACT_DIR} \
|
||||
"
|
||||
|
||||
# TODO: drop set +e|-e block, catch exit code instead when
|
||||
# the boot catalog warnings get completely resolved.
|
||||
echo -e "${SELF}: Extracting ISO image:\n${CMD_EXTRACT}\n"
|
||||
set +e
|
||||
${CMD_EXTRACT}
|
||||
set -e
|
||||
|
||||
# grab an MBR
|
||||
ISOHYBRID_MBR="${GEN_DATA_DIR}/isohybrid.mbr"
|
||||
dd if="${TMP_DATA_DIR}/${REMOTE_IMG}" bs=1K count=32 of="${ISOHYBRID_MBR}"
|
||||
|
||||
# create FAT partition
|
||||
APPEND_PART="${GEN_DATA_DIR}/fatpart.fat"
|
||||
MKFS_MSDOS="/sbin/mkfs.msdos"
|
||||
if [ -x "${MKFS_MSDOS}" ]; then
|
||||
"${MKFS_MSDOS}" -n Bla -C "${APPEND_PART}" 8192
|
||||
APPEND_PART_CMD="-append_partition 2 0x01 ${APPEND_PART}"
|
||||
else
|
||||
APPEND_PART_CMD=
|
||||
|
||||
# printf "\nFAIL : ${SELF} : Not found: ${MKFS_MSDOS}"
|
||||
# printf "\n${SELF}: Not found: "${MKFS_MSDOS}". Install dosfstools."
|
||||
# printf "\n${SELF}: http://www.daniel-baumann.ch/software/dosfstools/\n"
|
||||
# cleanup
|
||||
# exit 7
|
||||
fi
|
||||
|
||||
# GENERAL section
|
||||
CMD="${RELENG_XORRISO} \
|
||||
-as mkisofs \
|
||||
-quiet \
|
||||
-o ${GEN_DATA_DIR}/${RELENG_IMG}.iso \
|
||||
-R \
|
||||
-V ISOJIGDO \
|
||||
-partition_offset 16 \
|
||||
-J -joliet-long \
|
||||
"
|
||||
|
||||
# BOOT section
|
||||
if [ -f "${IMG_EXTRACT_DIR}"/"${RELENG_ISOLINUX_BIN}" -a -f "${ISOHYBRID_MBR}" ]
|
||||
then
|
||||
CMD="$CMD \
|
||||
-b ${RELENG_ISOLINUX_BIN} \
|
||||
-c ${RELENG_BOOT_CAT} \
|
||||
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
||||
-isohybrid-mbr ${ISOHYBRID_MBR} \
|
||||
-partition_offset 16 \
|
||||
"
|
||||
else
|
||||
printf "\n${SELF}: FAIL to compose the boot section.\n"
|
||||
cleanup
|
||||
exit 8
|
||||
fi
|
||||
if [ -n "${APPEND_PART_CMD}" -a -f "${APPEND_PART}" ]; then
|
||||
CMD="$CMD \
|
||||
${APPEND_PART_CMD}
|
||||
"
|
||||
fi
|
||||
|
||||
# JIGDO section
|
||||
JIGDO_JIGDO=${GEN_DATA_DIR}/${RELENG_IMG}.jigdo
|
||||
JIGDO_TEMPLATE=${GEN_DATA_DIR}/${RELENG_IMG}.template
|
||||
|
||||
JIGDO_MAP_RHV=$(cd ${RELENG_DIR} 2>/dev/null && pwd)
|
||||
|
||||
JIGDO_MAP="Debian=${JIGDO_MAP_RHV}/"
|
||||
|
||||
# create jigdo MD5 list in base64 format
|
||||
JIGDO_GEN_MD5=${GEN_DATA_DIR}/${RELENG_IMG}.md5
|
||||
|
||||
printf "${SELF}: Creating MD5 list in hex format in ${JIGDO_GEN_MD5}..."
|
||||
set +e
|
||||
./jigdo-gen-md5-list ${RELENG_DIR} > ${JIGDO_GEN_MD5}
|
||||
ret=$?
|
||||
set -e
|
||||
|
||||
if test "$ret" = 0
|
||||
then
|
||||
printf "Done.\n"
|
||||
else
|
||||
printf "\nFAIL : ${SELF}: ./jigdo-gen-md5-list returns $ret"
|
||||
cleanup
|
||||
exit 9
|
||||
fi
|
||||
|
||||
|
||||
CMD="$CMD \
|
||||
-jigdo-template-compress gzip \
|
||||
-checksum_algorithm_iso md5,sha1,sha256,sha512 \
|
||||
-checksum_algorithm_template md5,sha1,sha256,sha512 \
|
||||
-jigdo-jigdo ${JIGDO_JIGDO} \
|
||||
-jigdo-template ${JIGDO_TEMPLATE} \
|
||||
-jigdo-map ${JIGDO_MAP} \
|
||||
-md5-list ${JIGDO_GEN_MD5} \
|
||||
-jigdo-min-file-size 1024 \
|
||||
"
|
||||
|
||||
CMD="$CMD ${RELENG_DIR}"
|
||||
|
||||
# Run the whole compound command
|
||||
echo -e "${SELF}: Creating ISO and jigdo representations:\n$CMD\n"
|
||||
${CMD}
|
||||
|
||||
# Create another imange this time from jigdo files
|
||||
if which jigit-mkimage >/dev/null 2>&1; then
|
||||
printf "${SELF}: Creating new ISO from jigdo files..."
|
||||
jigit-mkimage \
|
||||
-t ${JIGDO_TEMPLATE} \
|
||||
-j ${JIGDO_JIGDO} \
|
||||
-m ${JIGDO_MAP} \
|
||||
-o ${GEN_DATA_DIR}/${RELENG_IMG}.new
|
||||
printf "Done.\n"
|
||||
else
|
||||
printf "\n${SELF}: Not found: jigit-mkimage. Install jigit."
|
||||
printf "\n${SELF}: http://www.einval.com/~steve/software/JTE/\n"
|
||||
cleanup
|
||||
exit 10
|
||||
fi
|
||||
|
||||
# trap the exit code of diff and let the Universe explode
|
||||
diff ${GEN_DATA_DIR}/${RELENG_IMG}.iso ${GEN_DATA_DIR}/${RELENG_IMG}.new
|
||||
DIFF_RET="$?"
|
||||
case ${DIFF_RET} in
|
||||
0)
|
||||
echo -e "${SELF}: Match: diff ${GEN_DATA_DIR}/${RELENG_IMG}.iso ${GEN_DATA_DIR}/${RELENG_IMG}.new"
|
||||
;;
|
||||
*)
|
||||
echo -e "FAIL : ${SELF} : diff returned code: $DIFF_RET\n"
|
||||
;;
|
||||
esac
|
||||
|
||||
# sort out the cruft
|
||||
cleanup
|
||||
|
||||
# warn about downloaded image left behind
|
||||
if [ -f "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then
|
||||
printf "${SELF}: Leaving "
|
||||
ls -sh "${TMP_DATA_DIR}"/"${REMOTE_IMG}"
|
||||
fi
|
||||
|
||||
# last hints
|
||||
if [ -d ${GEN_DATA_DIR} ]; then
|
||||
printf "\n${SELF}: HINT: manual checks remained to be done:\n"
|
||||
printf " * ${GEN_DATA_DIR}/${RELENG_IMG}.iso boots from USB stick and/or optical media.\n"
|
||||
printf " * appended FAT partition is mountable.\n"
|
||||
printf " * xorriso -indev ${GEN_DATA_DIR}/${RELENG_IMG}.iso -pvd_info\n"
|
||||
printf " * fdisk -lu ${GEN_DATA_DIR}/${RELENG_IMG}.iso\n"
|
||||
fi
|
||||
|
||||
exit 0
|
254
libisoburn/branches/1.3.2/releng/run_all_auto
Executable file
254
libisoburn/branches/1.3.2/releng/run_all_auto
Executable file
@ -0,0 +1,254 @@
|
||||
#!/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
|
||||
|
||||
export RELENG_SCRIPT_RUN_BY_RUN_ALL_AUTO=1
|
||||
|
||||
SELF=$(basename "$0")
|
||||
GEN_DATA_DIR=releng_generated_data
|
||||
CLOG=${GEN_DATA_DIR}/log.${SELF}
|
||||
CLOG_PREV=${CLOG}.prev
|
||||
PASSED_OPTIONS="$@"
|
||||
RELENG_XORRISO=
|
||||
CLEANUP_LOG=0
|
||||
|
||||
# It is not a good idea to include inc/releng_getopts.inc with the
|
||||
# master script as it calls the subordinate scripts and they include
|
||||
# this file too, and we want to avoid sharing variable with subshells
|
||||
if [ ! -f inc/releng_getopts.inc ]; then
|
||||
printf "\nPlease execute the tests from releng directory.\n\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# To catch the exit value of a command in a pipe
|
||||
return_value_file="$GEN_DATA_DIR"/run_all_"$$"_return_value
|
||||
return_wrapper()
|
||||
{
|
||||
cmd="$1"
|
||||
shift 1
|
||||
"$cmd" "$@"
|
||||
RET="$?"
|
||||
echo "$RET" >"$return_value_file"
|
||||
return "$RET"
|
||||
}
|
||||
|
||||
# Using only bash builtin commands.
|
||||
# On 4 year old amd64 x2 3000 MHz, xterm local,it counts 22471 lines per second
|
||||
# On 2 year old amd64 x4 2600 MHz, ssh remote, it counts 35348 lines per second
|
||||
count_lines()
|
||||
{
|
||||
# $1 if not empty: start count
|
||||
line=
|
||||
if test -n "$1"
|
||||
then
|
||||
count="$1"
|
||||
else
|
||||
count=0
|
||||
fi
|
||||
while read line
|
||||
do
|
||||
count=$(($count + 1))
|
||||
printf "\r %4d lines logged ... " "$count" >&2
|
||||
printf "%s\n" "$line"
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
#############################################
|
||||
print_usage()
|
||||
{
|
||||
cat << HLP
|
||||
|
||||
${SELF} runs executables from releng directory starting with auto_*,
|
||||
and passing them its own options. stdout/stderr output is stored in:
|
||||
./${CLOG} (last run) and
|
||||
./${CLOG_PREV} (previous run)
|
||||
|
||||
Usage: ${SELF} -x path/to/xorriso [-k] [-c] [-h]
|
||||
-x absolute or relative path to xorriso binary to be run.
|
||||
-k keep self-generated data in ./${GEN_DATA_DIR}.
|
||||
-c cleanup self-generated data kept from previous run and exit.
|
||||
-h print this help text
|
||||
|
||||
Examples:
|
||||
# run xorriso and keep the self-generated data
|
||||
$ ./${SELF} -x path/to/xorriso -k
|
||||
|
||||
# clean up self-generated data from previous run
|
||||
$ ./${SELF} -c
|
||||
|
||||
HLP
|
||||
}
|
||||
|
||||
#############################################
|
||||
if [ ! "${1}" ]; then
|
||||
print_usage
|
||||
exit 0
|
||||
fi
|
||||
next_is=
|
||||
for i in "$@"
|
||||
do
|
||||
if test x"$i" = x"-h" -o x"$i" = x"--h" -o x"$i" = x"-help" -o x"$i" = x"--help"
|
||||
then :
|
||||
print_usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test "$next_is" = "ignore"
|
||||
then :
|
||||
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"-c"
|
||||
then
|
||||
CLEANUP_LOG=1
|
||||
fi
|
||||
done
|
||||
#############################################
|
||||
if test "$next_is" = x
|
||||
then
|
||||
echo
|
||||
echo "Option -x expects an argument (the path to the xorriso program)"
|
||||
exit 31
|
||||
fi
|
||||
|
||||
|
||||
########################################################
|
||||
if [ -f "${CLOG}" ]; then
|
||||
mv "${CLOG}" "${CLOG_PREV}"
|
||||
fi
|
||||
> ${CLOG}
|
||||
if [ -x "${RELENG_XORRISO}" ]; then
|
||||
echo "_OVERVIEW_______________________________________________________________" >> ${CLOG}
|
||||
date -u >> ${CLOG}
|
||||
${RELENG_XORRISO} --version >> ${CLOG}
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> ${CLOG}
|
||||
fi
|
||||
DSTART=`date -u`
|
||||
echo "${SELF}: Started at ${DSTART}" | tee -a ${CLOG}
|
||||
E1=`date '+%s'`
|
||||
exit_value=0
|
||||
# require ^auto_, avoid running (your)self explicitly
|
||||
for s in `ls | grep ^auto_ | grep -v ${SELF} | sort -n`; do
|
||||
if [ -x ${s} -a ! -d ${s} ]; then
|
||||
echo >> ${CLOG}
|
||||
echo >> ${CLOG}
|
||||
echo "_STARTING_TEST_________________________________________________________" >> ${CLOG}
|
||||
echo "${SELF}: Running ./${s} ${PASSED_OPTIONS} :" \
|
||||
| tee -a ${CLOG}
|
||||
T1=`date '+%s'`
|
||||
set +e
|
||||
|
||||
if test -n "$PIPESTATUS"
|
||||
then
|
||||
# PIPESTATUS[0] should be available in bash
|
||||
./${s} ${PASSED_OPTIONS} 2>&1 | count_lines >> ${CLOG}
|
||||
RET="${PIPESTATUS[0]}"
|
||||
else
|
||||
# a more portable method which uses a temporary file to record exit value
|
||||
return_wrapper ./${s} ${PASSED_OPTIONS} 2>&1 | count_lines >> ${CLOG}
|
||||
RET=$(cat "$return_value_file")
|
||||
rm "$return_value_file"
|
||||
fi
|
||||
# echo "RET='$RET'" >/dev/tty
|
||||
|
||||
T2=`date '+%s'`
|
||||
TS=`expr ${T2} - ${T1}`
|
||||
case ${RET} in
|
||||
0)
|
||||
echo "done in ${TS} sec. ok."
|
||||
;;
|
||||
*)
|
||||
exit_value=2
|
||||
printf "done in ${TS} sec. "
|
||||
which tput >/dev/null 2>&1 && tput smso
|
||||
printf "FAIL -> EXIT CODE $RET"
|
||||
which tput >/dev/null 2>&1 && tput rmso
|
||||
echo
|
||||
;;
|
||||
esac
|
||||
set -e
|
||||
fi
|
||||
done
|
||||
|
||||
DEND=`date -u`
|
||||
echo | tee -a ${CLOG}
|
||||
echo -n "${SELF}: Stopped at ${DEND}." | tee -a ${CLOG}
|
||||
if [ "${CLEANUP_LOG}" -eq 1 ]; then
|
||||
if [ -f "${CLOG}" ]; then
|
||||
rm -f "${CLOG}"
|
||||
echo # | tee -a ${CLOG}
|
||||
echo -n "${SELF}: Removed my own log ${CLOG}." # | tee -a ${CLOG}
|
||||
fi
|
||||
if [ -f "${CLOG_PREV}" ]; then
|
||||
rm -f "${CLOG_PREV}"
|
||||
echo # | tee -a ${CLOG}
|
||||
echo "${SELF}: Removed my own log ${CLOG_PREV}." # | tee -a ${CLOG}
|
||||
fi
|
||||
else
|
||||
E2=`date '+%s'`
|
||||
if [ ${E2} -eq ${E1} ]; then
|
||||
echo " Total elapsed 0 sec." | tee -a ${CLOG}
|
||||
else
|
||||
ES=`expr ${E2} - ${E1}`
|
||||
echo " Total elapsed ${ES} sec." | tee -a ${CLOG}
|
||||
fi
|
||||
#####
|
||||
echo >> ${CLOG}
|
||||
echo "_SUMMARY________________________________________________________________" >> ${CLOG}
|
||||
echo "${SELF}: Trivial log examination: ${CLOG}" | tee -a ${CLOG}
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | tee -a ${CLOG}
|
||||
# severity classes of libdax_msgs.h in libburn and libisofs
|
||||
# List of boring keywords:
|
||||
# 'UPDATE|NOTE|DEBUG|ALL' - not considered interesting for lazy log inspection.
|
||||
# List of interesting keywords:
|
||||
# thrown by xorriso and underlying libraries
|
||||
LIST_KWD="NEVER|ABORT|FATAL|FAILURE|MISHAP|SORRY|WARNING|HINT"
|
||||
# thrown by others
|
||||
LIST_KWD="${LIST_KWD}|FAIL|ERROR|WRONG"
|
||||
|
||||
if [ -f "${CLOG}" ]; then
|
||||
set +e
|
||||
# lines, perl regex, leading tabs
|
||||
grep -n -E "${LIST_KWD}" "${CLOG}"
|
||||
RET_GREP="$?"
|
||||
case ${RET_GREP} in
|
||||
0) # found
|
||||
;;
|
||||
1) # not found
|
||||
echo "${SELF}: Log file looks clear." # | tee -a ${CLOG}
|
||||
;;
|
||||
*) #
|
||||
echo "${SELF}: grep returned EXIT CODE: ${RET_GREP}." # | tee -a ${CLOG}
|
||||
;;
|
||||
esac
|
||||
set -e
|
||||
fi
|
||||
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | tee -a ${CLOG}
|
||||
|
||||
##### TODO: work out a less noisy diff'ing technique!
|
||||
if [ -f "${CLOG_PREV}" -a -f "${CLOG}" ]; then
|
||||
echo "${SELF}: See diff against previous log file (might be long):" | tee -a ${CLOG}
|
||||
echo "diff -Naur ${CLOG_PREV} ${CLOG} | less" | tee -a ${CLOG}
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
#
|
||||
which tput >/dev/null 2>&1 && tput smso
|
||||
echo # | tee -a ${CLOG}
|
||||
echo "${SELF}: Leaving the following cruft in ${GEN_DATA_DIR}:" # | tee -a ${CLOG}
|
||||
which tput >/dev/null 2>&1 && tput rmso
|
||||
ls -lth "${GEN_DATA_DIR}" # | tee -a ${CLOG}
|
||||
|
||||
# Fin
|
||||
exit $exit_value
|
||||
|
135
libisoburn/branches/1.3.2/releng/template_new
Executable file
135
libisoburn/branches/1.3.2/releng/template_new
Executable file
@ -0,0 +1,135 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
||||
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net>
|
||||
# === TEMPLATE: Add your own copyright here
|
||||
#
|
||||
# Licensed under GNU GPL version 2 or later
|
||||
|
||||
# === TEMPLATE: Remove this remark before releasing this script.
|
||||
#
|
||||
# This is a template for creating a new libisoburn/releng test.
|
||||
# It is supposed that you have read releng/README before you begin to work
|
||||
# here.
|
||||
#
|
||||
# Step 1: Invent a name for your test
|
||||
# test_name="manual_"...some.name...
|
||||
# or
|
||||
# test_name="auto_"...some.name...
|
||||
#
|
||||
# Step 2: Copy releng/template_new to $test_name
|
||||
#
|
||||
# Step 3: Edit $test_name and process any line that begins by
|
||||
# "# === TEMPLATE:". Do what the line prescribes and then remove it
|
||||
# from the script. You are not done as long as such a line remains.
|
||||
#
|
||||
# === TEMPLATE: End of remark to remove
|
||||
|
||||
set -e
|
||||
|
||||
|
||||
# === TEMPLATE: Describe your own specific options (if any) and the test
|
||||
print_specific_help() {
|
||||
cat << HLP
|
||||
Specific options:
|
||||
--option Explanation of specific option
|
||||
Overview:
|
||||
Short explanation of test purpose and activities.
|
||||
HLP
|
||||
}
|
||||
|
||||
|
||||
getopts_inc=inc/releng_getopts.inc
|
||||
if test -e "$getopts_inc"
|
||||
then
|
||||
. "$getopts_inc"
|
||||
|
||||
if test "$SPECIFIC_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 29
|
||||
fi
|
||||
|
||||
|
||||
# === TEMPLATE: Decide whether the test will have own options,
|
||||
# === TEMPLATE: apart from those interpreted by inc/releng_getopts.inc
|
||||
# === TEMPLATE: If not, then remove this interpreter code.
|
||||
# Set default values for specific option variables. E.g.:
|
||||
# dev=
|
||||
# Interpret specific options, they begin after the first --.
|
||||
next_is=ignore
|
||||
for i in "$@"
|
||||
do
|
||||
if test "$next_is" = "ignore"
|
||||
then
|
||||
if test "$i" = "--"
|
||||
then
|
||||
next_is=""
|
||||
fi
|
||||
|
||||
# === TEMPLATE: Implement interpretation of specific options. Like:
|
||||
# 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
|
||||
# === TEMPLATE: End of own option interpreter code.
|
||||
|
||||
|
||||
# Each test should decide whether or not it needs
|
||||
# a xorriso binary to test, since some do compilations only.
|
||||
# === TEMPLATE: Decide whether you need a xorriso program.
|
||||
# === TEMPLATE: If not, then remove this function call
|
||||
check_for_xorriso -x
|
||||
|
||||
|
||||
# check data dir, if any and after checking -x xorriso
|
||||
# === TEMPLATE: Decide whether your test will possibly create own files.
|
||||
# === TEMPLATE: If yes, then create your files underneath ${GEN_DATA_DIR}.
|
||||
# === TEMPLATE: The name in this variable is set by inc/releng_getopts.inc .
|
||||
# === TEMPLATE: If not, then remove this if ... fi statement.
|
||||
if [ -d "${GEN_DATA_DIR}" ]; then
|
||||
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
|
||||
printf "\n${SELF}: use '${SELF} -c' to remove.\n"
|
||||
exit 30
|
||||
else
|
||||
mkdir "${GEN_DATA_DIR}"
|
||||
fi
|
||||
|
||||
|
||||
#####################################################################
|
||||
|
||||
|
||||
# === TEMPLATE: Perform your test activities here.
|
||||
|
||||
|
||||
# === TEMPLATE: In case of failure, issue a line to stdout that begins by
|
||||
# === TEMPLATE: the word "FAIL", and make sure that the test script finally
|
||||
# === TEMPLATE: returns a non-zero exit value.
|
||||
# === TEMPLATE: 31 = Unknown option or unusable argument with known option
|
||||
# === TEMPLATE: 30 = Unexpected state of own directory for self generated files
|
||||
# === TEMPLATE: 29 = Not in ./releng directory or missing essential parts
|
||||
# === TEMPLATE: 1 to 28 = test specific exit values
|
||||
# === TEMPLATE: When exiting prematurely, make sure to call cleanup.
|
||||
|
||||
cleanup
|
||||
exit 0
|
Reference in New Issue
Block a user