You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2022/04/23 12:00:37 UTC

[lucene] branch main updated: LUCENE-10528: use Xvfb in test to avoid messing up user's desktop (#828)

This is an automated email from the ASF dual-hosted git repository.

rmuir pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new 1089b482fc9 LUCENE-10528: use Xvfb in test to avoid messing up user's desktop (#828)
1089b482fc9 is described below

commit 1089b482fc9d4b4202ca27e096723d0060446b51
Author: Robert Muir <rm...@apache.org>
AuthorDate: Sat Apr 23 08:00:33 2022 -0400

    LUCENE-10528: use Xvfb in test to avoid messing up user's desktop (#828)
    
    Co-authored-by: Tomoko Uchida <to...@gmail.com>
---
 help/tests.txt                                     | 18 ++++++++++++++++++
 lucene/distribution/src/binary-release/bin/luke.sh |  5 +++++
 2 files changed, 23 insertions(+)

diff --git a/help/tests.txt b/help/tests.txt
index 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.sh
index 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" ]; 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 "$@"