Skip to content

Commit

Permalink
kyua: DRY utils::jail()
Browse files Browse the repository at this point in the history
  • Loading branch information
ihoro committed May 7, 2024
1 parent 6185b51 commit 9f1ffe6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions contrib/kyua/freebsd/execenv_jail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,23 @@
#include "model/test_case.hpp"
#include "utils/fs/path.hpp"

using freebsd::utils::jail;


namespace freebsd {


bool execenv_jail_supported = true;


static utils::jail jail = utils::jail();


void
execenv_jail::init() const
{
auto test_case = _test_program.find(_test_case_name);

jail().create(
jail().make_name(_test_program.absolute_path(), _test_case_name),
jail.create(
jail.make_name(_test_program.absolute_path(), _test_case_name),
test_case.get_metadata().execenv_jail()
);
}
Expand All @@ -56,17 +57,17 @@ execenv_jail::init() const
void
execenv_jail::cleanup() const
{
jail().remove(
jail().make_name(_test_program.absolute_path(), _test_case_name)
jail.remove(
jail.make_name(_test_program.absolute_path(), _test_case_name)
);
}


void
execenv_jail::exec(const args_vector& args) const
{
jail().exec(
jail().make_name(_test_program.absolute_path(), _test_case_name),
jail.exec(
jail.make_name(_test_program.absolute_path(), _test_case_name),
_test_program.absolute_path(),
args
);
Expand Down

0 comments on commit 9f1ffe6

Please sign in to comment.