Add Wayland debug logging

Adds the --weston-debug-logging flag to xvfb.py and enables its use in
GPU tests. This sets WAYLAND_DEBUG=1 when starting Weston, which results
in more verbose logging for debugging.

Bug: 1189400
Change-Id: I367889b1e1999c6de0e999dc5e328a49c7b27772
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2770344
Commit-Queue: Brian Sheedy <[email protected]>
Commit-Queue: John Chen <[email protected]>
Auto-Submit: Brian Sheedy <[email protected]>
Reviewed-by: John Chen <[email protected]>
Cr-Commit-Position: refs/heads/master@{#864044}
diff --git a/testing/xvfb.py b/testing/xvfb.py
index c03568a..1ba992a 100755
--- a/testing/xvfb.py
+++ b/testing/xvfb.py
@@ -8,6 +8,7 @@
 
 from __future__ import print_function
 
+import copy
 import os
 import os.path
 import psutil
@@ -285,6 +286,11 @@
       weston_cmd.append('--use-gl')
       cmd.remove('--weston-use-gl')
 
+    if '--weston-debug-logging' in cmd:
+      cmd.remove('--weston-debug-logging')
+      env = copy.deepcopy(env)
+      env['WAYLAND_DEBUG'] = '1'
+
     weston_proc_display = None
     for _ in range(10):
       weston_proc = subprocess.Popen(