mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
0b1ba00b00
Long story: This was triggered by the addition of the test_trust_ntlm.sh script in commits3caca9b
and2de1994
. test_trust_ntlm.sh creates a variable CREDS="$REALM\\$USERNAME%$PASSWORD" that is then used as part of the test name. subunit.sh uses echo to print the name that is then picked up by subunithelper.py. test_trust_ntlm.sh also uses /bin/sh as shell which can be a POSIX compliant shell like dash. This combination broke 'make test' for any username starting with the letter c. In this case CREDS contains the escape sequence \c that is defined to stop producing further output at this point. dash implements this feature and the echo in subunit.sh as a result skips the output after \c, including skipping the newline. This means that the data received by subunithelper.py contains the timestamp from the next line in the test name, which then breaks the testcase tracking. Fix this by replacing the echo in subunit.sh with a printf that does not trigger the special handling of escape characters. Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Fri May 5 23:44:16 CEST 2017 on sn-devel-144
122 lines
3.1 KiB
Bash
Executable File
122 lines
3.1 KiB
Bash
Executable File
#
|
|
# subunit.sh: shell functions to report test status via the subunit protocol.
|
|
# Copyright (C) 2006 Robert Collins <robertc@robertcollins.net>
|
|
# Copyright (C) 2008 Jelmer Vernooij <jelmer@samba.org>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the Free Software
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
#
|
|
|
|
timestamp() {
|
|
# mark the start time. With Gnu date, you get nanoseconds from %N
|
|
# (here truncated to microseconds with %6N), but not on BSDs,
|
|
# Solaris, etc, which will apparently leave either %N or N at the end.
|
|
date -u +'time: %Y-%m-%d %H:%M:%S.%6NZ' | sed 's/\..*NZ$/.000000Z/'
|
|
}
|
|
|
|
subunit_start_test () {
|
|
# emit the current protocol start-marker for test $1
|
|
timestamp
|
|
printf 'test: %s\n' "$1"
|
|
}
|
|
|
|
|
|
subunit_pass_test () {
|
|
# emit the current protocol test passed marker for test $1
|
|
timestamp
|
|
printf 'success: %s\n' "$1"
|
|
}
|
|
|
|
# This is just a hack as we have some broken scripts
|
|
# which use "exit $failed", without initializing failed.
|
|
failed=0
|
|
|
|
subunit_fail_test () {
|
|
# emit the current protocol fail-marker for test $1, and emit stdin as
|
|
# the error text.
|
|
# we use stdin because the failure message can be arbitrarily long, and this
|
|
# makes it convenient to write in scripts (using <<END syntax.
|
|
timestamp
|
|
printf 'failure: %s [\n' "$1"
|
|
cat -
|
|
echo "]"
|
|
}
|
|
|
|
|
|
subunit_error_test () {
|
|
# emit the current protocol error-marker for test $1, and emit stdin as
|
|
# the error text.
|
|
# we use stdin because the failure message can be arbitrarily long, and this
|
|
# makes it convenient to write in scripts (using <<END syntax.
|
|
timestamp
|
|
printf 'error: %s [\n' "$1"
|
|
cat -
|
|
echo "]"
|
|
}
|
|
|
|
subunit_skip_test () {
|
|
# emit the current protocol skip-marker for test $1, and emit stdin as
|
|
# the error text.
|
|
# we use stdin because the failure message can be arbitrarily long, and this
|
|
# makes it convenient to write in scripts (using <<END syntax.
|
|
printf 'skip: %s [\n' "$1"
|
|
cat -
|
|
echo "]"
|
|
}
|
|
|
|
testit () {
|
|
name="$1"
|
|
shift
|
|
cmdline="$@"
|
|
subunit_start_test "$name"
|
|
output=`$cmdline 2>&1`
|
|
status=$?
|
|
if [ x$status = x0 ]; then
|
|
subunit_pass_test "$name"
|
|
else
|
|
echo "$output" | subunit_fail_test "$name"
|
|
fi
|
|
return $status
|
|
}
|
|
|
|
testit_expect_failure () {
|
|
name="$1"
|
|
shift
|
|
cmdline="$@"
|
|
subunit_start_test "$name"
|
|
output=`$cmdline 2>&1`
|
|
status=$?
|
|
if [ x$status = x0 ]; then
|
|
echo "$output" | subunit_fail_test "$name"
|
|
else
|
|
subunit_pass_test "$name"
|
|
fi
|
|
return $status
|
|
}
|
|
|
|
testok () {
|
|
name=`basename $1`
|
|
failed=$2
|
|
|
|
exit $failed
|
|
}
|
|
|
|
# work out the top level source directory
|
|
if [ -d source4 ]; then
|
|
SRCDIR="."
|
|
else
|
|
SRCDIR=".."
|
|
fi
|
|
export SRCDIR
|