about summary refs log tree commit diff
path: root/nixos/tests/chromium.nix
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2021-07-09 11:24:16 +0200
committerMichael Weiss <dev.primeos@gmail.com>2021-07-09 11:30:04 +0200
commitf9645002a2d8615fd608bfdef4f924481dca391e (patch)
treeec52b6310a26c757b0eb77f3d8a4858c4992770f /nixos/tests/chromium.nix
parent46bdc9017c4ecafd350888e30ad88400098b93cf (diff)
nixos/tests/chromium: Fix the test for M92+
Unfortunately there are some regressions in the GPU code that cause
Chromium and Google Chrome to crash, e.g.:
machine # [0709/084047.890436:ERROR:process_memory_range.cc(75)] read out of range[   30.153484] show_signal: 20 callbacks suppressed
machine # [   30.153490] traps: chrome[1036] trap invalid opcode ip:55af03357b29 sp:7ffeaa69ad10 error:0 in chrome[55aefe7a4000+81ec000]
machine #
machine # [0709/084047.955039:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
machine # [0709/084047.955078:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
machine # [   30.126905] systemd[1]: Created slice system-systemd\x2dcoredump.slice.
machine # [   30.137012] systemd[1]: Started Process Core Dump (PID 1038/UID 0).
machine # [   30.571987] systemd-coredump[1039]: Process 1036 (chrome) of user 1000 dumped core.
machine # [992:1021:0709/084048.501937:ERROR:gpu_process_host.cc(995)] GPU process exited unexpectedly: exit_code=132
machine # [   30.594747] systemd[1]: systemd-coredump@0-1038-0.service: Succeeded.

Hopefully this'll be fixed upstream before the final release (there are
bug reports for it) but for the meantime we have to launch the beta and
dev versions with "--use-gl=angle --use-angle=swiftshader".
Diffstat (limited to 'nixos/tests/chromium.nix')
-rw-r--r--nixos/tests/chromium.nix30
1 files changed, 19 insertions, 11 deletions
diff --git a/nixos/tests/chromium.nix b/nixos/tests/chromium.nix
index 60ecf986d6eed..c17d1953894c2 100644
--- a/nixos/tests/chromium.nix
+++ b/nixos/tests/chromium.nix
@@ -63,17 +63,25 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
         return "su - ${user} -c " + shlex.quote(cmd)
 
 
-    def get_browser_binary():
-        """Returns the name of the browser binary."""
+    def get_browser_call():
+        """Returns the name of the browser binary as well as CLI options."""
+        # Determine the name of the binary:
         pname = "${getName chromiumPkg.name}"
         if pname.find("chromium") != -1:
-            return "chromium"  # Same name for all channels and ungoogled-chromium
-        if pname == "google-chrome":
-            return "google-chrome-stable"
-        if pname == "google-chrome-dev":
-            return "google-chrome-unstable"
-        # For google-chrome-beta and as fallback:
-        return pname
+            binary = "chromium"  # Same name for all channels and ungoogled-chromium
+        elif pname == "google-chrome":
+            binary = "google-chrome-stable"
+        elif pname == "google-chrome-dev":
+            binary = "google-chrome-unstable"
+        else:  # For google-chrome-beta and as fallback:
+            binary = pname
+        # Add optional CLI options:
+        options = ""
+        major_version = "${versions.major (getVersion chromiumPkg.name)}"
+        if major_version > "91":
+            # To avoid a GPU crash:
+            options += "--use-gl=angle --use-angle=swiftshader"
+        return f"{binary} {options}"
 
 
     def create_new_win():
@@ -135,9 +143,9 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
     machine.wait_for_x()
 
     url = "file://${startupHTML}"
-    machine.succeed(ru(f'ulimit -c unlimited; "{get_browser_binary()}" "{url}" & disown'))
+    machine.succeed(ru(f'ulimit -c unlimited; {get_browser_call()} "{url}" & disown'))
 
-    if get_browser_binary().startswith("google-chrome"):
+    if get_browser_call().startswith("google-chrome"):
         # Need to click away the first window:
         machine.wait_for_text("Make Google Chrome the default browser")
         machine.screenshot("google_chrome_default_browser_prompt")