1. Jop de Klein
  2. snap

Source

snap / test / lib / run_testdriver.sh

#!/bin/bash
# directory to write output XML (if this doesn't exist, the results will not be generated!)
OUTPUT_DIR="test-reports"
mkdir -p $OUTPUT_DIR

XVFB=`which Xvfb`
if [ "$?" -eq 1 ];
then
	echo "Xvfb not found."
	exit 1
fi

FIREFOX=`which firefox`
if [ "$?" -eq 1 ];
then
	echo "Firefox not found, using default for Mac"
	FIREFOX="/Applications/Firefox.app/Contents/MacOS/firefox-bin"
	# exit 1
fi

$XVFB :99 -ac &	   # launch virtual framebuffer into the background
PID_XVFB="$!"	   # take the process ID
export DISPLAY=:99 # set display to use that of the xvfb

# run the tests
java -jar test/lib/JsTestDriver-1.2.2.jar --config test/lib/jsTestDriver.conf --port 4224 --browser $FIREFOX --tests all --testOutput $OUTPUT_DIR --reset
TEST_STATUS_CODE="$?"

kill $PID_XVFB	   # shut down xvfb (firefox will shut down cleanly by JsTestDriver)
echo "Done."
exit ${TEST_STATUS_CODE}