Skip to content

Commit

Permalink
WIP: tests/emulator/poke_around: test setting user.shell
Browse files Browse the repository at this point in the history
  • Loading branch information
t184256 committed Sep 4, 2024
1 parent e79d6f3 commit c3c63ea
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/emulator/poke_around.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

0 comments on commit c3c63ea

Please sign in to comment.