Files
snapd/tests/main/security-private-tmp/tmp-create.exp
Maciej Borzecki 94c3b939ee tests/main/security-private-tmp: pass snap mount dir as argument
Fix the expect script to take an argument rather than extract bits from the
environment.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2021-04-22 09:49:00 +02:00

21 lines
381 B
Plaintext

#!/usr/bin/expect -f
set timeout 20
if { $argc < 1 } {
error "missing snap-mount-dir"
}
set snapMountDir [lindex $argv 0]
spawn bash
# Test private /tmp, allowed access
spawn su -l -c "${snapMountDir}/bin/test-snapd-sh.sh" test
expect "$" {} timeout { exit 1 }
send "touch /tmp/foo\n"
send "stat /tmp/foo\n"
expect {
timeout { exit 1 }
"File: '/tmp/foo'*Size: 0"
}