forked from devcontainers/features
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrust_with_empty_components.sh
More file actions
45 lines (36 loc) · 1.4 KB
/
Copy pathrust_with_empty_components.sh
File metadata and controls
45 lines (36 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
set -e
# Optional: Import test library
source dev-container-features-test-lib
# Helper function to check component is installed
check_component_installed() {
local component=$1
if rustup component list | grep -q "${component}.*installed"; then
return 0 # Component is installed (success)
else
return 1 # Component is not installed (failure)
fi
}
# Helper function to check component is NOT installed
check_component_not_installed() {
local component=$1
if rustup component list | grep -q "${component}.*installed"; then
return 1 # Component is installed (failure)
else
return 0 # Component is not installed (success)
fi
}
# Definition specific tests
check "cargo version" cargo --version
check "rustc version" rustc --version
check "correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
# Check that no additional components are installed when empty list is provided
# Only the basic rust toolchain should be available
check "basic rust toolchain" rustc --version
# Verify that default components are automatically installed
check "rust-analyzer is installed" check_component_installed "rust-analyzer"
check "rust-src is installed" check_component_installed "rust-src"
check "rustfmt is installed" check_component_installed "rustfmt"
check "clippy is installed" check_component_installed "clippy"
# Report result
reportResults