mirror of
https://github.com/uselessd/alcove.git
synced 2026-04-15 09:15:19 +00:00
tests: mount(2)/umount(2)
This commit is contained in:
@@ -35,6 +35,7 @@ run(State) ->
|
||||
sethostname(State),
|
||||
setns(State),
|
||||
unshare(State),
|
||||
mount(State),
|
||||
chroot(State),
|
||||
chdir(State),
|
||||
setrlimit(State),
|
||||
@@ -52,7 +53,7 @@ start() ->
|
||||
Port = alcove_drv:start([{exec, "sudo"}]),
|
||||
case os:type() of
|
||||
{unix,linux} ->
|
||||
Flags = alcove:define(Port, clone, [newpid,newuts,newnet,newipc]),
|
||||
Flags = alcove:define(Port, clone, [newns,newpid,newuts,newnet,newipc]),
|
||||
{ok, Child} = alcove:clone(Port, Flags),
|
||||
{linux, Port, Child};
|
||||
{unix,_} ->
|
||||
@@ -111,6 +112,15 @@ unshare({linux, Port, _Child}) ->
|
||||
unshare({unix, _Port, _Child}) ->
|
||||
?_assertEqual(ok,ok).
|
||||
|
||||
mount({linux, Port, Child}) ->
|
||||
Flags = alcove:define(Port, mount, [bind,rdonly,noexec]),
|
||||
Mount = alcove:mount(Port, [Child], "/bin", "/mnt", "", Flags, ""),
|
||||
Umount = alcove:umount(Port, [Child], "/mnt"),
|
||||
[
|
||||
?_assertEqual(ok, Mount),
|
||||
?_assertEqual(ok, Umount)
|
||||
].
|
||||
|
||||
chroot({_, Port, Child}) ->
|
||||
Reply = alcove:chroot(Port, [Child], "/bin"),
|
||||
?_assertEqual(ok, Reply).
|
||||
|
||||
Reference in New Issue
Block a user