[Libreoffice-commits] online.git: Branch 'feature/parallel_cypress' - cypress_test/Makefile.am

Tamás Zolnai (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 28 08:58:09 UTC 2020


 cypress_test/Makefile.am |   13 +++++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 6ff4eb9482ddf203453cb050637427001d105372
Author:     Tamás Zolnai <tamas.zolnai at collabora.com>
AuthorDate: Tue Feb 25 13:09:31 2020 +0100
Commit:     Tamás Zolnai <tamas.zolnai at collabora.com>
CommitDate: Fri Feb 28 09:51:21 2020 +0100

    parallel-cypress: Start own Xvfb in CI environment.
    
    It's not necessary when we build with one job, but when
    there are more jobs they try to start their own Xvfb
    and they might use the same DISPLAY number for that
    which leads to a failure or a freeze.
    See also:
    https://docs.cypress.io/guides/guides/continuous-integration.html#Xvfb
    
    Change-Id: I2fb301b1d8e889b2898d6792fb38cece303129a6

diff --git a/cypress_test/Makefile.am b/cypress_test/Makefile.am
index 22c1e0271..701fcf093 100644
--- a/cypress_test/Makefile.am
+++ b/cypress_test/Makefile.am
@@ -24,6 +24,9 @@ MOBILE_TRACK_FOLDER=$(abs_builddir)/workdir/track/mobile
 ALLOWED_PORTS = $(shell seq 9900 1 9980)
 KILL_COMMAND=pkill -F $(PID_FILE) || pkill --signal SIGKILL -F $(PID_FILE)
 PARALLEL_BUILD = $(findstring jobserver,$(MAKEFLAGS))
+DISPLAY_NUMBER = 100
+HEADLESS_BUILD := $(findstring Command failed,$(shell xhost > /dev/null 2>&1 || echo "Command failed, so we are in a headless environment."))
+export DISPLAY=$(if $(HEADLESS_BUILD),:$(DISPLAY_NUMBER),$(shell echo $$DISPLAY))
 
 if HAVE_LO_PATH
 MOBILE_TEST_FILES= \
@@ -56,9 +59,11 @@ DESKTOP_TEST_FILES_DONE= \
 
 check-local: $(MOBILE_TEST_FILES_DONE) $(DESKTOP_TEST_FILES_DONE)
 	@$(KILL_COMMAND) || true
+	$(if $(HEADLESS_BUILD), at pkill Xvfb,)
 
 $(PID_FILE): @JAILS_PATH@ $(NODE_BINS)
 	$(call run_JS_error_check)
+	$(if $(HEADLESS_BUILD),$(call start_Xvfb),)
 	$(call start_loolwsd)
 
 $(MOBILE_TEST_FILES_DONE): $(PID_FILE)
@@ -130,6 +135,14 @@ define start_loolwsd
 	@echo
 endef
 
+#https://docs.cypress.io/guides/guides/continuous-integration.html#Xvfb
+define start_Xvfb
+	@echo "Launching Xvfb..."
+	Xvfb :$(DISPLAY_NUMBER) &
+	sleep 10
+	@echo
+endef
+
 define run_desktop_tests
 	@echo $(if $(1),"Running cypress desktop test: $(1)","Running cypress desktop tests...")
 	@echo


More information about the Libreoffice-commits mailing list