benchmarks/benchmark-runner.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Wed, 22 May 2013 21:15:02 +0100
branchbuiltin-class-support
changeset 2618 e7757e5d593c
parent 2380 9195eccdcbd9
permissions -rw-r--r--
Initial attempt to generalized builtin class support.

| 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].