gnome-shell/tests/run-test.sh.in
Owen W. Taylor 3c646ec516 run-test.sh: support running tests under gdb
As with the 'gnome-shell' -g/--debug can be passed to run under
the debugger.

https://bugzilla.gnome.org/show_bug.cgi?id=595987
2009-10-01 14:41:18 -04:00

49 lines
946 B
Bash

#!/bin/sh
usage() {
echo >&2 "Usage run-test.sh [-v|--verbose] <test_js>..."
exit 1
}
tests=
verbose=false
debug=
for arg in $@ ; do
case $arg in
-g|--debug)
debug="gdb --args"
;;
-v|--verbose)
verbose=true
;;
-*)
usage
;;
*)
tests="$tests $arg"
;;
esac
done
builddir=`dirname $0`
builddir=`cd $builddir && pwd`
srcdir=$builddir/@srcdir@
srcdir=`cd $srcdir && pwd`
GI_TYPELIB_PATH="@MUTTER_LIB_DIR@/mutter:$builddir/../src"
GJS_DEBUG_OUTPUT=stderr
$verbose || GJS_DEBUG_TOPICS="JS ERROR;JS LOG"
GNOME_SHELL_TESTSDIR="$srcdir/"
LD_PRELOAD="$builddir/../src/.libs/libgnome-shell.so"
export GI_TYPELIB_PATH GJS_DEBUG_OUTPUT GJS_DEBUG_TOPICS GNOME_SHELL_JS GNOME_SHELL_TESTSDIR LD_PRELOAD
gjs_args=
for i in $srcdir $srcdir/../js @GJS_JS_DIR@ @GJS_JS_NATIVE_DIR@ ; do
gjs_args="$gjs_args -I $i"
done
for test in $tests ; do
$debug gjs-console $gjs_args $test || exit $?
done