Skip to content

Commit

Permalink
WIP: tests/emulator/test_channels_shell: investigate what happens to …
Browse files Browse the repository at this point in the history
…$PATH
  • Loading branch information
t184256 committed Jul 10, 2024
1 parent 598fa1f commit a81f653
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
2 changes: 2 additions & 0 deletions modules/environment/login/login-inner.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ writeText "login-inner" ''
set -eo pipefail
echo login-inner PATH=$PATH
${lib.optionalString (config.environment.motd != null) ''
if [ "$#" -eq 0 ]; then # if script is called from within Nix-on-Droid app
echo "${lib.removeSuffix "\n" config.environment.motd}"
Expand Down
2 changes: 2 additions & 0 deletions modules/environment/login/login.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ writeScript "login" ''
# This file is generated by Nix-on-Droid. DO NOT EDIT.
set -eu -o pipefail
echo login PATH=$PATH
export USER="${config.user.userName}"
export HOME="${config.user.home}"
export PROOT_TMP_DIR=${installationDir}/tmp
Expand Down
14 changes: 13 additions & 1 deletion tests/emulator/test_channels_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,25 @@ def run(d):
'id',
f'mkdir -p {STD}',
f'touch {STD}/confirmation-granted',
'echo $PATH',
'env -i env',
'/data/data/com.termux.nix/files/usr/bin/login echo test',
'/data/data/com.termux.nix/files/usr/bin/login id',
('cd /data/data/com.termux.nix/files/home; '
'pwd; '
'id; '
'/data/data/com.termux.nix/files/usr/bin/login '
' nix-on-droid on-device-test')
' env'),
('cd /data/data/com.termux.nix/files/home; '
'pwd; '
'id; '
'env -i PATH= /data/data/com.termux.nix/files/usr/bin/login '
' env'),
('cd /data/data/com.termux.nix/files/home; '
'pwd; '
'id; '
'env -i PATH= /data/data/com.termux.nix/files/usr/bin/login '
' nix-on-droid on-device-test'),
]:
print(f'running {cmd} as {user} with capture:')
p = subprocess.Popen(['adb', 'shell', 'su', '0', 'su', user,
Expand Down

0 comments on commit a81f653

Please sign in to comment.