Add test for run juju as fakeroot and for SECCOMP

This commit is contained in:
Filippo Squillace 2014-11-25 00:28:47 +01:00
parent b0a0662575
commit 82824d79bf
2 changed files with 15 additions and 12 deletions

View file

@ -7,6 +7,7 @@
# coreutils
# grep
# sudo
# gawk
source "$(dirname $0)/utils.sh"
CURRPWD=$PWD
@ -119,17 +120,21 @@ function test_run_juju_as_user_proot_args(){
is_equal $? 0 || return 1
}
#function test_run_juju_as_user_seccomp(){
#install_mini_juju
#TRUE="/usr/bin/false"
#run_juju_as_user "" "env" "|" "grep" "PROOT_NO_SECCOMP"
#}
function test_run_juju_as_user_seccomp(){
install_mini_juju
local output=$(run_juju_as_user "" "env" | grep "PROOT_NO_SECCOMP")
is_equal $output "" || return 1
#function test_run_juju_as_fakeroot(){
#install_mini_juju
#local output=$(run_juju_as_fakeroot "" "bash")
#is_equal "$output" "root" || return 1
#}
TRUE="/usr/bin/false"
local output=$(run_juju_as_user "" "env" | grep "PROOT_NO_SECCOMP")
is_equal $output "PROOT_NO_SECCOMP=1" || return 1
}
function test_run_juju_as_fakeroot(){
install_mini_juju
local output=$(run_juju_as_fakeroot "" "id" | awk '{print $1}')
is_equal "$output" "uid=0" || return 1
}
function test_delete_juju(){
install_mini_juju

View file

@ -26,8 +26,6 @@ function install_mini_juju(){
mkdir -p ${JUJU_HOME}/{proc,bin,sys,dev,run,tmp,etc}
touch ${JUJU_HOME}/etc/resolv.conf
mkdir -p ${JUJU_HOME}/usr/bin
#echo "root:x:0:0:root:/root:/bin/bash" > ${JUJU_HOME}/etc/passwd
#cp /etc/nsswitch.conf ${JUJU_HOME}
cp /usr/bin/arch-chroot ${JUJU_HOME}/usr/bin
install_executable /usr/bin/bash
install_executable /usr/bin/ls