Branching for libisoburn release 1.1.4
This commit is contained in:
32
libisoburn/branches/1.1.4/releng/CHECKLIST
Normal file
32
libisoburn/branches/1.1.4/releng/CHECKLIST
Normal file
@@ -0,0 +1,32 @@
|
||||
Release Engineering Check List
|
||||
==============================
|
||||
|
||||
Automated and semi-automated tests
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
TEST: all auto_* tests are to be run by ./run_all_auto
|
||||
FILE: http://people.debian.org/~danchev/libburnia/logs/releng/
|
||||
|
||||
TEST: all manual_* tests are to be run individually and manually.
|
||||
|
||||
TEST: cppcheck
|
||||
FILE: http://people.debian.org/~danchev/libburnia/logs/cppcheck/
|
||||
|
||||
TEST: medistimator (dialog mode, size estimation, processing large trees)
|
||||
requires some specific knowledge of how the tool works, to interpret
|
||||
the results and compare them previous runs (see comments in the source).
|
||||
FILE: http://anonscm.debian.org/gitweb/?p=users/danchev/medistimator.git;a=summary
|
||||
FILE: http://people.debian.org/~danchev/libburnia/logs/medistimator/
|
||||
|
||||
Non-automated tests
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
TEST: valgrind
|
||||
FILE:
|
||||
|
||||
TEST: buildd_logs
|
||||
FILE: http://buildd.debian.org (others are also welcome)
|
||||
FILE: (err/warn from prev. builds for several h/w architectures and kernels: linux, kfreebsd, hurd)
|
||||
|
||||
TEST: gprof
|
||||
FILE: CFLAGS=-pg ./configure && make
|
||||
FILE: run resulting executable; gmon.out to be created in current cirectory
|
||||
FILE: gprof path/to/xorriso gmon.out > gprof.out
|
260
libisoburn/branches/1.1.4/releng/README
Normal file
260
libisoburn/branches/1.1.4/releng/README
Normal file
@@ -0,0 +1,260 @@
|
||||
------------------------------------------------------------------------------
|
||||
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 George Danchev, Thomas Schmitt
|
||||
Provided under GPL version 2 or later.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
The impatient tester will build libisoburn according to ./README and then do
|
||||
cd ./releng
|
||||
./run_all_auto -x ../xorriso/xorriso
|
||||
|
||||
More patient testers will first read the following description.
|
||||
|
||||
|
||||
The test suite
|
||||
|
||||
+++ introduce 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.
|
||||
|
||||
|
||||
+++ inform about resource needs,
|
||||
|
||||
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.
|
||||
|
||||
|
||||
+++ auto and manual tests
|
||||
|
||||
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_* get 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.
|
||||
|
||||
|
||||
+++ tell how to run the tests,
|
||||
|
||||
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 $(type -p xorriso)
|
||||
|
||||
|
||||
+++ General options -x , -k, -f, -c, -h, --
|
||||
+++ + All scripts support -h
|
||||
|
||||
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
|
||||
|
||||
+++ list of manual tests
|
||||
|
||||
Currently there are the following tests which should have the attention of
|
||||
the user or require sysadmin considerations before they are run:
|
||||
|
||||
./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 70 MB,
|
||||
extracts its content and composes a new image.
|
||||
Thus it needs about 250 MB of disk space in releng/releng_generated_data .
|
||||
This test will only work with GNU xorriso or if libjte was installed already
|
||||
when libisofs was built. libjte is part of package jigit, version >= 1.18,
|
||||
available at:
|
||||
http://www.einval.com/~steve/software/JTE/
|
||||
|
||||
./manual_devices -x ../xorriso/xorriso [-- [--dev device_file_to_use]]
|
||||
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.
|
||||
|
||||
./manual_burn -x ../xorriso/xorriso [-- [--dev device_file_to_use]
|
||||
[--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.
|
||||
|
||||
|
||||
>>> ./run_all_manual
|
||||
|
||||
>>> + Any auto_* script can be run on its own, regardless.
|
||||
>>> List auto tests
|
||||
|
||||
|
||||
+++ give hints 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 perticular tests and report
|
||||
lines from the log file which contain problem indicating key words:
|
||||
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 .
|
||||
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Creating a new test script
|
||||
|
||||
+++ * DELIVERING A NEW TEST SCRIPT
|
||||
+++ + Start a new test script over the top of template_new_releng
|
||||
+++ + Each completed script starts with auto_ or manual_ prefix
|
||||
|
||||
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.
|
||||
|
||||
+++ + Each script' self-generated data are to be stored in
|
||||
+++ ./releng_generated_data/scriptname/ directory
|
||||
|
||||
Your test must not start if no file
|
||||
./inc/releng_getopts.inc
|
||||
exists, i.e. if the current working direcoty 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).
|
||||
|
||||
+++ + Throw FAIL string to stdout if any failure is detected
|
||||
+++ + Return exit code 0 on success, non-zero on failure
|
||||
+++ + Use different exit codes for any failure (range 0-31)
|
||||
|
||||
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.
|
||||
|
||||
|
||||
General options, variables, and functions
|
||||
|
||||
+++ inc/releng_getopts.inc variables, functions, initializations
|
||||
|
||||
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 follwoing functions
|
||||
for use by the single tests:
|
||||
|
||||
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
|
||||
|
||||
+++ + Keep the newly added script options in sync with other scripts
|
||||
|
||||
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.
|
||||
|
||||
|
||||
=============================================================================
|
||||
TODO:
|
||||
|
||||
|
||||
* Delete debian-testing-i386-businesscard.iso with ./run_all_auto -c
|
||||
|
||||
* Have a script ./run_all_manual
|
||||
|
||||
* derive a GNU xorriso test suite from libisoburn test suite
|
||||
|
||||
* auto_ tests should know whether they work underneath run_all_auto
|
||||
or whether they run standalone
|
||||
|
28
libisoburn/branches/1.1.4/releng/README.old
Normal file
28
libisoburn/branches/1.1.4/releng/README.old
Normal file
@@ -0,0 +1,28 @@
|
||||
Release Engineering
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
* SOFTWARE TO TEST
|
||||
+ Use latest libburnia libraries code base from svn and bzr
|
||||
(see top-level README for aditional library dependencies)
|
||||
+ Alternatively, use latest all-in-one development tarball from:
|
||||
http://www.gnu.org/software/xorriso/
|
||||
|
||||
* SETUP THE TEST ENVIRONMENT AND RUN THE TEST SUITE
|
||||
+ All tests have to be run from the releng/ directory, within
|
||||
libisoburn source tree. Self-generated data are stored in
|
||||
./releng_generated_data/ directory, and the required space for
|
||||
these data is about 300 megabytes. There is a 'master' script
|
||||
called run_all_auto, which runs all scripts prefixed with auto_*.
|
||||
+ Any auto_* script can be run on its own, regardless.
|
||||
+ Any manual_* script is to be run on its own, only.
|
||||
+ All scripts support -h, -help, --help and
|
||||
print usage help when run without options.
|
||||
|
||||
* DELIVERING A NEW TEST SCRIPT
|
||||
+ Start a new test script over the top of template_new_releng
|
||||
+ Each completed script starts with auto_ or manual_ prefix
|
||||
+ Each script' self-generated data are to be stored in
|
||||
./releng_generated_data/scriptname/ directory
|
||||
+ Keep the newly added script options in sync with other scripts
|
||||
+ Throw FAIL string to stdout if any failure is detected
|
||||
+ Return exit code 0 on success, non-zero on failure
|
||||
+ Use different exit codes for any failure (range 0-31)
|
27
libisoburn/branches/1.1.4/releng/TODO
Normal file
27
libisoburn/branches/1.1.4/releng/TODO
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
* 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. ACLs and xattr (if we are on Linux).
|
||||
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.
|
||||
|
||||
* Burning tests - maybe a new 'manual_burning' test?
|
||||
Further if we want to have a burn test (with MD5 and checkreading)
|
||||
then we will need configuration means to enable this. By default
|
||||
it should not risk to burn one-time media which sit in the drive
|
||||
by mere accident.
|
||||
|
||||
* 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.
|
88
libisoburn/branches/1.1.4/releng/auto_cxx
Executable file
88
libisoburn/branches/1.1.4/releng/auto_cxx
Executable file
@@ -0,0 +1,88 @@
|
||||
#!/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
|
||||
# if test -f "${SAMPLE_CODE_DIR}"/*.cpp; then
|
||||
for SMPL in `ls "${SAMPLE_CODE_DIR}"/*.cpp`; do
|
||||
CMD_CPL="${CC} -I../ -L ../libisoburn/.libs/ -lisoburn -o ${SMPL}.obj ${SMPL}"
|
||||
printf "${SELF}: ${CMD_CPL}\n"
|
||||
set +e
|
||||
${CMD_CPL}
|
||||
RET_CPL="$?"
|
||||
if [ ${RET_CPL} == 0 -a -f ${SMPL}.obj ]; then
|
||||
mv ${SMPL}.obj ${GEN_DATA_DIR}
|
||||
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
|
||||
#else
|
||||
# printf "\n${SELF}: No C++ code samples found in ${SAMPLE_CODE_DIR}\n"
|
||||
#fi
|
||||
|
||||
# clean
|
||||
cleanup
|
||||
|
||||
exit 0
|
215
libisoburn/branches/1.1.4/releng/auto_isocontent
Executable file
215
libisoburn/branches/1.1.4/releng/auto_isocontent
Executable file
@@ -0,0 +1,215 @@
|
||||
#!/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
|
||||
|
||||
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
|
||||
ls -l "$on_disk"/*
|
||||
|
||||
# trivial ISO 9660 image validation routine
|
||||
is_valid_iso9660() {
|
||||
ISOfile="$1"
|
||||
if [ ! -f ${ISOfile} ]; then
|
||||
failure=1
|
||||
printf "\nFAIL : ${SELF} : Not found: ${ISOfile}\n"
|
||||
fi
|
||||
if file ${ISOfile} | grep -P "ISO\s+9660\s+CD-ROM\s+filesystem\s+data" >/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
|
||||
}
|
||||
|
||||
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
|
||||
"$xorriso" -as mkisofs "$on_disk" | cat > "$workdir"/image_piped.iso
|
||||
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" \
|
||||
-hardlinks perform_update
|
||||
ret=$?
|
||||
if test "$ret" -gt 0 -a "$ret" -lt 32
|
||||
then
|
||||
printf "\n${SELF}: xorriso write run failed\n\n" >&2
|
||||
cleanup
|
||||
printf "${SELF}: FAILED\n"
|
||||
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" >&2
|
||||
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 "\n${SELF}: xorriso file extraction run failed\n\n" >&2
|
||||
cleanup
|
||||
printf "${SELF}: FAILED\n"
|
||||
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 -l "$copy_on_disk"/* | awk '{print $2}'))
|
||||
expected="3 3 3 2 2"
|
||||
if test x"$x" = x"$expected"
|
||||
then
|
||||
printf "\n${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
|
||||
|
||||
#
|
||||
cleanup
|
||||
|
||||
# Report result
|
||||
echo
|
||||
if test "$failure" = 1
|
||||
then
|
||||
printf "${SELF}: FAILED"
|
||||
echo
|
||||
exit 1
|
||||
else
|
||||
printf "${SELF}: Passed"
|
||||
echo
|
||||
fi
|
||||
|
||||
exit 0
|
111
libisoburn/branches/1.1.4/releng/auto_printsize
Executable file
111
libisoburn/branches/1.1.4/releng/auto_printsize
Executable file
@@ -0,0 +1,111 @@
|
||||
#!/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
|
||||
for ((i1=0; i1 < ${DIR_UPPER}/4; i1++))
|
||||
do
|
||||
for ((i2=0; i2 < ${DIR_UPPER}/2; i2++))
|
||||
do
|
||||
for ((i3=0; i3 < ${DIR_UPPER}; i3++))
|
||||
do
|
||||
mkdir -p ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3
|
||||
for ((i_file=0; i_file < ${FILE_UPPER}; i_file++))
|
||||
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
|
34
libisoburn/branches/1.1.4/releng/codesamples/api_3lib.cpp
Normal file
34
libisoburn/branches/1.1.4/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>
|
||||
* Licensed under GNU GPL version 2
|
||||
*/
|
||||
|
||||
#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.1.4/releng/codesamples/api_xorriso.cpp
Normal file
30
libisoburn/branches/1.1.4/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>
|
||||
* Licensed under GNU GPL version 2
|
||||
*/
|
||||
|
||||
#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;
|
||||
}
|
167
libisoburn/branches/1.1.4/releng/inc/releng_getopts.inc
Normal file
167
libisoburn/branches/1.1.4/releng/inc/releng_getopts.inc
Normal file
@@ -0,0 +1,167 @@
|
||||
# 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}
|
||||
|
||||
#############################################
|
||||
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
|
||||
READ_CANON_EXISTS=`readlink -e "${GEN_DATA_DIR}"`
|
||||
DIR_NAME_GEN_DATA=`dirname "${READ_CANON_EXISTS}"`
|
||||
set +e
|
||||
RET_NON_EMPTY_STRING=`echo "${DIR_NAME_GEN_DATA}" | grep -P "\w+\/releng_generated_data$"`
|
||||
GREP_RET_GEN_DATA="$?"
|
||||
case "${GREP_RET_GEN_DATA}" in
|
||||
0)
|
||||
if [ x"${RET_NON_EMPTY_STRING}" != x"" ]; then
|
||||
# now call the nastiness
|
||||
chmod +w -R ${GEN_DATA_DIR}
|
||||
rm -rf ${GEN_DATA_DIR}
|
||||
boldify
|
||||
printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}
|
||||
unboldify
|
||||
else
|
||||
printf "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
|
||||
}
|
||||
|
||||
|
||||
#############################################
|
||||
|
||||
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
|
12
libisoburn/branches/1.1.4/releng/inc/test_releng_getopt
Executable file
12
libisoburn/branches/1.1.4/releng/inc/test_releng_getopt
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
. releng_getopts.inc
|
||||
|
||||
printf "\nRELENG_XORRISO =${RELENG_XORRISO}"
|
||||
printf "\nCLEANUP =${CLEANUP}"
|
||||
printf "\nSIMULATE_FAILURE =${SIMULATE_FAILURE}"
|
||||
printf "\n"
|
||||
|
||||
exit 0
|
214
libisoburn/branches/1.1.4/releng/manual_burn
Executable file
214
libisoburn/branches/1.1.4/releng/manual_burn
Executable file
@@ -0,0 +1,214 @@
|
||||
#!/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.
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
# 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 "$i" = "--dev"
|
||||
then
|
||||
next_is="dev"
|
||||
elif test "$i" = "--what"
|
||||
then
|
||||
next_is="what"
|
||||
elif test "$i" = "--any_media"
|
||||
then
|
||||
any_media=1
|
||||
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
|
||||
res=$("$RELENG_XORRISO" -outdev "$dev" 2>&1)
|
||||
ret=$?
|
||||
set -e
|
||||
if test "$ret" -ne 0
|
||||
then
|
||||
echo "$res" >&2
|
||||
echo "FAIL : ${SELF} : Non-zero exit value $ret with: $RELENG_XORRISO -outdev $dev"
|
||||
echo
|
||||
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 "$RELENG_XORRISO" -for_backup -outdev "$dev" -blank as_needed -map "$what" /test
|
||||
set +e
|
||||
"$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 "$RELENG_XORRISO" -for_backup -indev "$dev" \
|
||||
-check_media event=FATAL -- \ -check_md5_r FATAL / --
|
||||
set +e
|
||||
"$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
|
174
libisoburn/branches/1.1.4/releng/manual_devices
Executable file
174
libisoburn/branches/1.1.4/releng/manual_devices
Executable file
@@ -0,0 +1,174 @@
|
||||
#!/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.
|
||||
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=
|
||||
next_is=ignore
|
||||
for i in "$@"
|
||||
do
|
||||
if test "$next_is" = "ignore"
|
||||
then
|
||||
if test "$i" = "--"
|
||||
then
|
||||
next_is=""
|
||||
fi
|
||||
elif test "$next_is" = "dev"
|
||||
then
|
||||
dev="$i"
|
||||
next_is=""
|
||||
elif test "$i" = "--dev"
|
||||
then
|
||||
next_is="dev"
|
||||
else
|
||||
echo >&2
|
||||
echo "Unknown test specific option: $i" >&2
|
||||
print_help
|
||||
print_specific_help
|
||||
exit 31
|
||||
fi
|
||||
done
|
||||
|
||||
# Insist in having a xorriso
|
||||
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: ${RELENG_XORRISO} -report_about WARNING -outdev ${1} -toc -list_formats -list_profiles out -list_speeds"
|
||||
"$RELENG_XORRISO" -report_about WARNING -outdev "$1" \
|
||||
-print '---toc :' -toc \
|
||||
-print '---list_formats :' -list_formats \
|
||||
-print '---list_profiles :' -list_profiles out \
|
||||
-print '---list_speeds :' -list_speeds
|
||||
}
|
||||
|
||||
cat_var() {
|
||||
# $1 = variable to put out with line feeds
|
||||
cat <<+
|
||||
$1
|
||||
+
|
||||
}
|
||||
|
||||
get_devices() {
|
||||
# $1 = if not empty: device lines from xorriso -devices or -device_links
|
||||
# $2 = if not empty: suppress dialog and use $2 as input
|
||||
|
||||
if test -n "$1"
|
||||
then
|
||||
DEVICES="$1"
|
||||
else
|
||||
DEVICES=$("$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=$("$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}: ${RELENG_XORRISO} $devices_opt returned ${RET}."
|
||||
unboldify
|
||||
echo -e "\n${SELF}: Already mounted?"
|
||||
df -kh
|
||||
esac
|
||||
|
||||
exit 0
|
256
libisoburn/branches/1.1.4/releng/manual_isojigdo
Executable file
256
libisoburn/branches/1.1.4/releng/manual_isojigdo
Executable file
@@ -0,0 +1,256 @@
|
||||
#!/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/current/i386/iso-cd"
|
||||
REMOTE_IMG="debian-testing-i386-businesscard.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 -P "(libjte\s+in\s+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"
|
||||
wget --no-check-certificate -T20 -t3 -O \
|
||||
"${TMP_DATA_DIR}"/"${REMOTE_IMG}" "${REMOTE_URL}"/"${REMOTE_IMG}"
|
||||
WGET_RET="$?"
|
||||
case ${WGET_RET} in
|
||||
0)
|
||||
echo -e "\n${SELF}: Downloading successfully completed.\n"
|
||||
;;
|
||||
*)
|
||||
echo -e "\nFAIL : ${SELF} : wget returned code: $WGET_RET\n"
|
||||
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
|
||||
else
|
||||
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}" -a -f "${APPEND_PART}" ]; then
|
||||
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 \
|
||||
-append_partition 2 0x01 ${APPEND_PART} \
|
||||
"
|
||||
else
|
||||
printf "\n${SELF}: FAIL to compose the boot section.\n"
|
||||
cleanup
|
||||
exit 8
|
||||
fi
|
||||
|
||||
# JIGDO section
|
||||
JIGDO_JIGDO=${GEN_DATA_DIR}/${RELENG_IMG}.jigdo
|
||||
JIGDO_TEMPLATE=${GEN_DATA_DIR}/${RELENG_IMG}.template
|
||||
JIGDO_MAP_RHV=`readlink -e ${RELENG_DIR}`
|
||||
JIGDO_MAP="Debian=${JIGDO_MAP_RHV}/"
|
||||
|
||||
# create jigdo MD5 list in base64 format
|
||||
JIGDO_GEN_MD5=${GEN_DATA_DIR}/${RELENG_IMG}.md5
|
||||
if which jigdo-gen-md5-list >/dev/null 2>&1; then
|
||||
printf "${SELF}: Creating MD5 list in hex format in ${JIGDO_GEN_MD5}..."
|
||||
jigdo-gen-md5-list ${RELENG_DIR} > ${JIGDO_GEN_MD5}
|
||||
printf "Done.\n"
|
||||
else
|
||||
printf "\n${SELF}: Not found: jigdo-gen-md5-list. Install jigit >= 1.18."
|
||||
printf "\n${SELF}: http://www.einval.com/~steve/software/JTE/\n"
|
||||
cleanup
|
||||
exit 9
|
||||
fi
|
||||
|
||||
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+="${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
|
226
libisoburn/branches/1.1.4/releng/run_all_auto
Executable file
226
libisoburn/branches/1.1.4/releng/run_all_auto
Executable file
@@ -0,0 +1,226 @@
|
||||
#!/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
|
||||
|
||||
SELF=$(basename "$0")
|
||||
GEN_DATA_DIR=releng_generated_data
|
||||
CLOG=${GEN_DATA_DIR}/log.${SELF}
|
||||
PASSED_OPTIONS="$@"
|
||||
RELENG_XORRISO=
|
||||
CLEANUP_LOG=0
|
||||
|
||||
not_in_releng_exit() {
|
||||
printf "\nPlease execute the tests from releng directory.\n\n"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
# 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
|
||||
not_in_releng_exit
|
||||
fi
|
||||
|
||||
#############################################
|
||||
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"-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 [ ! "${1}" ]; then
|
||||
cat << HLP
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
${SELF} runs executables from CWD starting
|
||||
with auto_*, passing them its own options.
|
||||
stdout/stderr output stored in:
|
||||
${CLOG}
|
||||
|
||||
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
|
||||
exit 31
|
||||
fi
|
||||
|
||||
########################################################
|
||||
if [ -f "${CLOG}" ]; then
|
||||
mv "${CLOG}" "${CLOG}".prev
|
||||
fi
|
||||
> ${CLOG}
|
||||
if [ -x "${RELENG_XORRISO}" ]; then
|
||||
echo -e "_OVERVIEW_______________________________________________________________" >> ${CLOG}
|
||||
date --utc >> ${CLOG}
|
||||
${RELENG_XORRISO} --version >> ${CLOG}
|
||||
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> ${CLOG}
|
||||
fi
|
||||
DSTART=`date --utc`
|
||||
echo -ne "${SELF}: Started at ${DSTART}" | tee -a ${CLOG}
|
||||
E1=`date '+%s'`
|
||||
# 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 -ne "\n\n_STARTING_TEST_________________________________________________________" >> ${CLOG}
|
||||
echo -ne "\n${SELF}: Running ./${s} ${PASSED_OPTIONS} :\n" \
|
||||
| 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'`
|
||||
let TS="${T2} - ${T1}"
|
||||
case ${RET} in
|
||||
0)
|
||||
printf "done in ${TS} sec. ok."
|
||||
;;
|
||||
*)
|
||||
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
|
||||
;;
|
||||
esac
|
||||
set -e
|
||||
fi
|
||||
done
|
||||
|
||||
DEND=`date --utc`
|
||||
echo -ne "\n${SELF}: Stopped at ${DEND}." | tee -a ${CLOG}
|
||||
if [ "${CLEANUP_LOG}" -eq 1 ]; then
|
||||
if [ -f "${CLOG}" ]; then
|
||||
rm -f "${CLOG}"
|
||||
echo -ne "\n${SELF}: Removed my own log ${CLOG}." # | tee -a ${CLOG}
|
||||
fi
|
||||
if [ -f "${CLOG}".prev ]; then
|
||||
rm -f "${CLOG}".prev
|
||||
echo -e "\n${SELF}: Removed my own log ${CLOG}.prev." # | tee -a ${CLOG}
|
||||
fi
|
||||
else
|
||||
E2=`date '+%s'`
|
||||
if [ ${E2} -eq ${E1} ]; then
|
||||
echo -e " Total elapsed 0 sec." | tee -a ${CLOG}
|
||||
else
|
||||
let ES="${E2} - ${E1}"
|
||||
echo -e " Total elapsed ${ES} sec." | tee -a ${CLOG}
|
||||
fi
|
||||
#####
|
||||
echo -e "\n_SUMMARY________________________________________________________________" >> ${CLOG}
|
||||
echo -e "${SELF}: Trivial log examination: ${CLOG}" | tee -a ${CLOG}
|
||||
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | 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+="|FAIL|ERROR|WRONG)"
|
||||
|
||||
if [ -f "${CLOG}" ]; then
|
||||
set +e
|
||||
# lines, perl regex, leading tabs
|
||||
grep -n -P "${LIST_KWD}" "${CLOG}"
|
||||
RET_GREP="$?"
|
||||
case ${RET_GREP} in
|
||||
0) # found
|
||||
;;
|
||||
1) # not found
|
||||
echo -e "${SELF}: Log file looks clear." # | tee -a ${CLOG}
|
||||
;;
|
||||
*) #
|
||||
echo -e "${SELF}: grep returned EXIT CODE: ${RET_GREP}." # | tee -a ${CLOG}
|
||||
;;
|
||||
esac
|
||||
set -e
|
||||
fi
|
||||
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" | tee -a ${CLOG}
|
||||
|
||||
##### TODO: work out a less noisy diff'ing technique!
|
||||
if [ -f "${CLOG}".prev -a -f "${CLOG}" ]; then
|
||||
echo -e "${SELF}: See diff against previous log file (might be long):" | tee -a ${CLOG}
|
||||
echo -e "diff -Naur ${CLOG}.prev ${CLOG} | less" | tee -a ${CLOG}
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
#
|
||||
which tput >/dev/null 2>&1 && tput smso
|
||||
echo -e "\n${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 0
|
135
libisoburn/branches/1.1.4/releng/template_new
Executable file
135
libisoburn/branches/1.1.4/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 make sure to remove this directory if not
|
||||
# ===
|
||||
# === 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