| 1 |
# |
| 2 |
# subunit.sh: shell functions to report test status via the subunit protocol. |
| 3 |
# Copyright (C) 2006 Robert Collins <[email protected]> |
| 4 |
# |
| 5 |
# Licensed under either the Apache License, Version 2.0 or the BSD 3-clause |
| 6 |
# license at the users choice. A copy of both licenses are available in the |
| 7 |
# project source as Apache-2.0 and BSD. You may not use this file except in |
| 8 |
# compliance with one of these two licences. |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under these licenses is distributed on an "AS IS" BASIS, WITHOUT |
| 12 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 |
# license you chose for the specific language governing permissions and |
| 14 |
# limitations under that license. |
| 15 |
# |
| 16 |
|
| 17 |
subunit_start_test () { |
| 18 |
# emit the current protocol start-marker for test $1 |
| 19 |
echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" |
| 20 |
echo "test: $1" |
| 21 |
} |
| 22 |
|
| 23 |
|
| 24 |
subunit_pass_test () { |
| 25 |
# emit the current protocol test passed marker for test $1 |
| 26 |
echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" |
| 27 |
echo "success: $1" |
| 28 |
} |
| 29 |
|
| 30 |
|
| 31 |
subunit_fail_test () { |
| 32 |
# emit the current protocol fail-marker for test $1, and emit stdin as |
| 33 |
# the error text. |
| 34 |
# we use stdin because the failure message can be arbitrarily long, and this |
| 35 |
# makes it convenient to write in scripts (using <<END syntax. |
| 36 |
echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" |
| 37 |
echo "failure: $1 [" |
| 38 |
cat - |
| 39 |
echo "]" |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
subunit_error_test () { |
| 44 |
# emit the current protocol error-marker for test $1, and emit stdin as |
| 45 |
# the error text. |
| 46 |
# we use stdin because the failure message can be arbitrarily long, and this |
| 47 |
# makes it convenient to write in scripts (using <<END syntax. |
| 48 |
echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" |
| 49 |
echo "error: $1 [" |
| 50 |
cat - |
| 51 |
echo "]" |
| 52 |
} |
| 53 |
|
| 54 |
|
| 55 |
subunit_skip_test () { |
| 56 |
# emit the current protocol test skipped marker for test $1 |
| 57 |
echo "time: `date -u '+%Y-%m-%d %H:%M:%SZ'`" |
| 58 |
echo "skip: $1" |
| 59 |
} |
| 60 |
|
| 61 |
|