From 7d22b5313b31b5bab845d4b954ffa09e696c1609 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Tue, 30 Aug 2011 17:22:40 +0000 Subject: [PATCH] Reacting on xorriso ifailure in pipe test of releng/auto_isocontent --- releng/README | 4 ++++ releng/auto_isocontent | 23 +++++++++++++++++++++-- releng/inc/releng_getopts.inc | 14 ++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/releng/README b/releng/README index 5c41b341..793c05f9 100644 --- a/releng/README +++ b/releng/README @@ -139,8 +139,12 @@ All general options are accepted. Exercises inclusion of xorriso/xorriso.h and libisoburn/libisoburn.h in C++ programs and linking of the libraries. It might be necessary to set compiler options by shell variable CFLAGS before running the test. + It might be necessary to hand over the install directory of libburn and + libisofs in shell variable LD_LIBRARY_PATH. E.g. if on FreeBSD the include headers libisofs.h , libburn.h are not found: export CFLAGS="-I/usr/local/include" + E.g. on GNU/Hurd, where libburn and libisofs are not found by the linker: + export LD_LIBRARY_PATH="/usr/local/lib" ./auto_isocontent -x ../xorriso/xorriso Tests whether xorriso is able to record and restore two familes of diff --git a/releng/auto_isocontent b/releng/auto_isocontent index d949bad4..af1f4c62 100755 --- a/releng/auto_isocontent +++ b/releng/auto_isocontent @@ -94,6 +94,20 @@ is_valid_iso9660() { fi } +# Retrieve and evaluate return value of command run under return_wrapper +check_xorriso_return() { + ret=$(cat "$return_value_file") + rm "$return_value_file" + if test "$ret" = 0 + then + return 0 + fi + failure=1 + echo + echo "FAIL : ${SELF} : xorriso run exited with value $ret" + return 1 +} + # Create test file and find out whether ACLs and/or xattr are available. # # Users known on GNU/Linux and FreeBSD: root games daemon man @@ -198,14 +212,19 @@ echo ls -l "$on_disk"/* echo -e "\n${SELF}: Producing simple image via -o" >&2 -"$xorriso" -as mkisofs "$on_disk" -o "$workdir"/image_minus_o.iso +"$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 +return_wrapper "$xorriso" -as mkisofs "$on_disk" | \ + cat > "$workdir"/image_piped.iso +check_xorriso_return is_valid_iso9660 "$workdir"/image_piped.iso + echo -e "\n${SELF}: Producing simple image with for_backup/update_r/hardlinks" >&2 "$xorriso" \ $report_about \ diff --git a/releng/inc/releng_getopts.inc b/releng/inc/releng_getopts.inc index fc7954a3..4a87fb20 100644 --- a/releng/inc/releng_getopts.inc +++ b/releng/inc/releng_getopts.inc @@ -119,6 +119,20 @@ check_for_xorriso() { } +############################################# + +# To catch the exit value of a command in a pipe +return_value_file="$GEN_DATA_DIR"/wrapper_"$$"_return_value +return_wrapper() +{ + cmd="$1" + shift 1 + "$cmd" "$@" + RET="$?" + echo "$RET" >"$return_value_file" + return "$RET" +} + ############################################# next_is=