Apache Lucene open-source search software
LUCENE-10528: use Xvfb in test to avoid messing up user's desktop (#828)
Robert Muir1089b482fc9d
diff --git a/help/tests.txt b/help/tests.txtindex 44e25ec62c3..795f97274ea 100644--- a/help/tests.txt+++ b/help/tests.txt@@ -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--------------------diff --git a/lucene/distribution/src/binary-release/bin/luke.sh b/lucene/distribution/src/binary-release/bin/luke.shindex 3d920879802..dab1e4ef9be 100644--- a/lucene/distribution/src/binary-release/bin/luke.sh+++ b/lucene/distribution/src/binary-release/bin/luke.sh@@ -26,6 +26,11 @@ if [ -z "$LAUNCH_CMD" ]; thenelse# 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"+ fifi"$LAUNCH_CMD" $LAUNCH_OPTS --module-path "$MODULES/modules:$MODULES/modules-thirdparty" --module org.apache.lucene.luke "$@"