aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils/ls.exp
blob: 3d83999475b288c636a705e50e5160bef019f947 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2023 Firejail Authors
# License GPL v2

set timeout 10
spawn $env(SHELL)
match_max 100000
set firstspawn $spawn_id


send -- "rm -f lstesting\r"
sleep 1
send -- "firejail --private --name=test\r"
expect {
	timeout {puts "TESTING ERROR 0\n";exit}
	-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
sleep 1
send -- "echo my_testing > ~/lstesting\r"
after 100

# ls
spawn $env(SHELL)
send -- "firejail --ls=test ~/.\r"
expect {
	timeout {puts "TESTING ERROR 1\n";exit}
	"lstesting"
}
sleep 1

# get
send -- "firejail --get=test ~/lstesting\r"
sleep 1
send -- "cat lstesting\r"
expect {
	timeout {puts "TESTING ERROR 2n";exit}
	"my_testing"
}
after 100

# put
send -- "echo put_test > ~/lstesting\r"
after 100
send -- "firejail --put=test ~/lstesting ~/lstesting_2\r"
sleep 1

set spawn_id $firstspawn
send -- "ls -al ~\r"
expect {
	timeout {puts "TESTING ERROR 3\n";exit}
	"lstesting_2"
}

after 100
send -- "cat ~/lstesting_2\r"
expect {
	timeout {puts "TESTING ERROR 4\n";exit}
	"put_test"
}
after 100
send -- "exit\r"
sleep 1





send -- "rm -f lstesting\r"

after 100
puts "\nall done\n"