Sable/Ostrich — pull request #2 by isbadawi (2014-05-30 02:50:24+00:00)
Title: Refactor dwarf_runner.

Summary of changes:

* Removed WebbenchThread (apparently not used).
* Factored out OS-specific bits into `OsxEnvironment` and `LinuxEnvironment`
classes, each providing a `provision_browser(browser, url)` context manager,
which are passed into `Benchmark`.
* Added a neato `cd()` context manager on `Benchmark`, allowing you to write
`with self.cd():`
* Turned `run_c_benchmark` and `run_js_benchmark` into generators
* Simplified options parsing a bit; `optparse` allows you to set defaults, and
a `%default` placeholder in the help text expands to the default value.
(Also removed global variables, instead passing options where they need to go).
* Reduced duplication in the environments; specify each environment as a tuple
of language, browser, and function taking a benchmark and returning a generator
of the results.

n.b. I use dicts for specifying benchmarks and environments where previously
lists were used, so order is not necessarily preserved. If this matters to you,
you should use `collections.OrderedDict`s instead.

n.b. I only did cursory testing of this, since e.g. I don't have emscripten
installed, and I am on OS X.