mirror of
https://github.com/gnustep/tools-make.git
synced 2025-05-31 17:31:24 +00:00
Add per-testcase timestamps with an option to disable them
This commit is contained in:
parent
7ea6ab208d
commit
e2df3f4a19
3 changed files with 43 additions and 9 deletions
|
@ -135,6 +135,10 @@ option to have testing stopped at the first failure and the gdb debugger
|
||||||
automatically launched to debug the failed testcase with a breakpoint set
|
automatically launched to debug the failed testcase with a breakpoint set
|
||||||
in the testStart() function for that testcase.
|
in the testStart() function for that testcase.
|
||||||
|
|
||||||
|
You can use the --notimestamps command line option to turn off timestamps of
|
||||||
|
individual testcases if you want a less verbose output (though test code may
|
||||||
|
override this default by setting the testTimestamps variable itself).
|
||||||
|
|
||||||
You can also use the --developer command line option to define the TESTDEV
|
You can also use the --developer command line option to define the TESTDEV
|
||||||
pre-processor variable (to turn on developer only test cases, and to have
|
pre-processor variable (to turn on developer only test cases, and to have
|
||||||
all 'hopes' treated as actual 'tests' with pass/fail results).
|
all 'hopes' treated as actual 'tests' with pass/fail results).
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* Testing - Include basic tests macros for the GNUstep Testsuite
|
/* Testing - Include basic tests macros for the GNUstep Testsuite
|
||||||
|
|
||||||
Copyright (C) 2005-2011 Free Software Foundation, Inc.
|
Copyright (C) 2005-2021 Free Software Foundation, Inc.
|
||||||
|
|
||||||
Written by: Alexander Malmberg <alexander@malmberg.org>
|
Written by: Alexander Malmberg <alexander@malmberg.org>
|
||||||
Updated by: Richard Frith-Macdonald <rfm@gnu.org>
|
Updated by: Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
@ -57,6 +57,15 @@ static BOOL testPassed __attribute__((unused)) = NO;
|
||||||
*/
|
*/
|
||||||
static unsigned testLineNumber __attribute__((unused)) = 0;
|
static unsigned testLineNumber __attribute__((unused)) = 0;
|
||||||
|
|
||||||
|
/* A flag indicating whether timestamps should be produced in the output
|
||||||
|
* for each testcase. By default it is set to TEST_TS if defined, but
|
||||||
|
* test code may override that default.
|
||||||
|
*/
|
||||||
|
#if !defined(TEST_TS)
|
||||||
|
#define TEST_TS 0
|
||||||
|
#endif
|
||||||
|
static BOOL testTimestamps __attribute__((unused)) = TEST_TS;
|
||||||
|
|
||||||
/* A variable storing the indentation of the set currently being run.
|
/* A variable storing the indentation of the set currently being run.
|
||||||
* Do not modify this directly.
|
* Do not modify this directly.
|
||||||
*/
|
*/
|
||||||
|
@ -104,7 +113,11 @@ static void (*setEnded)(const char *name, BOOL completed, double duration)
|
||||||
* The global variable 'testHopeful' can be set to a non-zero value before
|
* The global variable 'testHopeful' can be set to a non-zero value before
|
||||||
* calling this function in order to specify that if the condition is
|
* calling this function in order to specify that if the condition is
|
||||||
* not true it should be treated as a dashed hope rather than a failure
|
* not true it should be treated as a dashed hope rather than a failure
|
||||||
* (unless the tests are bing performed in 'developer' mode).
|
* (unless the tests are being performed in 'developer' mode).
|
||||||
|
*
|
||||||
|
* The global variable 'testTimestamps' can be set to a non-zero value before
|
||||||
|
* calling this function in order to specify that the output logged is to
|
||||||
|
* include the timestamp of the testcase completion (entry into this function).
|
||||||
*
|
*
|
||||||
* If there is a better higher-level test macro available, please use
|
* If there is a better higher-level test macro available, please use
|
||||||
* that instead. In particular, please use the PASS_EQUAL() macro wherever
|
* that instead. In particular, please use the PASS_EQUAL() macro wherever
|
||||||
|
@ -124,22 +137,30 @@ static void pass(int passed, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
|
const char *ts = "";
|
||||||
|
|
||||||
|
if (testTimestamps)
|
||||||
|
{
|
||||||
|
NSCalendarDate *d = [NSCalendarDate date];
|
||||||
|
|
||||||
|
[d setCalendarFormat: @"(%Y-%m-%d %H:%M:%S.%F %z) "];
|
||||||
|
ts = [[d description] cString];
|
||||||
|
}
|
||||||
if (passed)
|
if (passed)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Passed test: ");
|
fprintf(stderr, "Passed test: %s", ts);
|
||||||
testPassed = YES;
|
testPassed = YES;
|
||||||
}
|
}
|
||||||
#if !defined(TESTDEV)
|
#if !defined(TESTDEV)
|
||||||
else if (YES == testHopeful)
|
else if (YES == testHopeful)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Dashed hope: ");
|
fprintf(stderr, "Dashed hope: %s", ts);
|
||||||
testPassed = NO;
|
testPassed = NO;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Failed test: ");
|
fprintf(stderr, "Failed test: %s", ts);
|
||||||
testPassed = NO;
|
testPassed = NO;
|
||||||
}
|
}
|
||||||
testIndent();
|
testIndent();
|
||||||
|
|
|
@ -77,6 +77,9 @@ do
|
||||||
--sequential)
|
--sequential)
|
||||||
GSSEQUENTIAL=yes
|
GSSEQUENTIAL=yes
|
||||||
;;
|
;;
|
||||||
|
--notimestamps)
|
||||||
|
GSTEST_TS=0
|
||||||
|
;;
|
||||||
--verbose)
|
--verbose)
|
||||||
GSVERBOSE=yes
|
GSVERBOSE=yes
|
||||||
;;
|
;;
|
||||||
|
@ -96,6 +99,7 @@ do
|
||||||
echo "Use 'gnustep-tests --developer' to treat hopes as real tests."
|
echo "Use 'gnustep-tests --developer' to treat hopes as real tests."
|
||||||
echo "Use 'gnustep-tests --verbose' for full/detailed log output."
|
echo "Use 'gnustep-tests --verbose' for full/detailed log output."
|
||||||
echo "Use 'gnustep-tests --sequential' to disable parallel building."
|
echo "Use 'gnustep-tests --sequential' to disable parallel building."
|
||||||
|
echo "Use 'gnustep-tests --notimestamps' to disable testcase timestamps."
|
||||||
echo
|
echo
|
||||||
echo "Interpreting the output"
|
echo "Interpreting the output"
|
||||||
echo "-----------------------"
|
echo "-----------------------"
|
||||||
|
@ -154,18 +158,23 @@ else
|
||||||
OBJCXX=
|
OBJCXX=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
GSTESTFLAGS=
|
if test x"$GSTEST_TS" = x"no"
|
||||||
|
then
|
||||||
|
GSTESTFLAGS="-DTEST_TS=0"
|
||||||
|
else
|
||||||
|
GSTESTFLAGS="-DTEST_TS=1"
|
||||||
|
fi
|
||||||
if test "$GSTESTMODE" = "failfast"
|
if test "$GSTESTMODE" = "failfast"
|
||||||
then
|
then
|
||||||
if test x"$GSTESTDEV" = x"yes"
|
if test x"$GSTESTDEV" = x"yes"
|
||||||
then
|
then
|
||||||
GSTESTFLAGS="-DTESTDEV=1 -DFAILFAST=1"
|
GSTESTFLAGS="$GSTESTFLAGS -DTESTDEV=1 -DFAILFAST=1"
|
||||||
else
|
else
|
||||||
GSTESTFLAGS="-DFAILFAST=1"
|
GSTESTFLAGS="$GSTESTFLAGS -DFAILFAST=1"
|
||||||
fi
|
fi
|
||||||
elif test x"$GSTESTDEV" = x"yes"
|
elif test x"$GSTESTDEV" = x"yes"
|
||||||
then
|
then
|
||||||
GSTESTFLAGS="-DTESTDEV=1"
|
GSTESTFLAGS="$GSTESTFLAGS -DTESTDEV=1"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$GSTESTFLAGS" != x
|
if test x"$GSTESTFLAGS" != x
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue