diff --git a/images/linux/scripts/installers/firefox.sh b/images/linux/scripts/installers/firefox.sh index a2cd8521f..dcedb798e 100644 --- a/images/linux/scripts/installers/firefox.sh +++ b/images/linux/scripts/installers/firefox.sh @@ -4,15 +4,11 @@ ## Desc: Installs Firefox ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Install Firefox apt-get install -y firefox -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v firefox; then - exit 1 -fi - # add to gloabl system preferences for firefox locale en_US, because other browsers have en_US local. # Default firefox local is en_GB echo 'pref("intl.locale.requested","en_US");' >> "/usr/lib/firefox/browser/defaults/preferences/syspref.js" @@ -34,9 +30,4 @@ chmod +x $GECKODRIVER_BIN ln -s "$GECKODRIVER_BIN" /usr/bin/ echo "GECKOWEBDRIVER=$GECKODRIVER_DIR" | tee -a /etc/environment -# Run tests to determine that the geckodriver installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v geckodriver; then - echo "geckodriver was not installed" - exit 1 -fi +invoke_tests "Browsers" "Firefox" diff --git a/images/linux/scripts/installers/google-chrome.sh b/images/linux/scripts/installers/google-chrome.sh index 481e16af0..ba3c54ebb 100644 --- a/images/linux/scripts/installers/google-chrome.sh +++ b/images/linux/scripts/installers/google-chrome.sh @@ -4,6 +4,8 @@ ## Desc: Installs google-chrome and chromedriver ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + LSB_RELEASE=$(lsb_release -rs) wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - @@ -12,13 +14,6 @@ apt-get update apt-get install -y google-chrome-stable echo "CHROME_BIN=/usr/bin/google-chrome" | tee -a /etc/environment -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v google-chrome; then - echo "google-chrome was not installed" - exit 1 -fi - CHROME_VERSION=$(google-chrome --product-version) CHROME_VERSION=${CHROME_VERSION%.*} @@ -41,9 +36,4 @@ chmod +x $CHROMEDRIVER_BIN ln -s "$CHROMEDRIVER_BIN" /usr/bin/ echo "CHROMEWEBDRIVER=$CHROMEDRIVER_DIR" | tee -a /etc/environment -# Run tests to determine that the chromedriver installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -if ! command -v chromedriver; then - echo "chromedriver was not installed" - exit 1 -fi +invoke_tests "Browsers" "Chrome" \ No newline at end of file diff --git a/images/linux/scripts/installers/rust.sh b/images/linux/scripts/installers/rust.sh index c86f4d6ad..f848fd20f 100644 --- a/images/linux/scripts/installers/rust.sh +++ b/images/linux/scripts/installers/rust.sh @@ -6,6 +6,7 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/etc-environment.sh +source $HELPER_SCRIPTS/invoke-tests.sh export RUSTUP_HOME=/usr/share/rust/.rustup export CARGO_HOME=/usr/share/rust/.cargo @@ -21,18 +22,9 @@ cargo install bindgen cbindgen cargo install cargo-audit cargo install cargo-outdated -echo "Test installation of the Rust toochain" - # Permissions chmod -R 777 $(dirname $RUSTUP_HOME) -for cmd in rustup rustc rustdoc cargo rustfmt cargo-clippy bindgen cbindgen 'cargo audit' 'cargo outdated'; do - if ! command -v $cmd --version; then - echo "$cmd was not installed or is not found on the path" - exit 1 - fi -done - # Cleanup Cargo cache rm -rf ${CARGO_HOME}/registry/* @@ -44,3 +36,5 @@ pushd /etc/skel ln -sf $RUSTUP_HOME .rustup ln -sf $CARGO_HOME .cargo popd + +invoke_tests "Tools" "Rust" \ No newline at end of file diff --git a/images/linux/scripts/tests/Browsers.Tests.ps1 b/images/linux/scripts/tests/Browsers.Tests.ps1 new file mode 100644 index 000000000..b96e1c2ae --- /dev/null +++ b/images/linux/scripts/tests/Browsers.Tests.ps1 @@ -0,0 +1,19 @@ +Describe "Firefox" { + It "Firefox" { + "sudo -i firefox --version" | Should -ReturnZeroExitCode + } + + It "Geckodriver" { + "geckodriver --version" | Should -ReturnZeroExitCode + } +} + +Describe "Chrome" { + It "Chrome" { + "google-chrome --version" | Should -ReturnZeroExitCode + } + + It "Chrome Driver" { + "chromedriver --version" | Should -ReturnZeroExitCode + } +} \ No newline at end of file diff --git a/images/linux/scripts/tests/Tools.Tests.ps1 b/images/linux/scripts/tests/Tools.Tests.ps1 index 5ed2f75bf..2c0e8830c 100644 --- a/images/linux/scripts/tests/Tools.Tests.ps1 +++ b/images/linux/scripts/tests/Tools.Tests.ps1 @@ -16,6 +16,49 @@ Describe "azcopy" { } } +Describe "Rust" { + It "Rustup is installed" { + "rustup --version" | Should -ReturnZeroExitCode + } + + It "Rustc is installed" { + "rustc --version" | Should -ReturnZeroExitCode + } + + It "Rustdoc is installed" { + "rustdoc --version" | Should -ReturnZeroExitCode + } + + It "Rustfmt is installed" { + "rustfmt --version" | Should -ReturnZeroExitCode + } + + Context "Cargo dependencies" { + It "bindgen" { + "bindgen --version" | Should -ReturnZeroExitCode + } + + It "cbindgen" { + "cbindgen --version" | Should -ReturnZeroExitCode + } + + It "cargo" { + "cargo --version" | Should -ReturnZeroExitCode + } + + It "cargo-clippy" { + "cargo-clippy --version" | Should -ReturnZeroExitCode + } + + It "Cargo audit" { + "cargo audit --version" | Should -ReturnZeroExitCode + } + + It "Cargo outdated" { + "cargo outdated --version" | Should -ReturnZeroExitCode + } + } +} Describe "Docker" { It "docker" { "docker --version" | Should -ReturnZeroExitCode