4 TESTDIR
=$(readlink -f $(dirname $0)) 
   8 configarchitecture 
'native' 
  11 # create a bunch of failures 
  13         setupsimplenativepackage 
"failure-$1" 'native' '1.0' 'unstable' 'Depends: dependee' 
  14         BUILDDIR
="incoming/failure-$1-1.0" 
  16 exit 29' > "${BUILDDIR}/debian/$1" 
  17         buildpackage 
"$BUILDDIR" 'unstable' 'main' 'native' 
  21 buildsimplenativepackage 
'dependee' 'native' '1.0' 'unstable' 
  22 createfailure 
'preinst' 
  23 createfailure 
'postinst' 
  25 createfailure 
'postrm' 
  29 # setup some pre- and post- invokes to check the output isn't garbled later 
  30 APTHOOK
="${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apthook" 
  34 echo "$1: ENd"' > "$APTHOOK" 
  36 echo "DPKG::Pre-Invoke:: \"${APTHOOK} PRE\"; 
  37 DPKG::Post-Invoke:: \"${APTHOOK} POST\";" > rootdir
/etc
/apt
/apt.conf.d
/99apthooks
 
  40         local PROGRESS
='rootdir/tmp/progress.log' 
  42         testfailure 
"$@" -o APT
::Status
-Fd=3 
  43         msgtest 
'Test for failure message of maintainerscript in' 'console log' 
  44         local TEST
='rootdir/tmp/testfailure.output' 
  45         if grep -q 'exit status 29' "$TEST"; then 
  51         msgtest 
'Test for proper execution of invoke scripts in' 'console log' 
  52         if grep -q '^PRE: START$' "$TEST" && 
  53                 grep -q '^PRE: MaiN$' "$TEST" && 
  54                 grep -q '^PRE: ENd$' "$TEST" && 
  55                 grep -q '^POST: START$' "$TEST" && 
  56                 grep -q '^POST: MaiN$' "$TEST" && 
  57                 grep -q '^POST: ENd$' "$TEST"; then 
  63         msgtest 
'Test for failure message of maintainerscript in' 'progress log' 
  64         if grep -q '^pmerror:.\+exit status 29$' "$PROGRESS"; then 
  70         testmarkedauto 
'dependee' 
  73 cp -a rootdir
/var
/lib
/dpkg
/status rootdir
/var
/lib
/dpkg
/status.backup
 
  74 testmyfailure aptget 
install failure
-preinst -y 
  75 cp -a rootdir
/var
/lib
/dpkg
/status.backup rootdir
/var
/lib
/dpkg
/status
 
  76 testmyfailure aptget 
install failure
-postinst -y 
  77 cp -a rootdir
/var
/lib
/dpkg
/status.backup rootdir
/var
/lib
/dpkg
/status
 
  78 testsuccess aptget 
install failure
-prerm -y 
  79 testdpkginstalled failure
-prerm 
  80 testmyfailure aptget purge failure
-prerm -y 
  81 cp -a rootdir
/var
/lib
/dpkg
/status.backup rootdir
/var
/lib
/dpkg
/status
 
  82 testsuccess aptget 
install failure
-postrm -y 
  83 testdpkginstalled failure
-postrm 
  84 testmyfailure aptget purge failure
-postrm -y 
  86 # FIXME: test with output going to a PTY as it usually does 
  87 #cp -a rootdir/var/lib/dpkg/status.backup rootdir/var/lib/dpkg/status 
  88 #aptget install failure-preinst -y