Branching for libisoburn release 1.1.2

This commit is contained in:
2011-07-08 09:51:06 +00:00
parent 300cb92ac5
commit def086fb8d
119 changed files with 93994 additions and 0 deletions

View File

@ -0,0 +1,29 @@
Release Engineering
~~~~~~~~~~~~~~~~~~~
* SOFTWARE TO TEST
Use latest libburnia libraries code base from svn and bzr
(see README for aditional and autodetected library dependencies)
Alternatively, use latest all-in-one development tarball from:
http://www.gnu.org/software/xorriso/
* SETUP THE TEST ENVIRONMENT
+ Not all TESTs are scripts (e.g. cppcheck, valgrind)
+ Copy all SCRIPT.conf.template to $HOME/.libburnia-releng/SCRIPT.conf
+ Read the configuration files and set up accordingly to your needs
* DELIVERING A NEW TEST SCRIPT
+ Start a new test script over the top of template_new_releng
+ All filenames start with releng_ prefix
+ Self generated data are to be stored in
./releng_generated_data/scriptname/ directory
+ Test data generation options -rc [-keep]
+ Test data removal options -cleanup
+ Well documented configuration file SCRIPT.conf.template
+ 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)
* RUNNING TESTS
+ All tests have to be run from the releng/ directory, within
libisoburn source tree. Ther is a 'master' script called
run_all_releng, which runs all scripts prefixed with releng_*.

View File

@ -0,0 +1,36 @@
Release Engineering Che[at|ck] List
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Automated tests
~~~~~~~~~~~~~~~
TEST: Tests starting with releng_* are runnable by run_all_releng
FILE: libisoburn/releng/releng_*
FILE: http://people.debian.org/~danchev/libburnia/logs/releng/
WHO: george, thomas
TEST: cppcheck
FILE: http://people.debian.org/~danchev/libburnia/logs/cppcheck/
WHO: george, thomas
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/
WHO: george, thomas
Non-automated tests
~~~~~~~~~~~~~~~~~~~
TEST: valgrind
FILE:
WHO: george, thomas
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)
WHO: george, thomas
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
WHO: george, thomas

View File

@ -0,0 +1,36 @@
* Invent an interpreter to read options from config files and sets the variables
or use confget ( http://devel.ringlet.net/textproc/confget/ )
OR BETTER YET TRY TO DROP the entire concept of config files and
rely solely on cmdline options.
* Write a common configuration facility.
* Expose ldd and --version of tested binary just once.
* Also support 'run_all_releng /path/to/xorriso [-keep]'
i.e. without the need to install config files in place.
* Merge 'merge_into_isocontent' into 'releng_isocontent' (former hardlinks)
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.
* Also check trivial operations like --devices, etc.
* Split off common functionality in common ./lib/ so it can be re-used
by all scripts. This might include cmdline option parsing, some
validation code like releng_isocontent:is_valid_iso9660
* We need to give a hint about how much storage space will be consumed.
* We could mark all own stderr messages by a prefix like "===".
* Burning tests ideas/thoughts by Thomas:
> There will have to be a warning and user input before we load
> the drive tray. -dev, -indev, -oudev do this loading which can
> cause finger injury, psychical trauma, and chuting computers.
>
> 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.

View File

@ -0,0 +1,26 @@
// Just to ensure we are C++-clean. This should not spit too much noise
#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, &micro);
if (major<0 || minor<0 || micro<0)
return -1;
std::cout
<< " major:" << major
<< " minor:" << minor
<< " micro:" << micro
;
return 0;
}

View File

@ -0,0 +1,30 @@
// Just to ensure we are C++-clean. This should not spit too much noise
#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, &micro);
if (major<0 || minor<0 || micro<0)
return -1;
std::cout
<< " major:" << major
<< " minor:" << minor
<< " micro:" << micro
;
return 0;
}

View File

@ -0,0 +1,109 @@
#!/bin/bash
set -e
START_DIR_DONT_CHANGE=`pwd`
SELF=$(basename "$0")
# required config items
RELENG_XORRISO=""
RELENG_DIR=""
RELENG_IMG=""
CONFFILE=$HOME/.libburnia-releng/${SELF}.conf
KEEP=0
GEN_DATA_DIR=releng_generated_data/${SELF}
printf "\n$0: FAIL: SCRIPT NOT COMPLETED YET\n"
exit 31
print_help() {
cat << HLP
Usage:
${SELF} -help
# using a config file ${CONFFILE}
${SELF} -rc [-keep]
# without using a config file
${SELF} xorriso_cmd IN_dir OUT_image [-keep]
# cleanup test generated data directory and exit
${SELF} -cleanup
HLP
}
# Thomas:
# xorriso provides built-in means for comparison:
# -compare_r disk_path iso_rr_path
# Possibly i will have to enhance it so that it is suitable for automatic
# testing. (I used it mainly for testing -update_r.)
# xorriso could use
# -osirrox on -extract iso_rr_path disk_path
# to pull a tree out of the image without mounting it.
# One could mount the image -o loop. (Needs superuser authority.)
# There is a program test/compare_file which acts on a mounted image
# or on extracted trees i.e. completely independent of xorriso code.
# See libisoburn/README paragraph "Testing".
# With extracted trees one will want to use option -no_ctime.
# One may use command diff -r to compare directory trees of a mounted image
# or extracted trees.
# George:
# xorriso -indev my.iso -find / vs. find input_dir
# bsdtar -xf my.iso vs. input_dir
Sketched by Thomas:
------------------------------------------------------------------------------
image_file=/tmp/...
on_disk=...
in_iso="$on_disk"
copy_on_disk=/tmp/...
if test -e "$image_file"
then
echo "TEST ENVIRONMENT ERROR: Existing image_file target:" >&2
ls -ld "$image_file" >&2
exit 1
fi
if test -e "$copy_on_disk"
then
echo "TEST ENVIRONMENT ERROR: Existing copy_on_disk target:" >&2
ls -ld "$copy_on_disk" >&2
exit 1
fi
# Produce simple image
xorriso \
-for_backup \
-outdev "$image_file" \
-map "$on_disk" "$in_iso"
# Copy from image to temporary disk tree
xorriso \
-for_backup \
-indev "$image_file" \
-osirrox on \
-extract "$in_iso" "$copy_on_disk"
# Compare original disk tree and temporary one
diff -r "$on_disk" "$copy_on_disk"
if test "$?" -ne 0
then
echo 'FAIL: Original disk tree and temporary tree differ'
else
echo "Success."
fi
# Clean up
rm -r "$copy_on_disk" "$image_file"
------------------------------------------------------------------------------
exit 0

View File

@ -0,0 +1,117 @@
#!/bin/bash
set -e
START_DIR_DONT_CHANGE=`pwd`
SELF=$(basename "$0")
GEN_DATA_DIR=releng_generated_data/${SELF}
KEEP=0
SAMPLE_CODE_DIR=codesamples
CC=g++
#####################################################################
print_help() {
cat << HLP
Usage:
$0 -help
#
$0 -rc [-keep]
# cleanup test generated data directory and exit
$0 -cleanup
HLP
}
#####################################################################
cleanup() {
if [ ${KEEP} -eq 0 ]; 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
rm -rf ${GEN_DATA_DIR}
printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}
else
printf "${SELF}: ${GEN_DATA_DIR} does not exist. Nothing to clean.\n"
fi
else
printf "${SELF}: Leaving (self-generated) %s\n" ${GEN_DATA_DIR}
fi
}
#####################################################################
# help
if [ ! "${1}" ]; then
print_help && exit 3
#
elif [ "${1}" == "-cleanup" ]; then
cleanup
exit 0
#
elif [ "${1}" == "-rc" -a "${2}" == "-keep" ]; then
KEEP=1
elif [ "${1}" == "-rc" -a ! "${2}" ]; then
KEEP=0
# the rest
else
print_help && exit 4
fi
#####################################################################
# check data dir
if [ -d "${GEN_DATA_DIR}" ]; then
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
printf "\n${SELF}: use '${SELF} -cleanup' to remove.\n"
exit 5
else
mkdir "${GEN_DATA_DIR}"
fi
# check compiler
if ! which "${CC}" >/dev/null 2>&1; then
printf "\n${SELF}: Not found: ${CC}. Install ${CC}.\n"
cleanup
exit 6
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 "\n${SELF}: FAIL 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

View File

@ -0,0 +1,264 @@
#!/bin/bash
# ts 2011.06.27
# Test the correct handling of hardlinks by xorriso options
# -update_r , -hardlinks perform_update , and -extract
export prog=$(basename "$0")
export xorriso=xorriso
export workdir=./releng_generated_data/"$prog"
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 keep=0
export failure=0
export simulate_failure=0
export next_is_xorriso=0
export next_is_rc=0
export bad=0
export report_about="-report_about UPDATE"
config_by_var() {
# This is called once before option interpretation, and once for each
# option -rc.
# Variables get set to empty content to keep them from being applied
# more than once and thus overriding settings of higher precedence.
test -n "$RELENG_XORRISO" && xorriso="$RELENG_XORRISO" && RELENG_XORRISO=
test -n "$RELENG_WORKIMAGE" && image_file="$RELENG_WORKIMAGE" \
&& RELENG_WORKIMAGE=
test -n "$RELENG_WORKDIR" && on_disk="$RELENG_WORKDIR" && RELENG_WORKDIR=
test -n "$RELENG_ISODIR" && in_iso="$RELENG_ISODIR" && RELENG_ISODIR=
test -n "$RELENG_WORKCOPYDIR" && copy_on_disk="$RELENG_WORKCOPYDIR" \
&& RELENG_WORKCOPYDIR=
}
clean_up() {
if test "$keep" = 1
then
echo "=== Kept test area because of option -keep" >&2
echo "$on_disk" "$copy_on_disk" "$image_file" "$workdir" >&2
else
echo "=== Removing test area" >&2
rm -r "$on_disk" "$copy_on_disk" "$image_file"
rm -r "$workdir"
fi
}
# Setup
# Interpret a default configuration file here, if the test has one.
# This one has none.
# >>> Best would be if the configuration file would not override env variables.
# Process env variables and default configfile variables together
config_by_var
# Now interpret program arguments and possibly given config files
for i in "$@"
do
if test "$next_is_xorriso" = 1
then
xorriso="$i"
next_is_xorriso=0
elif test "$next_is_rc" = 1
then
# >>> This looks darn dangerous. We need a trustworthy config interpreter.
# >>> http://www.netjeff.com/humor/item.cgi?file=ShootInFoot-OS
. "$i"
config_by_var
next_is_rc=0
elif test x"$i" = x"-rc"
then
next_is_rc=1
elif test x"$i" = x"-keep"
then
keep=1
elif test x"$i" = x"-cleanup"
then
keep=0
clean_up
exit 0
elif test x"$i" = x"-xorriso"
then
next_is_xorriso=1
elif test x"$i" = x"-v"
then
report_about="-report_about ALL"
elif test x"$i" = x"-fail"
then
simulate_failure=1
else
echo "Usage: $0 [-rc FILE] [-keep] [-cleanup] [-fail] [-xorriso PATH] [-v]" >&2
exit 2
fi
done
test -z "$in_iso" && in_iso="$on_disk"
if test -d ./releng_generated_data
then
dummy=dummy
else
echo "=== TEST ENVIRONMENT ERROR: $prog : No ./releng_generated_data directory existing" >&2
echo "=== Is the current working directory really ./releng of libisoburn ?" >&2
echo "FAIL : $prog : Test environment error : No ./releng_generated_data directory"
exit 3
fi
if test -e "$workdir"
then
echo "=== TEST ENVIRONMENT ERROR: $prog : Existing work directory:" >&2
ls -ld "$workdir" >&2
bad=1
fi
if test -e "$image_file"
then
echo "=== TEST ENVIRONMENT ERROR: $prog : Existing image_file target:" >&2
ls -ld "$image_file" >&2
bad=1
fi
if test -e "$on_disk"
then
echo "=== TEST ENVIRONMENT ERROR: $prog : Existing on_disk target:" >&2
ls -ld "$on_disk" >&2
bad=1
fi
if test -e "$copy_on_disk"
then
echo "=== TEST ENVIRONMENT ERROR: $prog : Existing copy_on_disk target:" >&2
ls -ld "$copy_on_disk" >&2
bad=1
fi
if test "$bad" = 1
then
echo "FAIL : $prog : Test environment error : Existing work files"
exit 3
fi
bad=0
mkdir "$workdir" || bad=1
mkdir "$on_disk" || bad=1
if test "$bad" = 1
then
echo "FAIL : $prog : Test environment error : Cannot make directories"
exit 3
fi
echo "=== Setting up $on_disk with several hardlinks" >&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"/*
is_valid_iso9660() {
ISOfile="$1"
if [ ! -f ${ISOfile} ]; then
failure=1
printf "${prog}: FAIL: 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 "=== ${ISOfile} OK\n"
else
failure=1
printf "${prog}: FAIL: ${ISOfile} does not look like ISO 9660 filesystem data\n"
fi
}
echo "=== Producing simple images via -o, redirect, and pipe" >&2
"$xorriso" -as mkisofs "$on_disk" -o "$workdir"/image_minus_o.iso
is_valid_iso9660 "$workdir"/image_minus_o.iso
"$xorriso" -as mkisofs "$on_disk" > "$workdir"/image_redirected.iso
is_valid_iso9660 "$workdir"/image_redirected.iso
"$xorriso" -as mkisofs "$on_disk" | cat > "$workdir"/image_piped.iso
is_valid_iso9660 "$workdir"/image_piped.iso
echo "=== Producing simple image" >&2
"$xorriso" \
$report_about \
-version \
-for_backup \
-padding 0 \
-outdev "$image_file" \
-update_r "$on_disk" "$in_iso" \
-hardlinks perform_update
echo "=== Copying from image to temporary disk tree" >&2
"$xorriso" \
$report_about \
-for_backup \
-indev "$image_file" \
-osirrox on \
-find "$in_iso" -exec lsdl -- \
-extract "$in_iso" "$copy_on_disk"
if test "$simulate_failure" = 1
then
echo "===" >&2
echo "=== SIMULATING FAILURE BY REMOVING AN EXTRACTED FILE" >&2
echo "===" >&2
echo "FAIL : $prog : Simulated failure caused by option -fail"
rm "$copy_on_disk"/file_1_link_b
fi
echo "=== Comparing original disk tree and temporary one" >&2
diff -r "$on_disk" "$copy_on_disk"
if test "$?" -ne 0
then
echo "=== WRONG: diff -r $on_disk $copy_on_disk reports differences" >&2
echo "FAIL : $prog : diff -r reports differences"
failure=1
else
echo "=== OK" >&2
fi
echo "=== Checking for hardlinks being siblings" >&2
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
echo "=== OK" >&2
else
echo "=== WRONG: Link count of extracted files is not as expected." >&2
echo "=== Expected: $expected" >&2
echo "=== Got : $x" >&2
echo "FAIL : $prog : Link count of extracted files is not as expected."
failure=1
fi
clean_up
# Report result
echo
if test "$failure" = 1
then
echo "======== $prog :" 'FAILED'
echo
exit 1
else
echo "======== $prog :" "Passed"
echo
fi
exit 0

View File

@ -0,0 +1,304 @@
#!/bin/bash
set -e
START_DIR_DONT_CHANGE=`pwd`
SELF=$(basename "$0")
# required config items
CONFFILE=$HOME/.libburnia-releng/${SELF}.conf
GEN_DATA_DIR=releng_generated_data/${SELF}
TMP_DATA_DIR=releng_generated_data
IMG_EXTRACT_DIR=${GEN_DATA_DIR}/${SELF}_extracted_tree
# to be set by the config file
RELENG_XORRISO=""
RELENG_DIR="${IMG_EXTRACT_DIR}"
RELENG_ISOLINUX_BIN="isolinux/isolinux.bin"
RELENG_BOOT_CAT="isolinux/boot.cat"
RELENG_IMG=t1
KEEP=0
RES=""
REMOTE_URL="http://cdimage.debian.org/cdimage/daily-builds/daily/current/i386/iso-cd"
REMOTE_IMG="debian-testing-i386-businesscard.iso"
#####
print_help() {
cat << HLP
Usage:
${SELF} -help
# using a config file ${CONFFILE}
${SELF} -rc [-keep]
# without using a config file
${SELF} /absolute/or/relative/path/to/xorriso [-keep]
# cleanup test generated data directory and exit
${SELF} -cleanup
HLP
}
#####
cleanup() {
if [ ${KEEP} -eq 0 ]; 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 15
chmod +w -R ${GEN_DATA_DIR}
rm -rf ${GEN_DATA_DIR}
printf "${SELF}: Removed (self-generated) %s\n" ${GEN_DATA_DIR}
else
printf "${SELF}: ${GEN_DATA_DIR} does not exist. Nothing to clean.\n"
fi
else
printf "${SELF}: Leaving (self-generated) %s\n" ${GEN_DATA_DIR}
fi
}
# cleanup
if [ "${1}" == "-cleanup" ]; then
cleanup
exit 0
fi
# help
if [ ! "${1}" ]; then
print_help && exit 3
# config file
elif [ "${1}" == "-rc" -a "${2}" == "-keep" ]; then
KEEP=1
if [ -e ${CONFFILE} ]; then
. ${CONFFILE}
printf "${SELF}: Using config file %s\n" ${CONFFILE}
else
echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4
fi
elif [ "${1}" == "-rc" -a ! "${2}" ]; then
KEEP=0
if [ -e ${CONFFILE} ]; then
. ${CONFFILE}
printf "${SELF}: Using config file %s\n" ${CONFFILE}
else
echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4
fi
# cmdline option
elif [ -x "${1}" -a "${2}" == "-keep" ]; then
RELENG_XORRISO="${1}"
KEEP=1
elif [ -x "${1}" ]; then
RELENG_XORRISO="${1}"
KEEP=0
# the rest
else
print_help && exit 5
fi
#
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 6
fi
if [ ! -x "${RELENG_XORRISO}" ]; then
printf "${SELF}: $RELENG_XORRISO not found or not an executable.\n"
exit 7
fi
# data dir
if [ -d "${GEN_DATA_DIR}" ]; then
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
printf "\n${SELF}: use '${SELF} -cleanup' to remove.\n"
exit 8
else
mkdir "${GEN_DATA_DIR}"
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
if ! "${RELENG_XORRISO}" -version | grep libjte >/dev/null 2>&1; then
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 9
fi
# remove cruft from previous runs
# rm -f ${RES}
# 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 "\n${SELF}: FAIL: wget returned code: $WGET_RET\n"
cleanup
exit 10
;;
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 11
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 12
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 13
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 14
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 15
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 "${SELF}: FAIL: 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
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"
exit 0

View File

@ -0,0 +1,6 @@
# *** Set your paths, see below
# *** Expected location is $HOME/.libburnia-releng/releng_isojigdo.conf
# *** Then a run of 'releng_isojigdo -rc' will pick it up
# xorriso executable to be tested
RELENG_XORRISO=/path/to/xorriso

View File

@ -0,0 +1,136 @@
#!/bin/bash
set -e
START_DIR_DONT_CHANGE=`pwd`
SELF=$(basename "$0")
# required config items
RELENG_XORRISO=""
RELENG_GENISOIMAGE=/usr/bin/genisoimage
RELENG_MKISOFS=/usr/bin/mkisofs
# config file
CONFFILE=${HOME}/.libburnia-releng/${SELF}.conf
GEN_DATA_DIR=releng_generated_data/${SELF}
UPPER=40
KEEP=0
#####################################################################
print_help() {
cat << HLP
Usage:
$0 -help
# using a config file ${CONFFILE}
$0 -rc [-keep]
# without using a config file
$0 xorriso_cmd
# cleanup test generated data directory and exit
$0 -cleanup
HLP
}
#####################################################################
# cleanup
if [ "${1}" == "-cleanup" ]; then
cd "${START_DIR_DONT_CHANGE}" || exit 2
if [ -d "${GEN_DATA_DIR}" ]; then
rm -rf ${GEN_DATA_DIR}
printf "${SELF}: removed %s\n" ${GEN_DATA_DIR}
else
printf "${SELF}: ${GEN_DATA_DIR} does not exist.\n"
fi
exit 0
fi
# help
if [ ! "${1}" ]; then print_help && exit 3; fi
# config file
if [ "${1}" == "-rc" ]; then
if [ -e ${CONFFILE} ]; then
. ${CONFFILE}
printf "${SELF}: Using config file %s\n" ${CONFFILE}
else
echo -e "\n${SELF}: Config file ${CONFFILE} not found.\n" && exit 4
fi
if [ "${2}" == "-keep" ]; then KEEP=1; fi
# command line args
elif [ "${1}" ]; then
RELENG_XORRISO="${1}"
if [ "${2}" == "-keep" ]; then KEEP=1; fi
# the rest
else
print_help && exit 5
fi
# data dir
if [ -d "${GEN_DATA_DIR}" ]; then
printf "\n${SELF}: directory %s exists!" ${GEN_DATA_DIR}
printf "\n${SELF}: use '${SELF} -cleanup' to remove.\n"
exit 6
else
mkdir "${GEN_DATA_DIR}"
fi
if [ "${RELENG_XORRISO}" == "" ]; then
echo -e "\n${SELF}: xorriso_cmd is required\n"
exit 7
fi
if [ ! -x "${RELENG_XORRISO}" ]; then
printf "${SELF}: Not found or not an executable: $RELENG_XORRISO\n"
exit 8
fi
# all must be set at this point
printf "${SELF}: Config items:"
printf "\n\txorriso_cmd=${RELENG_XORRISO}\n"
# xorriso version details, incl. underlying libraries
"${RELENG_XORRISO}" -version
if ! "${RELENG_XORRISO}" -version | grep libjte >/dev/null 2>&1; then
printf "\n${SELF}: JTE not supported with this xorriso build. Install jigit and rebuild."
printf "\n${SELF}: See http://www.einval.com/~steve/software/JTE/\n"
exit 9
fi
################################################
printf "${SELF}: Generating sample tree..."
for ((i1=0; i1 < ${UPPER}/4; i1++))
do
for ((i2=0; i2 < ${UPPER}/2; i2++))
do
for ((i3=0; i3 < ${UPPER}; i3++))
do
mkdir -p ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3
touch ${GEN_DATA_DIR}/DirOne$i1/DirTwo$i2/DirThree$i3/FileOne
done
done
done
printf "done.\n"
# Disk cache might play dirty games, so re-run these several times?
if [ -x ${RELENG_XORRISO} ]; then
printf "\n${SELF}: Running ${RELENG_XORRISO} -as mkisofs -quiet -print-size ${GEN_DATA_DIR}\n"
time ${RELENG_XORRISO} -as mkisofs -quiet -print-size ${GEN_DATA_DIR}
fi
if [ -x ${RELENG_GENISOIMAGE} ]; then
printf "\n${SELF}: Running ${RELENG_GENISOIMAGE} -quiet -print-size ${GEN_DATA_DIR}\n"
time ${RELENG_GENISOIMAGE} -quiet -print-size ${GEN_DATA_DIR}
fi
if [ -x ${RELENG_MKISOFS} ]; then
printf "\n${SELF}: Running ${RELENG_MKISOFS} -quiet -print-size ${GEN_DATA_DIR}\n"
time ${RELENG_MKISOFS} -quiet -print-size ${GEN_DATA_DIR}
fi
if [ ${KEEP} -eq 0 ]; then
cd ${START_DIR_DONT_CHANGE} || exit 10
rm -rf ${GEN_DATA_DIR}
fi
exit 0

View File

@ -0,0 +1,6 @@
# *** Set your paths, see below
# *** Expected location is $HOME/.libburnia-releng/releng_printsize.conf
# *** Then a run of 'releng_printsize -rc' will pick it up
# xorriso executable to be tested
RELENG_XORRISO=/path/to/xorriso

View File

@ -0,0 +1,115 @@
#!/bin/bash
set -e
SELF=$(basename "$0")
GEN_DATA_DIR=releng_generated_data
CLOG=${GEN_DATA_DIR}/log.${SELF}
PASSED_OPTIONS=""
if [ "${1}" == "-cleanup" ]; then
PASSED_OPTIONS="-cleanup"
elif [ "${1}" == "-rc" -a "${2}" == "-keep" ]; then
PASSED_OPTIONS="-rc -keep"
elif [ "${1}" == "-rc" ]; then
PASSED_OPTIONS="-rc"
else
cat << HLP
${SELF} runs executables from CWD starting with releng_*.
stdout/stderr output stored in ${CLOG}
${SELF} -rc [-keep]
${SELF} -cleanup
HLP
exit 101
fi
########################################################
if [ -f "${CLOG}" ]; then
mv "${CLOG}" "${CLOG}".prev
fi
> ${CLOG}
DSTART=`date --utc`
printf "\n${SELF}: Started at ${DSTART}"
E1=`date '+%s'`
# require ^releng_, avoid running (your)self explicitly
for s in `ls | grep ^releng_ | grep -v ${SELF} | sort -n`; do
if [ -x ${s} -a ! -d ${s} ]; then
# tee(1) does trailing \n, which is unwanted in that case
printf "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..."
echo -e "\n${SELF}: Running ./${s} ${PASSED_OPTIONS}..." >> ${CLOG}
echo -e "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> ${CLOG}
T1=`date '+%s'`
set +e
./${s} ${PASSED_OPTIONS} &>> ${CLOG}
RET=$?
T2=`date '+%s'`
let TS="${T2} - ${T1}"
case ${RET} in
0)
printf "done in ${TS} sec. ok."
;;
*)
printf "done in ${TS} sec. FAIL. EXIT CODE: $RET;"
;;
esac
set -e
fi
done
DEND=`date --utc`
printf "\n${SELF}: Stopped at ${DEND}."
if [ "${1}" == "-cleanup" ]; then
if [ -f "${CLOG}" ]; then rm -f "${CLOG}"; fi
if [ -f "${CLOG}".prev ]; then rm -f "${CLOG}".prev; fi
else
E2=`date '+%s'`
let ES="${E2} - ${E1}"
printf " Total elapsed ${ES} sec."
#####
printf "\n${SELF}: Std(out|err) logged in ${CLOG}."
printf "\n${SELF}: Trivial log file examination:"
printf "\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
# severity classes of libdax_msgs.h in libburn and libisofs
# List of boring keywords:
# 'UPDATE' A pacifier message during long running operations.
# List of interesting keywords:
# thrown by xorriso and underlying libraries
LIST_KWD="(NEVER|ABORT|FATAL|FAILURE|MISHAP|SORRY|WARNING|HINT|NOTE|DEBUG|ALL"
# thrown by others
LIST_KWD+="|FAIL|ERROR|WRONG)"
if [ -f "${CLOG}" ]; then
set +e
# lines, perl regex, leading tabs
grep -n -PT "${LIST_KWD}" "${CLOG}"
RET_GREP="$?"
case ${RET_GREP} in
0) # found
;;
1) # not found
printf "\n${SELF}: Log file looks clear.\n"
;;
*) #
printf "\n${SELF}: grep returned EXIT CODE: ${RET_GREP}.\n"
;;
esac
set -e
fi
printf "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n"
##### TODO: work out a less noisy diff'ing technique!
if [ -f "${CLOG}".prev -a -f "${CLOG}" ]; then
printf "${SELF}: See diff against previous log file (might be long):\n"
printf "diff -Naur ${CLOG}.prev ${CLOG} | less"
fi
fi
printf "\n"
exit 0

View File

@ -0,0 +1,47 @@
#!/bin/bash
set -e
START_DIR_DONT_CHANGE=`pwd`
SELF=$(basename "$0")
# required config items
# RELENG_XORRISO=""
# optional config items
# config file
CONFFILE=${HOME}/.libburnia-releng/${SELF}.conf
GEN_DATA_DIR=releng_generated_data/${SELF}
KEEP=0
printf "\n$0: FAIL: === TEPLATE === RENAME ME TO releng_<title>\n"
exit 31
#####################################################################
print_help() {
cat << HLP
Usage:
$0 -help
# using a config file ${CONFFILE}
$0 -rc [-keep]
# without using a config file
$0 your_own_options_here
# cleanup test generated data directory and exit
$0 -cleanup
HLP
}
#####################################################################
print_help
#if [ ! -x "${XOR}" ]; then
# printf "$0: Not found or not an executable: $XOR\n"
# exit 50
#fi
# xorriso version details, incl. underlying libraries
# "${XOR}" -version
exit 0