Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ed6d619
Use ssh2 instead of std::process::Command
Feb 12, 2025
c5811d8
Append ssh port if not already there
Feb 12, 2025
61d992c
Add missing G_SLICE env variable
Feb 12, 2025
a566f08
Use process::Command to construct shell command
Feb 12, 2025
ee2828c
Set G_SLICE in acap-ssh-utils instead
Feb 13, 2025
327dc82
Handle the exit_status of remote program
Feb 13, 2025
7bc38a0
Channels can't be reused so create it only when needed
Feb 13, 2025
c236986
Use bail! macro
Feb 13, 2025
38a275d
Return Vec<u8> from exec_capture_output
Feb 13, 2025
537e846
Make session blocking
Feb 13, 2025
1cbac37
Change println! to debug!
Feb 13, 2025
1d8fd32
Handle root/acap user differently
Feb 14, 2025
ede5781
Change unwrap to expect for clarity
Feb 14, 2025
193268f
Remove unnecessary assignment
Feb 14, 2025
6cb7f19
Always append port 22 to host
Feb 14, 2025
f832a11
Handle directories with sftp
Feb 17, 2025
5580324
Handle arguments to remote programs when using 'su'
Feb 17, 2025
6df6689
Add contexts to fallible sftp calls
Feb 17, 2025
67ad2e5
Fix lint
Feb 17, 2025
ac11ef6
Merge remote-tracking branch 'upstream/main' into rust-ssh
Mar 27, 2025
d1f8363
Update docstrings
Mar 27, 2025
1f2dd63
Remove sshpass from system requirements
Mar 27, 2025
5e8ff7a
Use is_ok_and instead of expect
Mar 27, 2025
feecdbb
Merge remote-tracking branch 'upstream/main' into rust-ssh
Apr 16, 2025
ecd277e
Change `as_root` to `as_package_user`
Apr 16, 2025
29aa98b
Handle symlinks
Apr 16, 2025
3020e38
Change CWD when running ACAP
Apr 16, 2025
7afa257
Use `with_context` instead of `context`
Apr 16, 2025
1757a27
Avoid unnecessary `unwrap`s
Apr 16, 2025
020cfb9
Pass arguments correctly + test
Apr 16, 2025
94ee183
Reformat
Apr 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .devhost/install-system-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ apt-get install \
libglib2.0-dev \
libssl-dev \
pkg-config \
python3-venv \
sshpass
python3-venv
40 changes: 40 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ reqwest-websocket = "0.4.1"
semver = "1.0.23"
serde = "1.0.204"
serde_json = "1.0.120"
ssh2 = "0.9.4"
syslog = "6.1.1"
tar = "0.4.40"
tempdir = "0.3.7"
Expand Down
11 changes: 11 additions & 0 deletions apps/inspect_env/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ mod tests {
PathBuf::from("/usr/local/packages").join(PACKAGE_NAME)
}

#[test]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the idea of adding more automated tests.

However, the intention behind these tests is not only to ensure that apps are invoked as expected using the run and test commands, but also to help ensure that the way these commands invoke our program is the same as the way the ACAP system in the camera invokes our program. As such, these should all pass if the app is installed and started the "normal" way e.g. using the GUI.

My thinking is roughly:

  1. We create tests to verify some functionality
  2. The important thing is whether that functionality works as intended when the app is used as intended, i.e. installed and started via official non-dev APIs.
  3. Therefore our tests should all pass when under the same conditions.

So these should give the same results (all tests passing):

  • cargo-acap-sdk install -- -p inspect_env --tests && cargo-acap-sdk start -p inspect_env
  • cargo-acap-sdk test -- -p inspect_env

That being said, as I was writing the above I realized that this is not true for tests that cannot run in parallel, which is why I added --test-threads=1 in the first place. My best idea for how to solve this right now is to establish the convention that tests that require --test-threads=1 should be ignored and that the test command also sets --ignored. Not fantastic, but could work.

What do you think?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another idea is to rewrite mutually exclusive tests as integration tests. This probably works out of the box if the crate has an ACAP manifest in the Cargo manifest directory, as all the apps do.

fn args_passed_as_expected() {
assert_eq!(
env::args().collect::<Vec<_>>(),
vec![
"/usr/local/packages/inspect_env/inspect_env",
"--test-threads=1"
]
)
}

#[test]
fn selected_vars_are_set_as_expected() {
assert_eq!(env::var("G_SLICE").unwrap(), "always-malloc");
Expand Down
1 change: 1 addition & 0 deletions crates/acap-ssh-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ url = { workspace = true }
tar = { workspace = true }

cli-version = { workspace = true }
ssh2 = { workspace = true }
Loading