Check for empty benchmarksuite in batch benchmark runner
If the suite is empty, report an error.
--- a/s/BenchmarkCountingInstrument.st Wed Sep 30 06:18:20 2015 +0100
+++ b/s/BenchmarkCountingInstrument.st Wed Sep 30 09:03:50 2015 +0100
@@ -9,6 +9,7 @@
category:'CalipeL-S-Core-Measurement'
!
+
!BenchmarkCountingInstrument class methodsFor:'queries'!
isAbstract
@@ -66,3 +67,10 @@
"Created: / 27-11-2014 / 12:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!BenchmarkCountingInstrument class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- a/s/BenchmarkInstance.st Wed Sep 30 06:18:20 2015 +0100
+++ b/s/BenchmarkInstance.st Wed Sep 30 09:03:50 2015 +0100
@@ -454,6 +454,38 @@
"Modified: / 07-06-2013 / 02:08:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!BenchmarkInstance methodsFor:'testing'!
+
+isEmpty
+ "Return true, if this benchmark suite contains no benchmarks. Defined
+ here to make it polymorph with BenchmarkSuite."
+
+ ^ false
+
+ "Created: / 30-09-2015 / 08:31:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isEmptyOrNil
+ ^ self isEmpty
+
+ "Created: / 30-09-2015 / 08:30:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+notEmpty
+ "Return true, if this benchmark suite contains at least one benchmark. Defined
+ here to make it polymorph with BenchmarkSuite"
+
+ ^ self isEmpty not
+
+ "Created: / 30-09-2015 / 08:34:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+notEmptyOrNil
+ ^ self notEmpty
+
+ "Created: / 30-09-2015 / 08:34:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!BenchmarkInstance class methodsFor:'documentation'!
version_HG
--- a/s/BenchmarkRunner.st Wed Sep 30 06:18:20 2015 +0100
+++ b/s/BenchmarkRunner.st Wed Sep 30 09:03:50 2015 +0100
@@ -193,7 +193,6 @@
]
].
-
classes isEmpty ifTrue:[
self error:'No suite or benchmark specified.'
].
@@ -223,6 +222,10 @@
]
].
+ suite isEmpty ifTrue:[
+ self error: 'No benchmarks to run (suite is empty)'
+ ].
+
"Run setup, if any"
setup notNil ifTrue:[ Compiler evaluate: setup ].
setupScript notNil ifTrue:[ Compiler evaluate: setupScript asFilename contents asString ].
@@ -253,7 +256,7 @@
teardown notNil ifTrue:[ Compiler evaluate: teardown ].
teardownScript notNil ifTrue:[ Compiler evaluate: teardownScript asFilename contents asString ].
- "Modified: / 18-09-2015 / 09:17:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (format): / 30-09-2015 / 08:49:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
options
--- a/s/BenchmarkSuite.st Wed Sep 30 06:18:20 2015 +0100
+++ b/s/BenchmarkSuite.st Wed Sep 30 09:03:50 2015 +0100
@@ -100,6 +100,37 @@
"Modified: / 01-08-2013 / 19:09:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
+!BenchmarkSuite methodsFor:'testing'!
+
+isEmpty
+ "Return true, if this benchmark suite contains no benchmarks"
+
+ benchmarks do:[:benchmark | benchmark isEmpty ifFalse:[ ^ false ] ].
+ ^ true
+
+ "Created: / 30-09-2015 / 08:29:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+isEmptyOrNil
+ ^ self isEmpty
+
+ "Created: / 30-09-2015 / 08:28:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+notEmpty
+ "Return true, if this benchmark suite contains at least one benchmark"
+
+ ^ self isEmpty not
+
+ "Created: / 30-09-2015 / 08:34:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+notEmptyOrNil
+ ^ self notEmpty
+
+ "Created: / 30-09-2015 / 08:34:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
!BenchmarkSuite class methodsFor:'documentation'!
version_HG
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/s/tests/BenchmarkSuiteTests.st Wed Sep 30 09:03:50 2015 +0100
@@ -0,0 +1,37 @@
+"{ Package: 'jv:calipel/s/tests' }"
+
+"{ NameSpace: Smalltalk }"
+
+TestCase subclass:#BenchmarkSuiteTests
+ instanceVariableNames:''
+ classVariableNames:''
+ poolDictionaries:''
+ category:'CalipeL-S-Tests'
+!
+
+!BenchmarkSuiteTests methodsFor:'tests'!
+
+test_isEmpty
+ | suite |
+
+ suite := BenchmarkSuite class: self class.
+ self assert: suite isEmptyOrNil.
+ self assert: suite isEmpty.
+
+ suite := BenchmarkSuite class: BenchmarkTestsSuiteA.
+ self assert: suite notEmptyOrNil.
+ self assert: suite notEmpty.
+
+ suite := BenchmarkSuite new.
+ suite addBenchmark: (BenchmarkSuite class: self class).
+ self assert: suite isEmptyOrNil.
+ self assert: suite isEmpty.
+
+ suite := BenchmarkSuite new.
+ suite addBenchmark: (BenchmarkSuite class:BenchmarkTestsSuiteA).
+ self assert: suite notEmptyOrNil.
+ self assert: suite notEmpty.
+
+ "Created: / 30-09-2015 / 08:32:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/s/tests/Make.proto Wed Sep 30 06:18:20 2015 +0100
+++ b/s/tests/Make.proto Wed Sep 30 09:03:50 2015 +0100
@@ -128,6 +128,7 @@
$(OUTDIR)BenchmarkInstanceTestsA.$(O) BenchmarkInstanceTestsA.$(H): BenchmarkInstanceTestsA.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkReportJSONWriterTests.$(O) BenchmarkReportJSONWriterTests.$(H): BenchmarkReportJSONWriterTests.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkRunnerTests.$(O) BenchmarkRunnerTests.$(H): BenchmarkRunnerTests.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)BenchmarkSuiteTests.$(O) BenchmarkSuiteTests.$(H): BenchmarkSuiteTests.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestCase.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkTestsLog.$(O) BenchmarkTestsLog.$(H): BenchmarkTestsLog.st $(INCLUDE_TOP)/stx/goodies/sunit/TestAsserter.$(H) $(INCLUDE_TOP)/stx/goodies/sunit/TestResource.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkTestsSuiteA.$(O) BenchmarkTestsSuiteA.$(H): BenchmarkTestsSuiteA.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkTestsSuiteB.$(O) BenchmarkTestsSuiteB.$(H): BenchmarkTestsSuiteB.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
--- a/s/tests/Make.spec Wed Sep 30 06:18:20 2015 +0100
+++ b/s/tests/Make.spec Wed Sep 30 09:03:50 2015 +0100
@@ -54,6 +54,7 @@
BenchmarkInstanceTestsA \
BenchmarkReportJSONWriterTests \
BenchmarkRunnerTests \
+ BenchmarkSuiteTests \
BenchmarkTestsLog \
BenchmarkTestsSuiteA \
BenchmarkTestsSuiteB \
@@ -68,6 +69,7 @@
$(OUTDIR_SLASH)BenchmarkInstanceTestsA.$(O) \
$(OUTDIR_SLASH)BenchmarkReportJSONWriterTests.$(O) \
$(OUTDIR_SLASH)BenchmarkRunnerTests.$(O) \
+ $(OUTDIR_SLASH)BenchmarkSuiteTests.$(O) \
$(OUTDIR_SLASH)BenchmarkTestsLog.$(O) \
$(OUTDIR_SLASH)BenchmarkTestsSuiteA.$(O) \
$(OUTDIR_SLASH)BenchmarkTestsSuiteB.$(O) \
--- a/s/tests/abbrev.stc Wed Sep 30 06:18:20 2015 +0100
+++ b/s/tests/abbrev.stc Wed Sep 30 09:03:50 2015 +0100
@@ -4,6 +4,7 @@
BenchmarkInstanceTestsA BenchmarkInstanceTestsA jv:calipel/s/tests 'CalipeL-S-Tests' 1
BenchmarkReportJSONWriterTests BenchmarkReportJSONWriterTests jv:calipel/s/tests 'CalipeL-S-Tests' 1
BenchmarkRunnerTests BenchmarkRunnerTests jv:calipel/s/tests 'CalipeL-S-Tests' 1
+BenchmarkSuiteTests BenchmarkSuiteTests jv:calipel/s/tests 'CalipeL-S-Tests' 1
BenchmarkTestsLog BenchmarkTestsLog jv:calipel/s/tests 'CalipeL-S-Tests-Data' 1
BenchmarkTestsSuiteA BenchmarkTestsSuiteA jv:calipel/s/tests 'CalipeL-S-Tests-Data' 0
BenchmarkTestsSuiteB BenchmarkTestsSuiteB jv:calipel/s/tests 'CalipeL-S-Tests-Data' 0
--- a/s/tests/bc.mak Wed Sep 30 06:18:20 2015 +0100
+++ b/s/tests/bc.mak Wed Sep 30 09:03:50 2015 +0100
@@ -75,6 +75,7 @@
$(OUTDIR)BenchmarkInstanceTestsA.$(O) BenchmarkInstanceTestsA.$(H): BenchmarkInstanceTestsA.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkReportJSONWriterTests.$(O) BenchmarkReportJSONWriterTests.$(H): BenchmarkReportJSONWriterTests.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkRunnerTests.$(O) BenchmarkRunnerTests.$(H): BenchmarkRunnerTests.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)BenchmarkSuiteTests.$(O) BenchmarkSuiteTests.$(H): BenchmarkSuiteTests.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestCase.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkTestsLog.$(O) BenchmarkTestsLog.$(H): BenchmarkTestsLog.st $(INCLUDE_TOP)\stx\goodies\sunit\TestAsserter.$(H) $(INCLUDE_TOP)\stx\goodies\sunit\TestResource.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkTestsSuiteA.$(O) BenchmarkTestsSuiteA.$(H): BenchmarkTestsSuiteA.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
$(OUTDIR)BenchmarkTestsSuiteB.$(O) BenchmarkTestsSuiteB.$(H): BenchmarkTestsSuiteB.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
--- a/s/tests/jv_calipel_s_tests.st Wed Sep 30 06:18:20 2015 +0100
+++ b/s/tests/jv_calipel_s_tests.st Wed Sep 30 09:03:50 2015 +0100
@@ -72,6 +72,7 @@
BenchmarkInstanceTestsA
BenchmarkReportJSONWriterTests
BenchmarkRunnerTests
+ BenchmarkSuiteTests
BenchmarkTestsLog
BenchmarkTestsSuiteA
BenchmarkTestsSuiteB
--- a/s/tests/libInit.cc Wed Sep 30 06:18:20 2015 +0100
+++ b/s/tests/libInit.cc Wed Sep 30 09:03:50 2015 +0100
@@ -30,6 +30,7 @@
_BenchmarkInstanceTestsA_Init(pass,__pRT__,snd);
_BenchmarkReportJSONWriterTests_Init(pass,__pRT__,snd);
_BenchmarkRunnerTests_Init(pass,__pRT__,snd);
+_BenchmarkSuiteTests_Init(pass,__pRT__,snd);
_BenchmarkTestsLog_Init(pass,__pRT__,snd);
_BenchmarkTestsSuiteA_Init(pass,__pRT__,snd);
_BenchmarkTestsSuiteB_Init(pass,__pRT__,snd);