LUCENE-10528: use Xvfb in test to avoid messing up user's desktop (#828)

Co-authored-by: Tomoko Uchida <tomoko.uchida.1111@gmail.com>
This commit is contained in:
Robert Muir 2022-04-23 08:00:33 -04:00 committed by GitHub
parent 35ca2d79f7
commit 1089b482fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View File

@ -128,6 +128,24 @@ specifying the project and test task or a fully qualified task path. Example:
gradlew -p lucene/core test -Ptests.verbose=true --tests "TestDemo"
Run GUI tests headlessly with Xvfb (Linux only)
-----------------------------------------------
GUI test for Luke application launches a window, this might mess up your
monitor depending on the display manager you are using. In that case,
you can install Xvfb (X Virtual Frame Buffer) so that the test runs on the
virtual display and does not open a real window.
# redhat-type OS
$ sudo yum install Xvfb
# ubuntu/debian-type OS
$ sudo apt install xvfb
# arch
$ sudo pacman -S xorg-server-xvfb
Profiling slow tests
--------------------

View File

@ -26,6 +26,11 @@ if [ -z "$LAUNCH_CMD" ]; then
else
# We are integration-testing. Force UTF-8 as the encoding.
LAUNCH_OPTS=-Dfile.encoding=UTF-8
# check if Xvfb is available
if command -v xvfb-run > /dev/null 2>&1; then
LAUNCH_OPTS="$LAUNCH_CMD $LAUNCH_OPTS"
LAUNCH_CMD="xvfb-run"
fi
fi
"$LAUNCH_CMD" $LAUNCH_OPTS --module-path "$MODULES/modules:$MODULES/modules-thirdparty" --module org.apache.lucene.luke "$@"