commit 3a8fd7399c37c920671b7e2fb60341c24d522e30
parent d72aa87bff67a9856d2fc725c37886d8e0087eea
Author: Asher Morgan <59518073+ashermorgan@users.noreply.github.com>
Date: Sat, 7 Sep 2024 14:40:22 -0700
Update progress denominators to reflect tag rules
Diffstat:
| M | src/core.rs | | | 13 | +++++++------ |
| M | src/manifest.rs | | | 94 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----- |
| M | tests/basic.rs | | | 20 | ++++++++++---------- |
| M | tests/local.rs | | | 126 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
| M | tests/ssh.rs | | | 106 | ++++++++++++++++++++++++++++++++++++++++---------------------------------------- |
5 files changed, 221 insertions(+), 138 deletions(-)
diff --git a/src/core.rs b/src/core.rs
@@ -5,7 +5,7 @@ use colored::{Colorize, ColoredString};
use std::env::set_current_dir;
use std::path::Path;
use super::manifest::{Manifest, CopyLinkOptions, RunOptions, get_manifest_tags,
- tags_match};
+ filter_manifest_steps};
use super::local::{copy_file, link_file, run_command};
use super::ssh::{resolve_path, send_command, send_staged_files, stage_file};
use tempfile::tempdir;
@@ -51,16 +51,17 @@ pub fn list_tags(manifest: Manifest) {
pub fn install_manifest(manifest: Manifest, tag_rules: Vec<String>, host: &str,
dry_run: bool, copy: bool) -> Result<bool> {
+ let filtered_manifest = filter_manifest_steps(manifest, &tag_rules);
+
let temp_dir = tempdir().context("Failed to create temporary directory")?;
- set_current_dir(manifest.base_dir)
+ set_current_dir(filtered_manifest.base_dir)
.context("Failed to set working directory")?;
let mut errors = false;
- for (i, step) in manifest.steps.iter().enumerate() {
- if !tags_match(&tag_rules, &step.tags) { continue; }
-
- let step_str = format!("[{}/{}]", i+1, manifest.steps.len()).bold();
+ for (i, step) in filtered_manifest.steps.iter().enumerate() {
+ let step_str = format!("[{}/{}]", i+1,
+ filtered_manifest.steps.len()).bold();
errors |= execute_copies(&step.copy, host, temp_dir.path(), dry_run,
&step_str);
diff --git a/src/manifest.rs b/src/manifest.rs
@@ -8,7 +8,7 @@ use std::fs::read_to_string;
use std::path::{Path, PathBuf};
/// The options for a copy or link command
-#[derive(Debug, PartialEq, Deserialize)]
+#[derive(Clone, Debug, PartialEq, Deserialize)]
pub struct CopyLinkOptions {
/// The source file (relative to the parent manifest file)
pub src: String,
@@ -18,7 +18,7 @@ pub struct CopyLinkOptions {
}
/// The options for a run command
-#[derive(Debug, PartialEq, Deserialize)]
+#[derive(Clone, Debug, PartialEq, Deserialize)]
pub struct RunOptions {
/// The location of the script (relative to the parent manifest file)
pub src: String,
@@ -33,7 +33,7 @@ pub struct RunOptions {
}
/// A manifest step
-#[derive(Debug, PartialEq, Deserialize)]
+#[derive(Clone, Debug, PartialEq, Deserialize)]
pub struct Step {
/// The step's copy commands
#[serde(default)]
@@ -61,7 +61,7 @@ struct RawManifest {
}
/// A parsed coliru manifest
-#[derive(Debug, PartialEq)]
+#[derive(Clone, Debug, PartialEq)]
pub struct Manifest {
/// The manifest steps
pub steps: Vec<Step>,
@@ -79,7 +79,7 @@ pub struct Manifest {
/// assert_eq!(tags_match(&rules, &tags_1), true);
/// assert_eq!(tags_match(&rules, &tags_2), false);
/// ```
-pub fn tags_match<S: AsRef<str>>(rules: &[S], tags: &[S]) -> bool {
+fn tags_match<S: AsRef<str>>(rules: &[S], tags: &[S]) -> bool {
for rule in rules.iter() {
let mut _rule = rule.as_ref();
let is_negated = _rule.chars().nth(0) == Some('^');
@@ -121,6 +121,11 @@ pub fn parse_manifest_file(path: &Path) -> Result<Manifest> {
}
/// Returns a sorted, de-duplicated vector of all tags in a manifest
+///
+/// ```
+/// let manifest = parse_manifest_file(Path::new("manifest.yml"))?;
+/// let tags = get_manifest_tags(manifest);
+/// ```
pub fn get_manifest_tags(manifest: Manifest) -> Vec<String> {
let mut tag_set: HashSet<String> = HashSet::new();
@@ -135,6 +140,26 @@ pub fn get_manifest_tags(manifest: Manifest) -> Vec<String> {
tags
}
+/// Filter a manifest to only include steps that satisfy a set of tag rules
+///
+/// ```
+/// let manifest = parse_manifest_file(Path::new("manifest.yml"))?;
+/// let tag_rules = [String::from("linux"), String::from("^windows")];
+/// let filtered_manifest = filter_manifest_steps(manifest, &tag_rules);
+/// let filtered_tags = get_manifest_tags(filtered_manifest);
+/// assert_eq!(filtered_tags.contains(String::from("windows")), false);
+/// ```
+pub fn filter_manifest_steps(manifest: Manifest, tag_rules: &[String]) ->
+ Manifest {
+
+ Manifest {
+ steps: manifest.steps.iter().filter(|x|
+ tags_match(tag_rules, &x.tags)
+ ).map(|x| x.clone()).collect(),
+ base_dir: manifest.base_dir,
+ }
+}
+
#[cfg(test)]
mod tests {
use super::*;
@@ -389,7 +414,7 @@ mod tests {
}
#[test]
- fn test_manifest_get_manifest_tags_empty() {
+ fn test_manifest_get_manifest_tags_empty_manifest() {
let manifest = Manifest {
steps: vec![],
base_dir: PathBuf::from("examples/test/empty.yml"),
@@ -398,4 +423,61 @@ mod tests {
let actual = get_manifest_tags(manifest);
assert_eq!(actual, expected);
}
+
+ #[test]
+ fn test_manifest_get_manifest_tags_no_tags() {
+ let manifest_path = Path::new("examples/test/manifest.yml");
+ let mut manifest = parse_manifest_file(manifest_path).unwrap();
+ manifest.steps[0].tags = vec![];
+ manifest.steps[1].tags = vec![];
+ manifest.steps[2].tags = vec![];
+ let expected: Vec<String> = vec![];
+ let actual = get_manifest_tags(manifest);
+ assert_eq!(actual, expected);
+ }
+
+ #[test]
+ fn test_manifest_filter_manifest_steps_basic() {
+ let manifest_path = Path::new("examples/test/manifest.yml");
+ let manifest = parse_manifest_file(manifest_path).unwrap();
+ let tags = [String::from("linux")];
+ let mut expected = manifest.clone();
+ expected.steps.remove(2);
+ let actual = filter_manifest_steps(manifest, &tags);
+ assert_eq!(actual, expected);
+ }
+
+ #[test]
+ fn test_manifest_filter_manifest_steps_alternate_tags() {
+ let manifest_path = Path::new("examples/test/manifest.yml");
+ let manifest = parse_manifest_file(manifest_path).unwrap();
+ let tags = [String::from("linux"), String::from("^windows")];
+ let mut expected = manifest.clone();
+ expected.steps.remove(0);
+ expected.steps.remove(1);
+ let actual = filter_manifest_steps(manifest, &tags);
+ assert_eq!(actual, expected);
+ }
+
+ #[test]
+ fn test_manifest_filter_manifest_steps_empty_manifest() {
+ let manifest = Manifest {
+ steps: vec![],
+ base_dir: PathBuf::from("examples/test/empty.yml"),
+ };
+ let tags = [String::from("linux")];
+ let expected = manifest.clone();
+ let actual = filter_manifest_steps(manifest, &tags);
+ assert_eq!(actual, expected);
+ }
+
+ #[test]
+ fn test_manifest_filter_manifest_steps_no_tags() {
+ let manifest_path = Path::new("examples/test/manifest.yml");
+ let manifest = parse_manifest_file(manifest_path).unwrap();
+ let tags = [];
+ let expected = manifest.clone();
+ let actual = filter_manifest_steps(manifest, &tags);
+ assert_eq!(actual, expected);
+ }
}
diff --git a/tests/basic.rs b/tests/basic.rs
@@ -115,11 +115,11 @@ fn test_basic_absolute_manifest() {
cmd.args([&manifest_path.to_str().unwrap(), "--dry-run", "-t", "linux"]);
let expected = "\
-[1/3] Copy gitconfig to ~/.gitconfig (DRY RUN)
-[2/3] Copy foo to foo (DRY RUN)
-[2/3] Link bashrc to ~/.bashrc (DRY RUN)
-[2/3] Link vimrc to ~/.vimrc (DRY RUN)
-[2/3] Run sh script.sh arg1 linux (DRY RUN)
+[1/2] Copy gitconfig to ~/.gitconfig (DRY RUN)
+[2/2] Copy foo to foo (DRY RUN)
+[2/2] Link bashrc to ~/.bashrc (DRY RUN)
+[2/2] Link vimrc to ~/.vimrc (DRY RUN)
+[2/2] Run sh script.sh arg1 linux (DRY RUN)
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
assert_eq!(&stderr, "");
@@ -149,11 +149,11 @@ fn test_basic_absolute_manifest() {
cmd.args([&manifest_path.to_str().unwrap(), "--dry-run", "-t", "linux"]);
let expected = "\
-[1/3] Copy gitconfig to .gitconfig (DRY RUN)
-[2/3] Copy foo to foo (DRY RUN)
-[2/3] Link bashrc to .bashrc (DRY RUN)
-[2/3] Link vimrc to .vimrc (DRY RUN)
-[2/3] Run sh script.sh arg1 linux (DRY RUN)
+[1/2] Copy gitconfig to .gitconfig (DRY RUN)
+[2/2] Copy foo to foo (DRY RUN)
+[2/2] Link bashrc to .bashrc (DRY RUN)
+[2/2] Link vimrc to .vimrc (DRY RUN)
+[2/2] Run sh script.sh arg1 linux (DRY RUN)
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
assert_eq!(&stderr, "");
diff --git a/tests/local.rs b/tests/local.rs
@@ -12,11 +12,11 @@ fn test_local_standard() {
cmd.args(["manifest.yml", "-t", "linux"]);
let expected = "\
-[1/3] Copy gitconfig to ~/.gitconfig
-[2/3] Copy foo to foo
-[2/3] Link bashrc to ~/.bashrc
-[2/3] Link vimrc to ~/.vimrc
-[2/3] Run sh script.sh arg1 linux
+[1/2] Copy gitconfig to ~/.gitconfig
+[2/2] Copy foo to foo
+[2/2] Link bashrc to ~/.bashrc
+[2/2] Link vimrc to ~/.vimrc
+[2/2] Run sh script.sh arg1 linux
foo!
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -49,10 +49,10 @@ fn test_local_standard() {
cmd.args(["manifest.yml", "-t", "windows"]);
let expected = "\
-[1/3] Copy gitconfig to .gitconfig
-[3/3] Copy foo to foo
-[3/3] Link vimrc to _vimrc
-[3/3] Run script.bat arg1 windows
+[1/2] Copy gitconfig to .gitconfig
+[2/2] Copy foo to foo
+[2/2] Link vimrc to _vimrc
+[2/2] Run script.bat arg1 windows
foo!\r
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -84,10 +84,10 @@ fn test_local_run_alternate_tag_rules_1() {
cmd.args(["manifest.yml", "-t", "linux", "^windows"]);
let expected = "\
-[2/3] Copy foo to foo
-[2/3] Link bashrc to ~/.bashrc
-[2/3] Link vimrc to ~/.vimrc
-[2/3] Run sh script.sh arg1 linux ^windows
+[1/1] Copy foo to foo
+[1/1] Link bashrc to ~/.bashrc
+[1/1] Link vimrc to ~/.vimrc
+[1/1] Run sh script.sh arg1 linux ^windows
foo!
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -119,11 +119,11 @@ fn test_local_run_alternate_tag_rules_2() {
cmd.args(["manifest.yml", "-t", "macos"]);
let expected = "\
-[1/3] Copy gitconfig to ~/.gitconfig
-[2/3] Copy foo to foo
-[2/3] Link bashrc to ~/.bashrc
-[2/3] Link vimrc to ~/.vimrc
-[2/3] Run sh script.sh arg1 macos
+[1/2] Copy gitconfig to ~/.gitconfig
+[2/2] Copy foo to foo
+[2/2] Link bashrc to ~/.bashrc
+[2/2] Link vimrc to ~/.vimrc
+[2/2] Run sh script.sh arg1 macos
foo!
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -156,11 +156,11 @@ fn test_local_dry_run() {
cmd.args(["manifest.yml", "--dry-run", "-t", "linux"]);
let expected = "\
-[1/3] Copy gitconfig to ~/.gitconfig (DRY RUN)
-[2/3] Copy foo to foo (DRY RUN)
-[2/3] Link bashrc to ~/.bashrc (DRY RUN)
-[2/3] Link vimrc to ~/.vimrc (DRY RUN)
-[2/3] Run sh script.sh arg1 linux (DRY RUN)
+[1/2] Copy gitconfig to ~/.gitconfig (DRY RUN)
+[2/2] Copy foo to foo (DRY RUN)
+[2/2] Link bashrc to ~/.bashrc (DRY RUN)
+[2/2] Link vimrc to ~/.vimrc (DRY RUN)
+[2/2] Run sh script.sh arg1 linux (DRY RUN)
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
assert_eq!(&stderr, "");
@@ -189,10 +189,10 @@ fn test_local_dry_run() {
cmd.args(["manifest.yml", "--dry-run", "-t", "windows"]);
let expected = "\
-[1/3] Copy gitconfig to .gitconfig (DRY RUN)
-[3/3] Copy foo to foo (DRY RUN)
-[3/3] Link vimrc to _vimrc (DRY RUN)
-[3/3] Run script.bat arg1 windows (DRY RUN)
+[1/2] Copy gitconfig to .gitconfig (DRY RUN)
+[2/2] Copy foo to foo (DRY RUN)
+[2/2] Link vimrc to _vimrc (DRY RUN)
+[2/2] Run script.bat arg1 windows (DRY RUN)
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
assert_eq!(&stderr, "");
@@ -221,11 +221,11 @@ fn test_local_copy() {
cmd.args(["manifest.yml", "--copy", "-t", "linux"]);
let expected = "\
-[1/3] Copy gitconfig to ~/.gitconfig
-[2/3] Copy foo to foo
-[2/3] Copy bashrc to ~/.bashrc
-[2/3] Copy vimrc to ~/.vimrc
-[2/3] Run sh script.sh arg1 linux
+[1/2] Copy gitconfig to ~/.gitconfig
+[2/2] Copy foo to foo
+[2/2] Copy bashrc to ~/.bashrc
+[2/2] Copy vimrc to ~/.vimrc
+[2/2] Run sh script.sh arg1 linux
foo!
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -258,10 +258,10 @@ fn test_local_copy() {
cmd.args(["manifest.yml", "--copy", "-t", "windows"]);
let expected = "\
-[1/3] Copy gitconfig to .gitconfig
-[3/3] Copy foo to foo
-[3/3] Copy vimrc to _vimrc
-[3/3] Run script.bat arg1 windows
+[1/2] Copy gitconfig to .gitconfig
+[2/2] Copy foo to foo
+[2/2] Copy vimrc to _vimrc
+[2/2] Run script.bat arg1 windows
foo!\r
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -294,11 +294,11 @@ fn test_local_run_failure() {
write_file(&dirs.local.join("script.sh"), "exit 1");
let expected_stdout = "\
-[1/3] Copy gitconfig to ~/.gitconfig
-[2/3] Copy foo to foo
-[2/3] Link bashrc to ~/.bashrc
-[2/3] Link vimrc to ~/.vimrc
-[2/3] Run sh script.sh arg1 linux
+[1/2] Copy gitconfig to ~/.gitconfig
+[2/2] Copy foo to foo
+[2/2] Link bashrc to ~/.bashrc
+[2/2] Link vimrc to ~/.vimrc
+[2/2] Run sh script.sh arg1 linux
";
let expected_stderr = " Error: Process terminated unsuccessfully: \
exit status: 1\n";
@@ -331,10 +331,10 @@ fn test_local_run_failure() {
write_file(&dirs.local.join("script.bat"), "@echo off\r\nexit 1");
let expected_stdout = "\
-[1/3] Copy gitconfig to .gitconfig
-[3/3] Copy foo to foo
-[3/3] Link vimrc to _vimrc
-[3/3] Run script.bat arg1 windows
+[1/2] Copy gitconfig to .gitconfig
+[2/2] Copy foo to foo
+[2/2] Link vimrc to _vimrc
+[2/2] Run script.bat arg1 windows
";
let expected_stderr = " Error: Process terminated unsuccessfully: \
exit code: 1\n";
@@ -366,11 +366,11 @@ fn test_local_missing_file() {
remove_file(&dirs.local.join("gitconfig")).unwrap();
let expected_stdout = "\
-[1/3] Copy gitconfig to ~/.gitconfig
-[2/3] Copy foo to foo
-[2/3] Link bashrc to ~/.bashrc
-[2/3] Link vimrc to ~/.vimrc
-[2/3] Run sh script.sh arg1 linux
+[1/2] Copy gitconfig to ~/.gitconfig
+[2/2] Copy foo to foo
+[2/2] Link bashrc to ~/.bashrc
+[2/2] Link vimrc to ~/.vimrc
+[2/2] Run sh script.sh arg1 linux
foo!
";
let expected_stderr = " Error: No such file or directory (os error 2)\n";
@@ -402,10 +402,10 @@ fn test_local_missing_file() {
remove_file(&dirs.local.join("vimrc")).unwrap();
let expected_stdout = "\
-[1/3] Copy gitconfig to .gitconfig
-[3/3] Copy foo to foo
-[3/3] Link vimrc to _vimrc
-[3/3] Run script.bat arg1 windows
+[1/2] Copy gitconfig to .gitconfig
+[2/2] Copy foo to foo
+[2/2] Link vimrc to _vimrc
+[2/2] Run script.bat arg1 windows
foo!\r
";
let expected_stderr = " Error: The system cannot find the file specified. \
@@ -435,11 +435,11 @@ fn test_local_relative_manifest() {
cmd.args(["test_local_relative_manifest/manifest.yml", "-t", "linux"]);
let expected = "\
-[1/3] Copy gitconfig to ~/.gitconfig
-[2/3] Copy foo to foo
-[2/3] Link bashrc to ~/.bashrc
-[2/3] Link vimrc to ~/.vimrc
-[2/3] Run sh script.sh arg1 linux
+[1/2] Copy gitconfig to ~/.gitconfig
+[2/2] Copy foo to foo
+[2/2] Link bashrc to ~/.bashrc
+[2/2] Link vimrc to ~/.vimrc
+[2/2] Run sh script.sh arg1 linux
foo!
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -473,10 +473,10 @@ fn test_local_different_cwd() {
cmd.args(["test_local_different_cwd/manifest.yml", "-t", "windows"]);
let expected = "\
-[1/3] Copy gitconfig to .gitconfig
-[3/3] Copy foo to foo
-[3/3] Link vimrc to _vimrc
-[3/3] Run script.bat arg1 windows
+[1/2] Copy gitconfig to .gitconfig
+[2/2] Copy foo to foo
+[2/2] Link vimrc to _vimrc
+[2/2] Run script.bat arg1 windows
foo!\r
";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
diff --git a/tests/ssh.rs b/tests/ssh.rs
@@ -15,12 +15,12 @@ fn test_ssh_standard() {
cmd.args(["manifest.yml", "-t", "linux"]);
let expected = format!("\
-[1/3] Copy gitconfig to {SSH_HOST}:~/test_ssh_standard/.gitconfig
-[2/3] Copy test_ssh_standard/foo to {SSH_HOST}:~/.coliru/test_ssh_standard/foo
-[2/3] Copy bashrc to {SSH_HOST}:~/test_ssh_standard/.bashrc
-[2/3] Copy vimrc to {SSH_HOST}:~/test_ssh_standard/.vimrc
-[2/3] Copy test_ssh_standard/script.sh to {SSH_HOST}:~/.coliru/test_ssh_standard/script.sh
-[2/3] Run sh test_ssh_standard/script.sh arg1 linux on {SSH_HOST}
+[1/2] Copy gitconfig to {SSH_HOST}:~/test_ssh_standard/.gitconfig
+[2/2] Copy test_ssh_standard/foo to {SSH_HOST}:~/.coliru/test_ssh_standard/foo
+[2/2] Copy bashrc to {SSH_HOST}:~/test_ssh_standard/.bashrc
+[2/2] Copy vimrc to {SSH_HOST}:~/test_ssh_standard/.vimrc
+[2/2] Copy test_ssh_standard/script.sh to {SSH_HOST}:~/.coliru/test_ssh_standard/script.sh
+[2/2] Run sh test_ssh_standard/script.sh arg1 linux on {SSH_HOST}
foo!
");
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -50,11 +50,11 @@ fn test_ssh_run_alternate_tag_rules_1() {
cmd.args(["manifest.yml", "-t", "linux", "^windows"]);
let expected = format!("\
-[2/3] Copy test_ssh_run_alternate_tag_rules_1/foo to {SSH_HOST}:~/.coliru/test_ssh_run_alternate_tag_rules_1/foo
-[2/3] Copy bashrc to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_1/.bashrc
-[2/3] Copy vimrc to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_1/.vimrc
-[2/3] Copy test_ssh_run_alternate_tag_rules_1/script.sh to {SSH_HOST}:~/.coliru/test_ssh_run_alternate_tag_rules_1/script.sh
-[2/3] Run sh test_ssh_run_alternate_tag_rules_1/script.sh arg1 linux ^windows on {SSH_HOST}
+[1/1] Copy test_ssh_run_alternate_tag_rules_1/foo to {SSH_HOST}:~/.coliru/test_ssh_run_alternate_tag_rules_1/foo
+[1/1] Copy bashrc to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_1/.bashrc
+[1/1] Copy vimrc to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_1/.vimrc
+[1/1] Copy test_ssh_run_alternate_tag_rules_1/script.sh to {SSH_HOST}:~/.coliru/test_ssh_run_alternate_tag_rules_1/script.sh
+[1/1] Run sh test_ssh_run_alternate_tag_rules_1/script.sh arg1 linux ^windows on {SSH_HOST}
foo!
");
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -84,12 +84,12 @@ fn test_ssh_run_alternate_tag_rules_2() {
cmd.args(["manifest.yml", "-t", "macos"]);
let expected = format!("\
-[1/3] Copy gitconfig to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_2/.gitconfig
-[2/3] Copy test_ssh_run_alternate_tag_rules_2/foo to {SSH_HOST}:~/.coliru/test_ssh_run_alternate_tag_rules_2/foo
-[2/3] Copy bashrc to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_2/.bashrc
-[2/3] Copy vimrc to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_2/.vimrc
-[2/3] Copy test_ssh_run_alternate_tag_rules_2/script.sh to {SSH_HOST}:~/.coliru/test_ssh_run_alternate_tag_rules_2/script.sh
-[2/3] Run sh test_ssh_run_alternate_tag_rules_2/script.sh arg1 macos on {SSH_HOST}
+[1/2] Copy gitconfig to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_2/.gitconfig
+[2/2] Copy test_ssh_run_alternate_tag_rules_2/foo to {SSH_HOST}:~/.coliru/test_ssh_run_alternate_tag_rules_2/foo
+[2/2] Copy bashrc to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_2/.bashrc
+[2/2] Copy vimrc to {SSH_HOST}:~/test_ssh_run_alternate_tag_rules_2/.vimrc
+[2/2] Copy test_ssh_run_alternate_tag_rules_2/script.sh to {SSH_HOST}:~/.coliru/test_ssh_run_alternate_tag_rules_2/script.sh
+[2/2] Run sh test_ssh_run_alternate_tag_rules_2/script.sh arg1 macos on {SSH_HOST}
foo!
");
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -118,12 +118,12 @@ fn test_ssh_dry_run() {
cmd.args(["manifest.yml", "--dry-run", "-t", "linux"]);
let expected = format!("\
-[1/3] Copy gitconfig to {SSH_HOST}:~/test_ssh_dry_run/.gitconfig (DRY RUN)
-[2/3] Copy test_ssh_dry_run/foo to {SSH_HOST}:~/.coliru/test_ssh_dry_run/foo (DRY RUN)
-[2/3] Copy bashrc to {SSH_HOST}:~/test_ssh_dry_run/.bashrc (DRY RUN)
-[2/3] Copy vimrc to {SSH_HOST}:~/test_ssh_dry_run/.vimrc (DRY RUN)
-[2/3] Copy test_ssh_dry_run/script.sh to {SSH_HOST}:~/.coliru/test_ssh_dry_run/script.sh (DRY RUN)
-[2/3] Run sh test_ssh_dry_run/script.sh arg1 linux on {SSH_HOST} (DRY RUN)
+[1/2] Copy gitconfig to {SSH_HOST}:~/test_ssh_dry_run/.gitconfig (DRY RUN)
+[2/2] Copy test_ssh_dry_run/foo to {SSH_HOST}:~/.coliru/test_ssh_dry_run/foo (DRY RUN)
+[2/2] Copy bashrc to {SSH_HOST}:~/test_ssh_dry_run/.bashrc (DRY RUN)
+[2/2] Copy vimrc to {SSH_HOST}:~/test_ssh_dry_run/.vimrc (DRY RUN)
+[2/2] Copy test_ssh_dry_run/script.sh to {SSH_HOST}:~/.coliru/test_ssh_dry_run/script.sh (DRY RUN)
+[2/2] Run sh test_ssh_dry_run/script.sh arg1 linux on {SSH_HOST} (DRY RUN)
");
let (stdout, stderr, exitcode) = run_command(&mut cmd);
assert_eq!(&stderr, "");
@@ -152,12 +152,12 @@ fn test_ssh_copy() {
cmd.args(["manifest.yml", "--copy", "-t", "linux"]);
let expected = format!("\
-[1/3] Copy gitconfig to {SSH_HOST}:~/test_ssh_copy/.gitconfig
-[2/3] Copy test_ssh_copy/foo to {SSH_HOST}:~/.coliru/test_ssh_copy/foo
-[2/3] Copy bashrc to {SSH_HOST}:~/test_ssh_copy/.bashrc
-[2/3] Copy vimrc to {SSH_HOST}:~/test_ssh_copy/.vimrc
-[2/3] Copy test_ssh_copy/script.sh to {SSH_HOST}:~/.coliru/test_ssh_copy/script.sh
-[2/3] Run sh test_ssh_copy/script.sh arg1 linux on {SSH_HOST}
+[1/2] Copy gitconfig to {SSH_HOST}:~/test_ssh_copy/.gitconfig
+[2/2] Copy test_ssh_copy/foo to {SSH_HOST}:~/.coliru/test_ssh_copy/foo
+[2/2] Copy bashrc to {SSH_HOST}:~/test_ssh_copy/.bashrc
+[2/2] Copy vimrc to {SSH_HOST}:~/test_ssh_copy/.vimrc
+[2/2] Copy test_ssh_copy/script.sh to {SSH_HOST}:~/.coliru/test_ssh_copy/script.sh
+[2/2] Run sh test_ssh_copy/script.sh arg1 linux on {SSH_HOST}
foo!
");
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -188,12 +188,12 @@ fn test_ssh_run_failure() {
write_file(&dirs.local.join("test_ssh_run_failure/script.sh"), "exit 1");
let expected_stdout = format!("\
-[1/3] Copy gitconfig to {SSH_HOST}:~/test_ssh_run_failure/.gitconfig
-[2/3] Copy test_ssh_run_failure/foo to {SSH_HOST}:~/.coliru/test_ssh_run_failure/foo
-[2/3] Copy bashrc to {SSH_HOST}:~/test_ssh_run_failure/.bashrc
-[2/3] Copy vimrc to {SSH_HOST}:~/test_ssh_run_failure/.vimrc
-[2/3] Copy test_ssh_run_failure/script.sh to {SSH_HOST}:~/.coliru/test_ssh_run_failure/script.sh
-[2/3] Run sh test_ssh_run_failure/script.sh arg1 linux on {SSH_HOST}
+[1/2] Copy gitconfig to {SSH_HOST}:~/test_ssh_run_failure/.gitconfig
+[2/2] Copy test_ssh_run_failure/foo to {SSH_HOST}:~/.coliru/test_ssh_run_failure/foo
+[2/2] Copy bashrc to {SSH_HOST}:~/test_ssh_run_failure/.bashrc
+[2/2] Copy vimrc to {SSH_HOST}:~/test_ssh_run_failure/.vimrc
+[2/2] Copy test_ssh_run_failure/script.sh to {SSH_HOST}:~/.coliru/test_ssh_run_failure/script.sh
+[2/2] Run sh test_ssh_run_failure/script.sh arg1 linux on {SSH_HOST}
");
let expected_stderr = " Error: SSH terminated unsuccessfully: exit status: 1\n";
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -222,12 +222,12 @@ fn test_ssh_missing_file() {
remove_file(&dirs.local.join("vimrc")).unwrap();
let expected_stdout = format!("\
-[1/3] Copy gitconfig to {SSH_HOST}:~/test_ssh_missing_file/.gitconfig
-[2/3] Copy test_ssh_missing_file/foo to {SSH_HOST}:~/.coliru/test_ssh_missing_file/foo
-[2/3] Copy bashrc to {SSH_HOST}:~/test_ssh_missing_file/.bashrc
-[2/3] Copy vimrc to {SSH_HOST}:~/test_ssh_missing_file/.vimrc
-[2/3] Copy test_ssh_missing_file/script.sh to {SSH_HOST}:~/.coliru/test_ssh_missing_file/script.sh
-[2/3] Run sh test_ssh_missing_file/script.sh arg1 linux on {SSH_HOST}
+[1/2] Copy gitconfig to {SSH_HOST}:~/test_ssh_missing_file/.gitconfig
+[2/2] Copy test_ssh_missing_file/foo to {SSH_HOST}:~/.coliru/test_ssh_missing_file/foo
+[2/2] Copy bashrc to {SSH_HOST}:~/test_ssh_missing_file/.bashrc
+[2/2] Copy vimrc to {SSH_HOST}:~/test_ssh_missing_file/.vimrc
+[2/2] Copy test_ssh_missing_file/script.sh to {SSH_HOST}:~/.coliru/test_ssh_missing_file/script.sh
+[2/2] Run sh test_ssh_missing_file/script.sh arg1 linux on {SSH_HOST}
foo!
");
let expected_stderr = " Error: Failed to copy vimrc to staging directory: \
@@ -256,12 +256,12 @@ fn test_ssh_different_cwd() {
cmd.args(["test_ssh_different_cwd/manifest.yml", "-t", "linux"]);
let expected = format!("\
-[1/3] Copy gitconfig to {SSH_HOST}:~/test_ssh_different_cwd/.gitconfig
-[2/3] Copy test_ssh_different_cwd/foo to {SSH_HOST}:~/.coliru/test_ssh_different_cwd/foo
-[2/3] Copy bashrc to {SSH_HOST}:~/test_ssh_different_cwd/.bashrc
-[2/3] Copy vimrc to {SSH_HOST}:~/test_ssh_different_cwd/.vimrc
-[2/3] Copy test_ssh_different_cwd/script.sh to {SSH_HOST}:~/.coliru/test_ssh_different_cwd/script.sh
-[2/3] Run sh test_ssh_different_cwd/script.sh arg1 linux on {SSH_HOST}
+[1/2] Copy gitconfig to {SSH_HOST}:~/test_ssh_different_cwd/.gitconfig
+[2/2] Copy test_ssh_different_cwd/foo to {SSH_HOST}:~/.coliru/test_ssh_different_cwd/foo
+[2/2] Copy bashrc to {SSH_HOST}:~/test_ssh_different_cwd/.bashrc
+[2/2] Copy vimrc to {SSH_HOST}:~/test_ssh_different_cwd/.vimrc
+[2/2] Copy test_ssh_different_cwd/script.sh to {SSH_HOST}:~/.coliru/test_ssh_different_cwd/script.sh
+[2/2] Run sh test_ssh_different_cwd/script.sh arg1 linux on {SSH_HOST}
foo!
");
let (stdout, stderr, exitcode) = run_command(&mut cmd);
@@ -293,12 +293,12 @@ fn test_ssh_bad_host() {
// setup_e2e_local will install to CWD instead of $HOME on Windows:
let expected_stdout = Regex::new(&format!("\
-\\[1/3] Copy gitconfig to {bad_host}:~/(.coliru/)?.gitconfig
-\\[2/3] Copy foo to {bad_host}:~/.coliru/foo
-\\[2/3] Copy bashrc to {bad_host}:~/(.coliru/)?.bashrc
-\\[2/3] Copy vimrc to {bad_host}:~/(.coliru/)?.vimrc
-\\[2/3] Copy script.sh to {bad_host}:~/.coliru/script.sh
-\\[2/3] Run sh script.sh arg1 linux on {bad_host}
+\\[1/2] Copy gitconfig to {bad_host}:~/(.coliru/)?.gitconfig
+\\[2/2] Copy foo to {bad_host}:~/.coliru/foo
+\\[2/2] Copy bashrc to {bad_host}:~/(.coliru/)?.bashrc
+\\[2/2] Copy vimrc to {bad_host}:~/(.coliru/)?.vimrc
+\\[2/2] Copy script.sh to {bad_host}:~/.coliru/script.sh
+\\[2/2] Run sh script.sh arg1 linux on {bad_host}
")).unwrap();
// Exact std output varies significantly across machines;
let expected_stderr = Regex::new("\