Only print stats with environment variable in JreEmulation test app (faster).
Change on 2017/04/18 by tball
@implementation JRETestRunListener
+static BOOL printStats = NO;
+
++ (void)initialize {
+ printStats = getenv("JUNIT_PRINT_STATS");
+}
+
vm_size_t usedMemory(void) {
struct task_basic_info info;
mach_msg_type_number_t size = sizeof(info);
@@ -62,22 +68,29 @@ NSString *memUsage() {
}
- (void)testRunStartedWithOrgJunitRunnerDescription:(OrgJunitRunnerDescription *)description_ {
+ if (printStats) {
NSLog(@"test run started");
}
+}
- (void)testRunFinishedWithOrgJunitRunnerResult:(OrgJunitRunnerResult *)result {
+ if (printStats) {
NSLog(@"test run finished %@", memUsage());
}
+}
- (void)testStartedWithOrgJunitRunnerDescription:(OrgJunitRunnerDescription *)description_ {
+ if (printStats) {
NSLog(@"%@.%@", [[description_ getTestClass] getSimpleName], [description_ getMethodName]);
self.startTime = CACurrentMediaTime();
}
+}
- (void)testFinishedWithOrgJunitRunnerDescription:(OrgJunitRunnerDescription *)description_{
+ if (printStats) {
CFTimeInterval elapsedTime = CACurrentMediaTime() - self.startTime;
NSLog(@" %.3f secs%@", elapsedTime, memUsage());
}
-
+}
@end
