From c3c63ead010424d822642399642aba66c8fed738 Mon Sep 17 00:00:00 2001 From: Alexander Sosedkin Date: Wed, 4 Sep 2024 23:39:29 +0200 Subject: [PATCH] WIP: tests/emulator/poke_around: test setting user.shell --- tests/emulator/poke_around.py | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/tests/emulator/poke_around.py b/tests/emulator/poke_around.py index 8adc3d85..d80cd5b7 100644 --- a/tests/emulator/poke_around.py +++ b/tests/emulator/poke_around.py @@ -52,3 +52,48 @@ def run(d): d.ui.press('enter') wait_for(d, 'This is Zip') screenshot(d, 'zip-is-still-there') + + def switch_and_relogin(): + screenshot(d, 'pre-switch') + d('input text "nix-on-droid switch"') + d.ui.press('enter') + screenshot(d, 'post-switch') + d('input text "exit"') + d.ui.press('enter') + nod = d.app('com.termux.nix') + nod.launch() + + # change shell: pkgs.fish + d('input text "sed -i ' + r'\'s|## Simply install just the packages|user.shell = pkgs.fish;|\'' + '.config/nixpkgs/nix-on-droid.nix"') + d.ui.press('enter') + switch_and_relogin() + screenshot(d, 're-login-bare-fish') + wait_for(d, 'Welcome to fish, the friendly interactive shell') + screenshot(d, 're-login-done-bare-fish') + + # change shell: ${pkgs.fish}, which is a directory + d('input text \'sed -i ' + r'\"s|user.shell = .*|user.shell = \"${pkgs.fish}\";|\"' + '.config/nixpkgs/nix-on-droid.nix"') + d.ui.press('enter') + switch_and_relogin() + screenshot(d, 're-login-shell-dir-fallback') + wait_for(d, 'Cannot execute shell ') + wait_for(d, 'it is a directory.') + wait_for(d, + 'Unlike nixos you should point `user.shell` to the exact binary.') + wait_for(d, 'Falling back to bash.') + wait_for(d, 'bash-5.2$') + screenshot(d, 're-login-done-shell-dir-fallback') + + # change shell: ${pkgs.fish}/bin/fish + d('input text "sed -i ' + r'\'s|user.shell = .*|user.shell = ${pkgs.fish}/bin/fish;|\'' + '.config/nixpkgs/nix-on-droid.nix"') + d.ui.press('enter') + switch_and_relogin() + screenshot(d, 're-login-fish-bin-fish') + wait_for(d, 'Welcome to fish, the friendly interactive shell') + screenshot(d, 're-login-done-fish-bin-fish')