Skip to content

Commit

Permalink
Add carboncopy options to sandbox_config
Browse files Browse the repository at this point in the history
  • Loading branch information
Neloop committed May 10, 2018
1 parent 1330c2a commit afebcca
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/config/sandbox_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ class sandbox_config
* If true then stdout and stderr will be written in the results.
*/
bool output = false;
/**
* File to which stdout will be copied after execution.
* Global worker limit for carboncopies is applied.
* @note Path is outside the sandbox.
*/
std::string carboncopy_stdout = "";
/**
* File to which stderr will be copied after execution.
* Global worker limit for carboncopies is applied.
* @note Path is outside the sandbox.
*/
std::string carboncopy_stderr = "";
/**
* Change working directory to subdirectory inside the sandbox.
* @note Path must be accessible from inside of sandbox.
Expand Down
6 changes: 6 additions & 0 deletions src/helpers/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ std::shared_ptr<job_metadata> helpers::build_job_metadata(const YAML::Node &conf
if (ctask["sandbox"]["output"] && ctask["sandbox"]["output"].IsScalar()) {
sandbox->output = ctask["sandbox"]["output"].as<bool>();
} // can be ommited... no throw
if (ctask["sandbox"]["carboncopy-stdout"] && ctask["sandbox"]["carboncopy-stdout"].IsScalar()) {
sandbox->carboncopy_stdout = ctask["sandbox"]["carboncopy-stdout"].as<std::string>();
} // can be ommited... no throw
if (ctask["sandbox"]["carboncopy-stderr"] && ctask["sandbox"]["carboncopy-stderr"].IsScalar()) {
sandbox->carboncopy_stderr = ctask["sandbox"]["carboncopy-stderr"].as<std::string>();
} // can be ommited... no throw
if (ctask["sandbox"]["chdir"] && ctask["sandbox"]["chdir"].IsScalar()) {
sandbox->chdir = ctask["sandbox"]["chdir"].as<std::string>();
} // can be ommited... no throw
Expand Down
4 changes: 4 additions & 0 deletions tests/job_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ TEST(job_config_test, config_data)
" stdout: 01.out\n"
" stderr: 01.err\n"
" stderr-to-stdout: true\n"
" carboncopy-stdout: carbon-copy-stdout\n"
" carboncopy-stderr: carbon-copy-stderr\n"
" chdir: /eval\n"
" working-directory: working\n"
" limits:\n"
Expand Down Expand Up @@ -257,6 +259,8 @@ TEST(job_config_test, config_data)
ASSERT_EQ(task2->sandbox->std_output, "01.out");
ASSERT_EQ(task2->sandbox->std_error, "01.err");
ASSERT_TRUE(task2->sandbox->stderr_to_stdout);
ASSERT_EQ(task2->sandbox->carboncopy_stdout, "carbon-copy-stdout");
ASSERT_EQ(task2->sandbox->carboncopy_stderr, "carbon-copy-stderr");
ASSERT_EQ(task2->sandbox->chdir, "/eval");
ASSERT_EQ(task2->sandbox->working_directory, "working");

Expand Down

0 comments on commit afebcca

Please sign in to comment.