diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2022-01-01 18:09:35 +0000 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2022-01-01 18:09:35 +0000 |
commit | b9de4d5e810d07b679ad9ab9e46d58e4c76213cc (patch) | |
tree | b69c6b84b9ce025d6f7afd92d734452757f4f365 /tests/subplots/common/runcmd_test.rs | |
parent | 95b3d27d27a8dab7cb8a5136000a2331ab9b4a4a (diff) | |
download | subplot-b9de4d5e810d07b679ad9ab9e46d58e4c76213cc.tar.gz |
tests: Make runcmd.md a common test set now
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'tests/subplots/common/runcmd_test.rs')
-rw-r--r-- | tests/subplots/common/runcmd_test.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/subplots/common/runcmd_test.rs b/tests/subplots/common/runcmd_test.rs new file mode 100644 index 0000000..7759e5f --- /dev/null +++ b/tests/subplots/common/runcmd_test.rs @@ -0,0 +1,25 @@ +use subplotlib::steplibrary::files::{self, Datadir}; +use subplotlib::steplibrary::runcmd::Runcmd; + +#[cfg(unix)] +use std::os::unix::fs::PermissionsExt; + +#[step] +#[context(Datadir)] +fn create_script_from_embedded( + context: &ScenarioContext, + filename: &str, + embedded: SubplotDataFile, +) { + files::create_from_embedded_with_other_name::call(context, filename, embedded)?; + let filename = context.with(|dd: &Datadir| dd.canonicalise_filename(filename), false)?; + let mut perms = std::fs::symlink_metadata(&filename)?.permissions(); + #[cfg(unix)] + perms.set_mode(perms.mode() | 0o111); + std::fs::set_permissions(&filename, perms)?; +} + +#[step] +fn prepend_to_path(context: &mut Runcmd, dirname: &str) { + context.prepend_to_path(dirname); +} |