/proc now works and tests properly
This commit is contained in:
parent
7447ddb7ff
commit
0b18ba9613
3 changed files with 9 additions and 5 deletions
|
@ -50,12 +50,12 @@ our %EXPORT_TAGS = (
|
|||
sub mount {
|
||||
my ($source, $target, $filesystem, $flags, $options_hr) = @_;
|
||||
|
||||
my $options_str;
|
||||
my $options_str = "";
|
||||
if ($options_hr) {
|
||||
$options_str = join ',', map {"$_=".$options_hr->{$_}} keys %$options_hr;
|
||||
}
|
||||
|
||||
my $ret = _mount_sys($source, $target, $filesystem, $flags//0xc0ed0000, $options_str);
|
||||
my $ret = _mount_sys($source//"", $target//"", $filesystem//"", $flags//0xc0ed0000, $options_str);
|
||||
|
||||
if ($ret != 0) {
|
||||
croak "mount failed: $ret $!";
|
||||
|
|
|
@ -72,7 +72,7 @@ sub post_setup {
|
|||
my $data = undef;
|
||||
$data = $self->private_tmp if (ref $self->private_tmp eq 'HASH');
|
||||
|
||||
mount("none", "/tmp", "tmpfs", 0, undef);
|
||||
mount("none", "/tmp", "tmpfs", MS_MGC_VAL, undef);
|
||||
mount("none", "/tmp", "tmpfs", MS_PRIVATE, $data);
|
||||
}
|
||||
|
||||
|
@ -104,14 +104,18 @@ sub run {
|
|||
croak "Run must be given a codref to run" unless ref $code eq "CODE";
|
||||
|
||||
$self->_subprocess(sub {
|
||||
$self->setup(%args);
|
||||
$self->pre_setup(%args);
|
||||
my $uflags = $self->_uflags;
|
||||
unshare($uflags);
|
||||
|
||||
# We've just unshared, if we wanted a private pid space we MUST fork again.
|
||||
if ($self->private_pid) {
|
||||
$self->_subprocess(sub {
|
||||
$self->post_setup(%args);
|
||||
$code->(%args);
|
||||
}, %args);
|
||||
} else {
|
||||
$self->setup(%args);
|
||||
$code->(%args);
|
||||
}
|
||||
}, %args);
|
||||
|
|
|
@ -6,7 +6,7 @@ use Test::More;
|
|||
use Test::SharedFork;
|
||||
|
||||
# test 1
|
||||
use_ok("Sys::Linux::Namespace");
|
||||
use Sys::Linux::Namespace;
|
||||
|
||||
# test 2
|
||||
SKIP: {
|
||||
|
|
Loading…
Add table
Reference in a new issue