From 859093dae7dcadaff2e15a3885a1824b0d5f5913 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sat, 30 Aug 2014 11:29:45 +0200 Subject: support regular expressions in 'apt search' apt-cache search supported this since ever and in the code for apt was a fixme indicating this should be added here as well, so here we go. --- test/integration/framework | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index 3bbf440c8..fde74f55d 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -1019,7 +1019,13 @@ testfileequal() { testempty() { msgtest "Test for no output of" "$*" - test -z "$($* 2>&1)" && msgpass || msgfail + local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" + if $* >$COMPAREFILE 2>&1 && test ! -s $COMPAREFILE; then + msgpass + else + cat $COMPAREFILE + msgfail + fi } testequal() { -- cgit v1.2.3-70-g09d2 From 27cb4f6c919921b04f3dddff069620ced250a94f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Sun, 7 Sep 2014 19:30:33 +0200 Subject: detect terminal output with 'test -t' in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of trying to inspect /proc and the fds inside we use "test -t 1" instead as this is available and working on kfreebsd as well – not that something breaks if we wouldn't, but we like color. Git-Dch: Ignore --- test/integration/framework | 2 +- test/integration/run-tests | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test/integration/framework') diff --git a/test/integration/framework b/test/integration/framework index fde74f55d..ff010a5c4 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -4,7 +4,7 @@ EXIT_CODE=0 # we all like colorful messages if [ "$MSGCOLOR" != 'NO' ]; then - if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then + if [ ! -t 1 ]; then # but check that we output to a terminal export MSGCOLOR='NO' fi fi diff --git a/test/integration/run-tests b/test/integration/run-tests index 9dd550aa2..c39a2ac68 100755 --- a/test/integration/run-tests +++ b/test/integration/run-tests @@ -22,7 +22,7 @@ done export MSGLEVEL="${MSGLEVEL:-3}" if [ "$MSGCOLOR" != 'NO' ]; then - if ! expr match "$(readlink -f /proc/$$/fd/1)" '/dev/pts/[0-9]\+' > /dev/null; then + if [ ! -t 1 ]; then # but check that we output to a terminal export MSGCOLOR='NO' fi fi -- cgit v1.2.3-70-g09d2