File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -401,8 +401,8 @@ if [ "${CUSTOM_COMPONENTS}" = "true" ] && [ -n "${RUST_COMPONENTS}" ]; then
401401 echo " Installing custom Rust components..."
402402 IFS=' ,' read -ra components <<< " ${RUST_COMPONENTS}"
403403 for component in " ${components[@]} " ; do
404- # Trim whitespace
405- component=$( echo " ${component} " | xargs )
404+ # Trim leading and trailing whitespace
405+ component=" ${component # " ${component%% [![:space:]] * } " } " && component= " ${component % " ${component ##* [![:space:]]} " } "
406406 if [ -n " ${component} " ]; then
407407 echo " Installing Rust component: ${component} "
408408 if ! rustup component add " ${component} " 2>&1 ; then
Original file line number Diff line number Diff line change 55# Optional: Import test library
66source dev-container-features-test-lib
77
8+ # Helper function to check component is installed
9+ check_component_installed () {
10+ local component=$1
11+ if rustup component list | grep -q " ${component} .*installed" ; then
12+ return 0 # Component is installed (success)
13+ else
14+ return 1 # Component is not installed (failure)
15+ fi
16+ }
17+
818# Definition specific tests
919check " cargo version" cargo --version
1020check " rustc version" rustc --version
1121check " correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
1222
23+ # Check that all specified extended components are installed
24+ check " rust-analyzer is installed" check_component_installed " rust-analyzer"
25+ check " rust-src is installed" check_component_installed " rust-src"
26+ check " rustfmt is installed" check_component_installed " rustfmt"
27+ check " clippy is installed" check_component_installed " clippy"
28+ check " rust-docs is installed" check_component_installed " rust-docs"
1329
1430# Report result
1531reportResults
Original file line number Diff line number Diff line change 55# Optional: Import test library
66source dev-container-features-test-lib
77
8+ # Helper function to check component is installed
9+ check_component_installed () {
10+ local component=$1
11+ if rustup component list | grep -q " ${component} .*installed" ; then
12+ return 0 # Component is installed (success)
13+ else
14+ return 1 # Component is not installed (failure)
15+ fi
16+ }
17+
818# Definition specific tests
919check " cargo version" cargo --version
1020check " rustc version" rustc --version
1121check " correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
1222
23+ # Check that all specified extended components are installed
24+ check " rust-analyzer is installed" check_component_installed " rust-analyzer"
25+ check " rust-src is installed" check_component_installed " rust-src"
26+ check " rustfmt is installed" check_component_installed " rustfmt"
27+ check " clippy is installed" check_component_installed " clippy"
28+ check " rust-docs is installed" check_component_installed " rust-docs"
1329
1430# Report result
1531reportResults
Original file line number Diff line number Diff line change 55# Optional: Import test library
66source dev-container-features-test-lib
77
8+ # Helper function to check component is installed
9+ check_component_installed () {
10+ local component=$1
11+ if rustup component list | grep -q " ${component} .*installed" ; then
12+ return 0 # Component is installed (success)
13+ else
14+ return 1 # Component is not installed (failure)
15+ fi
16+ }
17+
818# Definition specific tests
919check " cargo version" cargo --version
1020check " rustc version" rustc --version
1121check " correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
1222
23+ # Check that all specified extended components are installed
24+ check " rust-analyzer is installed" check_component_installed " rust-analyzer"
25+ check " rust-src is installed" check_component_installed " rust-src"
26+ check " rustfmt is installed" check_component_installed " rustfmt"
27+ check " clippy is installed" check_component_installed " clippy"
28+ check " rust-docs is installed" check_component_installed " rust-docs"
1329
1430# Report result
1531reportResults
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ check_component_not_installed() {
2828# Definition specific tests
2929check " cargo version" cargo --version
3030check " rustc version" rustc --version
31+ check " correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
3132
3233# Check that specified custom components are installed
3334check " rust-analyzer is installed" check_component_installed " rust-analyzer"
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ check_component_installed() {
1818# Definition specific tests
1919check " cargo version" cargo --version
2020check " rustc version" rustc --version
21+ check " correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
2122
2223# Check that default components are installed
2324check " rust-analyzer is installed" check_component_installed " rust-analyzer"
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ check_component_not_installed() {
2828# Definition specific tests
2929check " cargo version" cargo --version
3030check " rustc version" rustc --version
31+ check " correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
3132
3233# Check that no additional components are installed when empty list is provided
3334# Only the basic rust toolchain should be available
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ check_component_installed() {
1818# Definition specific tests
1919check " cargo version" cargo --version
2020check " rustc version" rustc --version
21+ check " correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
2122
2223# Check that all specified extended components are installed
2324check " rust-analyzer is installed" check_component_installed " rust-analyzer"
Original file line number Diff line number Diff line change 55# Optional: Import test library
66source dev-container-features-test-lib
77
8+ # Helper function to check component is installed
9+ check_component_installed () {
10+ local component=$1
11+ if rustup component list | grep -q " ${component} .*installed" ; then
12+ return 0 # Component is installed (success)
13+ else
14+ return 1 # Component is not installed (failure)
15+ fi
16+ }
17+
818# Definition specific tests
919check " cargo version" cargo --version
1020check " rustc version" rustc --version
1121check " correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
1222
23+ # Check that all specified extended components are installed
24+ check " rust-analyzer is installed" check_component_installed " rust-analyzer"
25+ check " rust-src is installed" check_component_installed " rust-src"
26+ check " rustfmt is installed" check_component_installed " rustfmt"
27+ check " clippy is installed" check_component_installed " clippy"
28+ check " rust-docs is installed" check_component_installed " rust-docs"
1329
1430# Report result
1531reportResults
Original file line number Diff line number Diff line change 55# Optional: Import test library
66source dev-container-features-test-lib
77
8+ # Helper function to check component is installed
9+ check_component_installed () {
10+ local component=$1
11+ if rustup component list | grep -q " ${component} .*installed" ; then
12+ return 0 # Component is installed (success)
13+ else
14+ return 1 # Component is not installed (failure)
15+ fi
16+ }
17+
818# Definition specific tests
919check " cargo version" cargo --version
1020check " rustc version" rustc --version
1121check " correct rust version" rustup target list | grep aarch64-unknown-linux-gnu
1222
23+ # Check that all specified extended components are installed
24+ check " rust-analyzer is installed" check_component_installed " rust-analyzer"
25+ check " rust-src is installed" check_component_installed " rust-src"
26+ check " rustfmt is installed" check_component_installed " rustfmt"
27+ check " clippy is installed" check_component_installed " clippy"
28+ check " rust-docs is installed" check_component_installed " rust-docs"
1329
1430# Report result
1531reportResults
You can’t perform that action at this time.
0 commit comments