From 91b0a2aa8d269790076342b503961162b3c970fd Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 1 Aug 2011 19:23:42 +0000 Subject: [PATCH] Checking -assert_volid in auto_isocontent --- releng/auto_isocontent | 48 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/releng/auto_isocontent b/releng/auto_isocontent index 9e2acbe9..c7abd527 100755 --- a/releng/auto_isocontent +++ b/releng/auto_isocontent @@ -81,13 +81,13 @@ is_valid_iso9660() { ISOfile="$1" if [ ! -f ${ISOfile} ]; then failure=1 - printf "\n${SELF}: FAIL: Not found: ${ISOfile}\n" + printf "\n${SELF}: 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 "\n${SELF}: Resulting ${ISOfile} OK. Looks like ISO 9660 filesystem.\n" else failure=1 - printf "\n${SELF}: FAIL: ${ISOfile} DOES NOT look like ISO 9660 filesystem data.\n" + printf "\n${SELF}: FAIL : ${ISOfile} DOES NOT look like ISO 9660 filesystem data.\n" fi } @@ -108,19 +108,61 @@ echo -e "\n${SELF}: Producing simple image with for_backup/update_r/hardlinks" > -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 "\n${SELF}: FAIL : -assert_volid test not properly performed\n\n" >&2 +else + failure=1 + printf "\n${SELF}: FAIL : -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