about summary refs log tree commit diff
path: root/nixos/tests
diff options
context:
space:
mode:
authorMichele Guerini Rocco <rnhmjoj@users.noreply.github.com>2023-09-05 23:46:54 +0200
committerGitHub <noreply@github.com>2023-09-05 23:46:54 +0200
commit704c791a90c34739edcbaaeb2f64619671ca1570 (patch)
treebccab49f43ac87786f729ea6eb6560bba06ab7c4 /nixos/tests
parent9be04101cf090c1b0a75c47580342acece52fdd6 (diff)
parentb3bb611ce6c0829944287fe6206adb5fd5a61fa7 (diff)
downloadnixlib-704c791a90c34739edcbaaeb2f64619671ca1570.tar
nixlib-704c791a90c34739edcbaaeb2f64619671ca1570.tar.gz
nixlib-704c791a90c34739edcbaaeb2f64619671ca1570.tar.bz2
nixlib-704c791a90c34739edcbaaeb2f64619671ca1570.tar.lz
nixlib-704c791a90c34739edcbaaeb2f64619671ca1570.tar.xz
nixlib-704c791a90c34739edcbaaeb2f64619671ca1570.tar.zst
nixlib-704c791a90c34739edcbaaeb2f64619671ca1570.zip
Merge pull request #253146 from rnhmjoj/pr-anbox
anbox: unbreak
Diffstat (limited to 'nixos/tests')
-rw-r--r--nixos/tests/all-tests.nix1
-rw-r--r--nixos/tests/anbox.nix40
2 files changed, 41 insertions, 0 deletions
diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix
index 97410e220786..17be486d8ebb 100644
--- a/nixos/tests/all-tests.nix
+++ b/nixos/tests/all-tests.nix
@@ -109,6 +109,7 @@ in {
   allTerminfo = handleTest ./all-terminfo.nix {};
   alps = handleTest ./alps.nix {};
   amazon-init-shell = handleTest ./amazon-init-shell.nix {};
+  anbox = runTest ./anbox.nix;
   anuko-time-tracker = handleTest ./anuko-time-tracker.nix {};
   apcupsd = handleTest ./apcupsd.nix {};
   apfs = runTest ./apfs.nix;
diff --git a/nixos/tests/anbox.nix b/nixos/tests/anbox.nix
new file mode 100644
index 000000000000..d78f63ec761f
--- /dev/null
+++ b/nixos/tests/anbox.nix
@@ -0,0 +1,40 @@
+{ lib, pkgs, ... }:
+
+{
+  name = "anbox";
+  meta.maintainers = with lib.maintainers; [ mvnetbiz ];
+
+  nodes.machine = { pkgs, config, ... }: {
+    imports = [
+      ./common/user-account.nix
+      ./common/x11.nix
+    ];
+
+    environment.systemPackages = with pkgs; [ android-tools ];
+
+    test-support.displayManager.auto.user = "alice";
+
+    virtualisation.anbox.enable = true;
+    boot.kernelPackages = pkgs.linuxPackages_5_15;
+
+    # The AArch64 anbox image will not start.
+    # Meanwhile the postmarketOS images work just fine.
+    virtualisation.anbox.image = pkgs.anbox.postmarketos-image;
+    virtualisation.memorySize = 2500;
+  };
+
+  testScript = { nodes, ... }: let
+    user = nodes.machine.users.users.alice;
+    bus = "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/${toString user.uid}/bus";
+  in ''
+    machine.wait_for_x()
+
+    machine.wait_until_succeeds(
+        "sudo -iu alice ${bus} anbox wait-ready"
+    )
+
+    machine.wait_until_succeeds("adb shell true")
+
+    print(machine.succeed("adb devices"))
+  '';
+}