benchmarks/benchmark-runner.st
branchdirectory_structure_refactoring
changeset 1818 2e5ed72e7dfd
parent 1768 6de9d844630d
child 2380 9195eccdcbd9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/benchmarks/benchmark-runner.st	Thu Nov 15 22:10:02 2012 +0000
@@ -0,0 +1,37 @@
+| pp wd i p |
+
+"Search for package path, bit hacky but..."
+wd := Filename currentDirectory.
+pp := nil.
+p := wd.
+i := 10."How many super-directories try"
+[i > 0 and:[pp == nil]] whileTrue:[
+        p := p / '..'. i := i - 1.
+        ((p / 'stx' / 'libbasic') exists and:[(p / 'stx' / 'libcomp') exists])
+                ifTrue:[pp := p]].
+pp
+        ifNil:
+                [Stderr nextPutAll: 'ERROR: Cannot find package path'.
+                Smalltalk exit: 16]
+        ifNotNil:
+                [Smalltalk packagePath add: pp pathName].
+
+(Smalltalk commandLineArguments includes:'--debug') ifTrue:[
+    Stderr nextPutAll:'Package path:'; cr.
+    Smalltalk packagePath do:[:each|
+       Stderr nextPutAll:'  '; nextPutAll: each; cr.
+    ].
+
+    Smalltalk beHeadless: (OperatingSystem getEnvironment: 'DISPLAY') isNil.
+] ifFalse: [
+	Smalltalk beHeadless: true.
+].
+
+(Smalltalk at:#'JavaBenchmarkRunner') isNil ifTrue:[
+    (Smalltalk loadPackage: 'stx:libjava/benchmarks') ifFalse:[
+        Stderr nextPutAll:'ERROR: cannot load stx:libjava/benchmarks.'.
+        Smalltalk exit: 17
+    ].
+].
+
+Smalltalk addStartBlock:[(Smalltalk at:#'JavaBenchmarkRunner') start].