diff --git a/images/macos/provision/core/rust.sh b/images/macos/provision/core/rust.sh index c856b30a6..f9fafc3b8 100644 --- a/images/macos/provision/core/rust.sh +++ b/images/macos/provision/core/rust.sh @@ -1,5 +1,6 @@ #!/bin/bash -e -o pipefail source ~/utils/utils.sh +source ~/utils/invoke-tests.sh echo Installing Rustup... brew_smart_install "rustup-init" @@ -16,3 +17,5 @@ cargo install bindgen cbindgen cargo-audit cargo-outdated echo Cleanup Cargo registry cached data... rm -rf $CARGO_HOME/registry/* + +invoke_tests "Rust" diff --git a/images/macos/provision/core/swiftlint.sh b/images/macos/provision/core/swiftlint.sh index c9018cbb4..7f94f3b8b 100644 --- a/images/macos/provision/core/swiftlint.sh +++ b/images/macos/provision/core/swiftlint.sh @@ -1,5 +1,5 @@ #!/bin/bash -e -o pipefail - +source ~/utils/invoke-tests.sh source ~/utils/utils.sh echo "Install SwiftLint" @@ -7,3 +7,5 @@ swiftlintUrl=$(curl -s "https://api.github.com/repos/realm/SwiftLint/releases/la download_with_retries $swiftlintUrl "/tmp" "SwiftLint.pkg" sudo installer -pkg /tmp/SwiftLint.pkg -target / rm -rf /tmp/SwiftLint.pkg + +invoke_tests "Linters" "SwiftLint" \ No newline at end of file diff --git a/images/macos/provision/core/toolcache-high-sierra.sh b/images/macos/provision/core/toolcache-high-sierra.sh index 9a67418b3..a834d87a4 100644 --- a/images/macos/provision/core/toolcache-high-sierra.sh +++ b/images/macos/provision/core/toolcache-high-sierra.sh @@ -4,7 +4,6 @@ # and installs them onto the system # ########################################################################### - SOURCE_URL="https://vstsagenttools.blob.core.windows.net/tools" PACKAGES_DIR=/tmp/hostedtoolcache @@ -23,4 +22,4 @@ for package in $packages; do pushd $(dirname $package) npm install popd -done; +done; \ No newline at end of file diff --git a/images/macos/provision/core/toolset.ps1 b/images/macos/provision/core/toolset.ps1 index 8241f4ab5..c9ebc5250 100644 --- a/images/macos/provision/core/toolset.ps1 +++ b/images/macos/provision/core/toolset.ps1 @@ -3,7 +3,7 @@ ## Team: CI-Build ## Desc: Install toolset ################################################################################ - +Import-Module "~/image-generation/helpers/Tests.Helpers.psm1" Import-Module "~/image-generation/helpers/Common.Helpers.psm1" Function Get-ToolcacheFromToolset { @@ -57,4 +57,6 @@ foreach ($tool in $tools) { exit 1 } } -} \ No newline at end of file +} + +Invoke-PesterTests "Toolcache" \ No newline at end of file diff --git a/images/macos/provision/core/vcpkg.sh b/images/macos/provision/core/vcpkg.sh index 260f2c2aa..6317861e8 100644 --- a/images/macos/provision/core/vcpkg.sh +++ b/images/macos/provision/core/vcpkg.sh @@ -1,5 +1,5 @@ #!/bin/bash -e -o pipefail - +source ~/utils/invoke-tests.sh source ~/utils/utils.sh # Set env variable for vcpkg @@ -12,3 +12,5 @@ $VCPKG_INSTALLATION_ROOT/bootstrap-vcpkg.sh $VCPKG_INSTALLATION_ROOT/vcpkg integrate install chmod -R 0777 $VCPKG_INSTALLATION_ROOT ln -sf $VCPKG_INSTALLATION_ROOT/vcpkg /usr/local/bin + +invoke_tests "Common" "vcpkg" diff --git a/images/macos/provision/core/vsmac.sh b/images/macos/provision/core/vsmac.sh index f0c498fc8..86d789ae7 100644 --- a/images/macos/provision/core/vsmac.sh +++ b/images/macos/provision/core/vsmac.sh @@ -1,7 +1,7 @@ #!/bin/bash -e -o pipefail - source ~/utils/utils.sh source ~/utils/xamarin-utils.sh +source ~/utils/invoke-tests.sh VSMAC_VERSION=$(get_toolset_value '.xamarin.vsmac') if [ $VSMAC_VERSION == "latest" ]; then @@ -25,4 +25,7 @@ tar cf - "./Visual Studio.app" | tar xf - -C /Applications/ popd sudo hdiutil detach "$TMPMOUNT" -sudo rm -rf "$TMPMOUNT" \ No newline at end of file +sudo rm -rf "$TMPMOUNT" + +invoke_tests "Common" "VSMac" + diff --git a/images/macos/provision/core/xamarin-android-ndk.sh b/images/macos/provision/core/xamarin-android-ndk.sh index adb8900de..50373b4cf 100644 --- a/images/macos/provision/core/xamarin-android-ndk.sh +++ b/images/macos/provision/core/xamarin-android-ndk.sh @@ -62,4 +62,6 @@ fi # Latest versions of NDK doesn't include GCC, NDK r18 does echo "Installing ndk r18B..." echo y | $SDKMANAGER "ndk;18.1.5063045" -echo "export ANDROID_NDK_18R_PATH=${ANDROID_HOME}/ndk/18.1.5063045" >> "${HOME}/.bashrc" \ No newline at end of file +echo "export ANDROID_NDK_18R_PATH=${ANDROID_HOME}/ndk/18.1.5063045" >> "${HOME}/.bashrc" + +invoke_tests "XamarinNDK" \ No newline at end of file diff --git a/images/macos/provision/core/xamarin.sh b/images/macos/provision/core/xamarin.sh index 387e3f45f..f5dd6c5d5 100755 --- a/images/macos/provision/core/xamarin.sh +++ b/images/macos/provision/core/xamarin.sh @@ -1,5 +1,5 @@ #!/bin/bash -e -o pipefail - +source ~/utils/invoke-tests.sh source ~/utils/utils.sh source ~/utils/xamarin-utils.sh @@ -88,3 +88,5 @@ sudo rm -rf "$TMPMOUNT" PREFERENCES_XAMARIN_DIR="${HOME}/Library/Preferences/Xamarin" mkdir -p $PREFERENCES_XAMARIN_DIR /usr/libexec/PlistBuddy -c "add :AppleSdkRoot string /Applications/Xcode_${DEFAULT_XCODE_VERSION}.app" $PREFERENCES_XAMARIN_DIR/Settings.plist + +invoke_tests "Xamarin" diff --git a/images/macos/provision/core/xcode.ps1 b/images/macos/provision/core/xcode.ps1 index 46f115189..9a3306b34 100644 --- a/images/macos/provision/core/xcode.ps1 +++ b/images/macos/provision/core/xcode.ps1 @@ -41,4 +41,5 @@ Switch-Xcode -Version $defaultXcode New-Item -Path "/Applications/Xcode.app" -ItemType SymbolicLink -Value (Get-XcodeRootPath -Version $defaultXcode) | Out-Null Write-Host "Setting environment variables 'XCODE__DEVELOPER_DIR'" -Set-XcodeDeveloperDirEnvironmentVariables -XcodeList $xcodeVersions.link \ No newline at end of file +Set-XcodeDeveloperDirEnvironmentVariables -XcodeList $xcodeVersions.link + diff --git a/images/macos/tests/Common.Tests.ps1 b/images/macos/tests/Common.Tests.ps1 index 70efa155b..565f30bfd 100644 --- a/images/macos/tests/Common.Tests.ps1 +++ b/images/macos/tests/Common.Tests.ps1 @@ -166,38 +166,6 @@ Describe "Homebrew" { } } -Describe "Rust" -Skip:($os.IsHighSierra) { - It "Rustup is installed" { - "rustup --version" | Should -ReturnZeroExitCode - } - - It "Rustc is installed" { - "rustc --version" | Should -ReturnZeroExitCode - } - - It "Cargo is installed" { - "cargo --version" | Should -ReturnZeroExitCode - } - - Context "Cargo dependencies" { - It "bindgen" { - "bindgen --version" | Should -ReturnZeroExitCode - } - - It "cbindgen" { - "cbindgen --version" | Should -ReturnZeroExitCode - } - - It "Cargo audit" { - "cargo audit --version" | Should -ReturnZeroExitCode - } - - It "Cargo outdated" { - "cargo outdated --version" | Should -ReturnZeroExitCode - } - } -} - Describe "GCC" -Skip:($os.IsHighSierra) { $testCases = @("8", "9", "10") | ForEach-Object { @{Version = $_} } @@ -240,15 +208,6 @@ Describe "Newman" -Skip:($os.IsHighSierra -or $os.IsMojave) { } } -Describe "Visual Studio For Mac" { - It "VS4Mac is installed" { - $vsPath = "/Applications/Visual Studio.app" - $vstoolPath = Join-Path $vsPath "Contents/MacOS/vstool" - $vsPath | Should -Exist - $vstoolPath | Should -Exist - } -} - Describe "AWS" { It "AWS CLI" { "aws --version" | Should -ReturnZeroExitCode @@ -314,4 +273,13 @@ Describe "CocoaPods" { It "CocoaPods" { "pod --version" | Should -ReturnZeroExitCode } +} + +Describe "VSMac" { + It "VS4Mac is installed" { + $vsPath = "/Applications/Visual Studio.app" + $vstoolPath = Join-Path $vsPath "Contents/MacOS/vstool" + $vsPath | Should -Exist + $vstoolPath | Should -Exist + } } \ No newline at end of file diff --git a/images/macos/tests/Linters.Tests.ps1 b/images/macos/tests/Linters.Tests.ps1 index 4a383dbd2..6517b56df 100644 --- a/images/macos/tests/Linters.Tests.ps1 +++ b/images/macos/tests/Linters.Tests.ps1 @@ -2,7 +2,7 @@ Import-Module "$PSScriptRoot/../helpers/Tests.Helpers.psm1" -DisableNameChecking $os = Get-OSVersion -Describe "Linters" { +Describe "SwiftLint" { It "SwiftLint" -Skip:($os.IsHighSierra) { "swiftlint version" | Should -ReturnZeroExitCode } diff --git a/images/macos/tests/Rust.Tests.ps1 b/images/macos/tests/Rust.Tests.ps1 new file mode 100644 index 000000000..405724d53 --- /dev/null +++ b/images/macos/tests/Rust.Tests.ps1 @@ -0,0 +1,37 @@ +$os = Get-OSVersion + +Describe "Rust" -Skip:($os.IsHighSierra) { + Context "Rust" { + It "Rustup is installed" { + "rustup --version" | Should -ReturnZeroExitCode + } + + It "Rustc is installed" { + "rustc --version" | Should -ReturnZeroExitCode + } + } + + Context "Cargo" { + It "Cargo is installed" { + "cargo --version" | Should -ReturnZeroExitCode + } + } + + Context "Cargo dependencies" { + It "bindgen" { + "bindgen --version" | Should -ReturnZeroExitCode + } + + It "cbindgen" { + "cbindgen --version" | Should -ReturnZeroExitCode + } + + It "Cargo audit" { + "cargo audit --version" | Should -ReturnZeroExitCode + } + + It "Cargo outdated" { + "cargo outdated --version" | Should -ReturnZeroExitCode + } + } +} \ No newline at end of file