testsuccess checks the return code, but it does also some autotests
based on the command like grepping for dpkg warnings in a apt-get
install call – but if this finds something it is just showing the grep
command. With this change it will additionally show the first msgtest
which in this case will detail the actual apt-get install call.
Git-Dch: Ignore
}
msgfail() {
if [ -n "$MSGTEST_MSG" ]; then
}
msgfail() {
if [ -n "$MSGTEST_MSG" ]; then
+ if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then
+ echo "Part of the test group: $MSGTEST_GRP"
+ fi
echo -n "$MSGTEST_MSG"
unset MSGTEST_MSG
fi
echo -n "$MSGTEST_MSG"
unset MSGTEST_MSG
fi
fi
EXIT_CODE=$((EXIT_CODE+1));
}
fi
EXIT_CODE=$((EXIT_CODE+1));
}
+MSGGROUP_LEVEL=0
+msggroup() {
+ if [ -n "$1" ]; then
+ if [ $MSGGROUP_LEVEL = 0 ]; then
+ MSGTEST_GRP='NEXT'
+ fi
+ MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1));
+ else
+ MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1));
+ if [ $MSGGROUP_LEVEL = 0 ]; then
+ unset MSGTEST_GRP
+ fi
+ fi
+}
# enable / disable Debugging
if [ $MSGLEVEL -le 0 ]; then
# enable / disable Debugging
if [ $MSGLEVEL -le 0 ]; then
if [ $MSGLEVEL -le 2 ]; then
msgmsg() { true; }
msgnmsg() { true; }
if [ $MSGLEVEL -le 2 ]; then
msgmsg() { true; }
msgnmsg() { true; }
- msgtest() { MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")"; }
+ msgtest() {
+ MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")"
+ if [ "$MSGTEST_GRP" = 'NEXT' ]; then
+ MSGTEST_GRP="$MSGTEST_MSG"
+ fi
+ }
msgpass() { printf " ${CPASS}P${CNORMAL}"; }
fi
if [ $MSGLEVEL -le 3 ]; then
msgpass() { printf " ${CPASS}P${CNORMAL}"; }
fi
if [ $MSGLEVEL -le 3 ]; then
local MSG='Test for correctness of file'
if [ "$1" = '--nomsg' ]; then
MSG=''
local MSG='Test for correctness of file'
if [ "$1" = '--nomsg' ]; then
MSG=''
msgfailoutput '' "$OUTPUT"
fi
fi
msgfailoutput '' "$OUTPUT"
fi
fi
msgtest "Test for no output of" "$*"
local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile"
if "$@" >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then
msgtest "Test for no output of" "$*"
local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile"
if "$@" >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then
msgfailoutput '' "$COMPAREFILE"
fi
aptautotest 'testempty' "$@"
msgfailoutput '' "$COMPAREFILE"
fi
aptautotest 'testempty' "$@"
local MSG='Test of equality of'
if [ "$1" = '--nomsg' ]; then
MSG=''
local MSG='Test of equality of'
if [ "$1" = '--nomsg' ]; then
MSG=''
msgfailoutput '' "$OUTPUT"
fi
aptautotest 'testequal' "$@"
msgfailoutput '' "$OUTPUT"
fi
aptautotest 'testequal' "$@"
local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1"
local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2"
local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst"
msgfailoutput '' "$OUTPUT"
fi
aptautotest 'testequalor2' "$@"
msgfailoutput '' "$OUTPUT"
fi
aptautotest 'testequalor2' "$@"
local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual"
local PACKAGE="$1"
shift
local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual"
local PACKAGE="$1"
shift
else
msgfailoutput '' "$OUTPUT"
fi
else
msgfailoutput '' "$OUTPUT"
fi
msgtest "Test for non-existent packages" "apt-cache show $*"
local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
if [ -n "$SHOWPKG" ]; then
msgtest "Test for non-existent packages" "apt-cache show $*"
local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')"
if [ -n "$SHOWPKG" ]; then
local STATE="$1"
local NR="$2"
shift 2
local STATE="$1"
local NR="$2"
shift 2
testdpkgstatus 'ii' "$#" "$@"
testdpkgstatus 'ii' "$#" "$@"
}
testdpkgnotinstalled() {
}
testdpkgnotinstalled() {
testdpkgstatus 'ii' '0' "$@"
testdpkgstatus 'ii' '0' "$@"
local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
if [ -n "$1" ]; then
msgtest 'Test for correctly marked as auto-installed' "$*"
local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile"
if [ -n "$1" ]; then
msgtest 'Test for correctly marked as auto-installed' "$*"
else
msgfailoutput '' "$OUTPUT"
fi
else
msgfailoutput '' "$OUTPUT"
fi
local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile"
if [ -n "$1" ]; then
msgtest 'Test for correctly marked as manually installed' "$*"
local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile"
if [ -n "$1" ]; then
msgtest 'Test for correctly marked as manually installed' "$*"
else
msgfailoutput '' "$OUTPUT"
fi
else
msgfailoutput '' "$OUTPUT"
fi
}
msgfailoutput() {
if [ -n "$MSGTEST_MSG" ]; then
echo
}
msgfailoutput() {
if [ -n "$MSGTEST_MSG" ]; then
echo
+ if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then
+ echo "${CFAIL}Part of the test group: $MSGTEST_GRP"
+ fi
echo -n "$MSGTEST_MSG"
unset MSGTEST_MSG
fi
echo -n "$MSGTEST_MSG"
unset MSGTEST_MSG
fi
if [ "$1" = '--nomsg' ]; then
shift
else
if [ "$1" = '--nomsg' ]; then
shift
else
msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@"
fi
aptautotest 'testsuccess' "$@"
msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@"
fi
aptautotest 'testsuccess' "$@"
if [ "$1" = '--nomsg' ]; then
shift
else
if [ "$1" = '--nomsg' ]; then
shift
else
msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@"
fi
aptautotest 'testwarning' "$@"
msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@"
fi
aptautotest 'testwarning' "$@"
if [ "$1" = '--nomsg' ]; then
shift
else
if [ "$1" = '--nomsg' ]; then
shift
else
fi
fi
aptautotest 'testfailure' "$@"
fi
fi
aptautotest 'testfailure' "$@"
local CMP="$1"
shift
testsuccess "$@"
testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$CMP"
local CMP="$1"
shift
testsuccess "$@"
testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$CMP"
local CMP="$1"
shift
testwarning "$@"
testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" "$CMP"
local CMP="$1"
shift
testwarning "$@"
testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" "$CMP"
local CMP="$1"
shift
testfailure "$@"
testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" "$CMP"
local CMP="$1"
shift
testfailure "$@"
testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" "$CMP"
local CMP="$1"
shift
testfailure "$@"
local CMP="$1"
shift
testfailure "$@"
cat "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" >"$OUTPUT"
msgfailoutput '' "$OUTPUT"
fi
cat "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" >"$OUTPUT"
msgfailoutput '' "$OUTPUT"
fi
msgtest "Test that file $1 has $2 $3" "$4"
if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then
msgpass
msgtest "Test that file $1 has $2 $3" "$4"
if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then
msgpass
} >"$OUTPUT" 2>&1
msgfailoutput '' "$OUTPUT"
fi
} >"$OUTPUT" 2>&1
msgfailoutput '' "$OUTPUT"
fi
testfilestats "$1" '%a' '=' "$2"
testfilestats "$1" '%a' '=' "$2"
}
testwebserverlaststatuscode() {
}
testwebserverlaststatuscode() {
local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log'
local STATUS='downloaded/webserverstatus-statusfile.log'
rm -f "$DOWNLOG" "$STATUS"
local DOWNLOG='rootdir/tmp/webserverstatus-testfile.log'
local STATUS='downloaded/webserverstatus-statusfile.log'
rm -f "$DOWNLOG" "$STATUS"
} >"$OUTPUT" 2>&1
msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT"
fi
} >"$OUTPUT" 2>&1
msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT"
fi