Author: rfm
Date: Mon Jan 19 13:32:19 2015
New Revision: 38298
URL: http://svn.gna.org/viewcvs/gnustep?rev=38298&view=rev
Log:
improve reporting of completed sets
Modified:
tools/make/trunk/ChangeLog
tools/make/trunk/TestFramework/Testing.h
tools/make/trunk/TestFramework/gnustep-tests.in
Modified: tools/make/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/tools/make/trunk/ChangeLog?rev=38298&r1=38297&r2=38298&view=diff
==============================================================================
--- tools/make/trunk/ChangeLog (original)
+++ tools/make/trunk/ChangeLog Mon Jan 19 13:32:19 2015
@@ -1,3 +1,9 @@
+2015-01-19 Richard Frith-Macdonald <[email protected]>
+
+ * TestFramework/gnustep-tests.in: Report abandoned files as failed.
+ * TestFramework/Testing.h: Add timing of the duration of sets and a
+ hook to perform additional reporting etc on set end.
+
2015-01-15 Richard Frith-Macdonald <[email protected]>
* TestFramework/gnustep-tests.in: Check status of Start.sh script so
Modified: tools/make/trunk/TestFramework/Testing.h
URL:
http://svn.gna.org/viewcvs/gnustep/tools/make/trunk/TestFramework/Testing.h?rev=38298&r1=38297&r2=38298&view=diff
==============================================================================
--- tools/make/trunk/TestFramework/Testing.h (original)
+++ tools/make/trunk/TestFramework/Testing.h Mon Jan 19 13:32:19 2015
@@ -24,6 +24,7 @@
#include <stdarg.h>
#import <Foundation/NSAutoreleasePool.h>
+#import <Foundation/NSDate.h>
#import <Foundation/NSException.h>
#import <Foundation/NSGarbageCollector.h>
#import <Foundation/NSObjCRuntime.h>
@@ -75,6 +76,21 @@
*/
static NSException *testRaised __attribute__((unused)) = nil;
+/* The setEnded function pointer may be set to a function which is to be
+ * executed when the set ends, with its three parameters being the name
+ * of the set, a flag to say whether the set completed successfully, and
+ * the duration of the set.
+ * The SET_TIMER() macro turns on/off timing and, if timeing was
+ * already on, adds the time of the current period to the duration.
+ */
+static void (*setEnded)(const char *name, BOOL completed, double duration) = 0;
+#define SET_TIMER(active) \
+({ \
+ double started = _setTiming; \
+ _setTiming = [NSDate timeIntervalSinceReferenceDate]; \
+ if (started > 0.0) setDuration += _setTiming - started; \
+ if (NO == active) _setTiming = 0.0; \
+})\
/* The pass() function is the low-level core of the testsuite.
@@ -420,9 +436,16 @@
/* The START_SET() macro starts a set of grouped tests. It must be matched
* by a corresponding END_SET() with the same string as an argument.
* The argument is a short description to be printed in the log on entry.
+ * The duration of each set is automatically timed (you can suspend/resume
+ * timing using the SET_TIMER macro). Each timed period is added to the
+ * setDuration local variable while a set is executing (you can of course
+ * modify this variable using code inside the set).
*/
#define START_SET(setName) \
{ \
+ double setDuration = 0.0; \
+ BOOL _setSuccess = YES; \
+ double _setTiming = [NSDate timeIntervalSinceReferenceDate]; \
BOOL _save_hopeful = testHopeful; \
unsigned _save_indentation = testIndentation; \
int _save_line = __LINE__; \
@@ -452,11 +475,16 @@
/* The END_SET() macro terminates a set of grouped tests. It must be matched
* by a corresponding START_SET() with the same string as an argument.
* The argument is a short description to be printed in the log on entry.
+ * When a set ends, the function pointed to by the setEnded function is
+ * called with three arguments which allow you to perform extra reporting
+ * or cleanup etc. The three arguments are the set name, a flag to say
+ * whether the set completed successfully, and the duration of the set.
*/
#define END_SET(setName) \
} \
[_setPool release]; \
NS_HANDLER \
+ _setSuccess = NO; \
if (YES == [[localException name] isEqualToString: @"SkipSet"]) \
{ \
fprintf(stderr, "Skipped set: "); \
@@ -487,6 +515,8 @@
} \
} \
NS_ENDHANDLER \
+ SET_TIMER(NO); \
+ if (0 != setEnded) (*setEnded)(setName, _setSuccess, setDuration); \
if (strcmp(_save_set, setName) != 0) \
fprintf(stderr, "Error: %s:%d ... END(%s) with START(%s).\n", \
__FILE__, __LINE__, setName, _save_set); \
Modified: tools/make/trunk/TestFramework/gnustep-tests.in
URL:
http://svn.gna.org/viewcvs/gnustep/tools/make/trunk/TestFramework/gnustep-tests.in?rev=38298&r1=38297&r2=38298&view=diff
==============================================================================
--- tools/make/trunk/TestFramework/gnustep-tests.in (original)
+++ tools/make/trunk/TestFramework/gnustep-tests.in Mon Jan 19 13:32:19 2015
@@ -540,20 +540,21 @@
STARTSCRIPTSTATUS=0
fi
+ # Get the names of all the source files in the current directory.
+ if test x"$TESTS" = x
+ then
+ if test x"$OBJCXX" = x
+ then
+ # Only Objective-C (and C)
+ TESTS=`find . \( -name . -o -prune \) \( -name "*.m" -o -name "*.c"
\) | sed -e 's;^.*/;;' | sort -u | sed -e 's/\(^\| \)X[^ ]*//g'`
+ else
+ # Objective-C and Objective-C++ (implicitly C and C++ too)
+ TESTS=`find . \( -name . -o -prune \) \( -name "*.m" -o -name "*.mm"
-name "*.c" -o -name "*.cc" \) | sed -e 's;^.*/;;' | sort -u | sed -e 's/\(^\|
\)X[^ ]*//g'`
+ fi
+ fi
+
if test $STARTSCRIPTSTATUS = 0
then
- # Get the names of all the source files in the current directory.
- if test x"$TESTS" = x
- then
- if test x"$OBJCXX" = x
- then
- # Only Objective-C (and C)
- TESTS=`find . \( -name . -o -prune \) \( -name "*.m" -o -name
"*.c" \) | sed -e 's;^.*/;;' | sort -u | sed -e 's/\(^\| \)X[^ ]*//g'`
- else
- # Objective-C and Objective-C++ (implicitly C and C++ too)
- TESTS=`find . \( -name . -o -prune \) \( -name "*.m" -o -name
"*.mm" -name "*.c" -o -name "*.cc" \) | sed -e 's;^.*/;;' | sort -u | sed -e
's/\(^\| \)X[^ ]*//g'`
- fi
- fi
if test -r GNUmakefile.tests
then
@@ -645,6 +646,10 @@
done
else
echo "Start.sh failed in '$TESTDIR' ... tests abandoned."
+ for TESTFILE in $TESTS
+ do
+ echo "Failed file: $TESTFILE aborted without running any tests!"
| tee -a $GSTESTSUM >> $GSTESTLOG
+ done
fi
TESTS=
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs