JuliaLang/julia — pull request #7846 by tkelman (2014-08-05 07:44:52+00:00)
Title: make running the test suite slightly easier

- default to running all tests if no command-line arguments provided
- cd to the test directory, then back when finished
- use at most half of the cpu cores when no command-line arguments given

This is a "lite" version of #7748. Now there will be several relatively simple ways to run the test suite, which I think we should encourage users to do via a note on the download page.
- From command line `julia /path/to/share/julia/test/runtests.jl`
- From inside Julia `include(joinpath(JULIA_HOME,"../share/julia/test/runtests.jl"))`
- From inside Julia `Pkg.test(joinpath(JULIA_HOME,"../share/julia"))` - a pun since base Julia isn't really a package, but slightly shorter

I went for half the cores on the users' machine (rounded up) for the case when `isempty(ARGS)` rather than all minus one ([as suggested by Jeff](https://github.com/JuliaLang/julia/pull/7748#issuecomment-50300630)) since lots of machines have hyperthreading enabled these days. That tends to lead to oversubscription, and in the case of my laptop overheating, half the reported number of logical cores is probably closer to the actual number of physical cores than all minus 1.

Returning to the starting directory could be done more robustly, with something like a try-finally or a do-block of some kind, I'm open to suggestions for improving it.