scripts/contrib/build-perf-test-wrapper.sh: Improve interaction with autobuilder automation
This tweaks the script to:
* Ensure directories exist and can be written to
* Allow the downloads directory to be specified
* Error early if the phantomjs or optipng dependencies are not installed
* Allow the location of the globalres.log file to be specified
This means that the main build directory can be destroyed and any state
from the script is stored elsewhere allowing it to be triggered
automatically from the autobuilder infrastructure.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>