forked from Mirror/pmbootstrap
* change "pmbootstrap kconfig_check" to "pmbootstrap kconfig check" * change "pmbootstrap menuconfig" to "pmbootstrap kconfig edit [-x|-g]" (with legacy alias, because the first syntax was referenced to a lot) * enable X11 interfaces: -x: xconfig, -g: gconfig * new function to copy the xauthority file: pmb.chroot.other.copy_xauthority() * remove menufconfig() function from the kernel template and all kernel aports ([skip ci] because it would rebuild all kernels and run out of time). Alpine has dropped this as well, and it wouldn't work with the new code anyway.
63 lines
2.4 KiB
Python
63 lines
2.4 KiB
Python
"""
|
|
Copyright 2018 Oliver Smith
|
|
|
|
This file is part of pmbootstrap.
|
|
|
|
pmbootstrap is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
pmbootstrap is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
|
"""
|
|
import subprocess
|
|
import os
|
|
|
|
|
|
def test_chroot_interactive_shell():
|
|
"""
|
|
Open a shell with 'pmbootstrap chroot' and pass 'echo hello_world\n' as stdin.
|
|
"""
|
|
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
|
|
os.chdir(pmb_src)
|
|
ret = subprocess.check_output(["./pmbootstrap.py", "-q", "chroot"], timeout=300,
|
|
input="echo hello_world\n", universal_newlines=True,
|
|
stderr=subprocess.STDOUT)
|
|
assert ret == "hello_world\n"
|
|
|
|
|
|
def test_chroot_interactive_shell_user():
|
|
"""
|
|
Open a shell with 'pmbootstrap chroot' as user, and test the resulting ID.
|
|
"""
|
|
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
|
|
os.chdir(pmb_src)
|
|
ret = subprocess.check_output(["./pmbootstrap.py", "-q", "chroot",
|
|
"--user"], timeout=300, input="id -un",
|
|
universal_newlines=True,
|
|
stderr=subprocess.STDOUT)
|
|
assert ret == "pmos\n"
|
|
|
|
|
|
def test_chroot_arguments():
|
|
"""
|
|
Open a shell with 'pmbootstrap chroot' for every architecture, pass 'uname -m\n'
|
|
as stdin and check the output
|
|
"""
|
|
pmb_src = os.path.realpath(os.path.join(os.path.dirname(__file__) + "/.."))
|
|
os.chdir(pmb_src)
|
|
|
|
for arch in ["armhf", "aarch64", "x86_64"]:
|
|
ret = subprocess.check_output(["./pmbootstrap.py", "-q", "chroot", "-b", arch],
|
|
timeout=300, input="uname -m\n",
|
|
universal_newlines=True, stderr=subprocess.STDOUT)
|
|
if arch == "armhf":
|
|
assert ret == "armv7l\n"
|
|
else:
|
|
assert ret == arch + "\n"
|