diff --git a/images/linux/scripts/installers/7-zip.sh b/images/linux/scripts/installers/7-zip.sh index 787c06913..a2c614a89 100644 --- a/images/linux/scripts/installers/7-zip.sh +++ b/images/linux/scripts/installers/7-zip.sh @@ -10,5 +10,4 @@ source $HELPER_SCRIPTS/invoke-tests.sh apt-get update -y apt-get install -y p7zip p7zip-full p7zip-rar -# Run tests to determine that the software installed as expected invoke_tests "Tools" "7-Zip" \ No newline at end of file diff --git a/images/linux/scripts/installers/ansible.sh b/images/linux/scripts/installers/ansible.sh index 0f123bbd9..d30a84c6b 100644 --- a/images/linux/scripts/installers/ansible.sh +++ b/images/linux/scripts/installers/ansible.sh @@ -6,6 +6,7 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/os.sh +source $HELPER_SCRIPTS/invoke-tests.sh # ppa:ansible/ansible doesn't contain packages for Ubuntu20.04 if isUbuntu16 || isUbuntu18 ; then @@ -16,9 +17,4 @@ fi # Install latest Ansible apt-get install -y --no-install-recommends ansible -# 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 ansible; then - echo "Ansible was not installed or found on PATH" - exit 1 -fi +invoke_tests "Tools" "Ansible" diff --git a/images/linux/scripts/installers/azcopy.sh b/images/linux/scripts/installers/azcopy.sh index ecaa13580..d8c4d7a3c 100644 --- a/images/linux/scripts/installers/azcopy.sh +++ b/images/linux/scripts/installers/azcopy.sh @@ -18,5 +18,4 @@ tar zxvf /tmp/azcopy.tar.gz --strip-components=1 -C /tmp mv /tmp/azcopy /usr/local/bin/azcopy10 chmod +x /usr/local/bin/azcopy10 -# Run tests to determine that the software installed as expected invoke_tests "Tools" "azcopy" \ No newline at end of file diff --git a/images/linux/scripts/installers/bazel.sh b/images/linux/scripts/installers/bazel.sh index 8a7c6bcb0..1108c4684 100644 --- a/images/linux/scripts/installers/bazel.sh +++ b/images/linux/scripts/installers/bazel.sh @@ -4,6 +4,8 @@ ## Desc: Installs Bazel and Bazelisk (A user-friendly launcher for Bazel) ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Install bazel curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add - echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list @@ -13,14 +15,4 @@ apt-get install -y bazel # Install bazelisk npm install -g @bazel/bazelisk -# 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 bazel; then - echo "Bazel was not installed" - exit 1 -fi - -if ! command -v bazelisk; then - echo "Bazelisk was not installed" - exit 1 -fi +invoke_tests "Tools" "Bazel" \ No newline at end of file diff --git a/images/linux/scripts/installers/clang.sh b/images/linux/scripts/installers/clang.sh index e7261f0a1..0cb73f833 100644 --- a/images/linux/scripts/installers/clang.sh +++ b/images/linux/scripts/installers/clang.sh @@ -6,6 +6,7 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/os.sh +source $HELPER_SCRIPTS/invoke-tests.sh function InstallClang { local version=$1 @@ -16,16 +17,7 @@ function InstallClang { apt-get install -y "clang-format-$version" else apt-get install -y "clang-$version" "lldb-$version" "lld-$version" "clang-format-$version" - fi - - # Run tests to determine that the software installed as expected - echo "Testing to make sure that script performed as expected, and basic scenarios work" - for cmd in clang-$version clang++-$version; do - if ! command -v $cmd; then - echo "$cmd was not installed" - exit 1 - fi - done + fi } function SetDefaultClang { @@ -41,15 +33,10 @@ function SetDefaultClang { wget https://apt.llvm.org/llvm.sh chmod +x llvm.sh -if isUbuntu16 || isUbuntu18; then - versions=( "6.0" "8" "9" ) - default_clang_version="9" -fi +toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" -if isUbuntu20 ; then - versions=( "8" "9" "10" ) - default_clang_version="10" -fi +versions=$(jq -r '.clang.versions[]' $toolset) +default_clang_version=$(jq -r '.clang.default_version' $toolset) for version in ${versions[*]}; do InstallClang $version @@ -57,3 +44,5 @@ done SetDefaultClang $default_clang_version rm llvm.sh + +invoke_tests "Tools" "clang" \ No newline at end of file diff --git a/images/linux/scripts/installers/cmake.sh b/images/linux/scripts/installers/cmake.sh index 893432111..6f6a6ed1e 100644 --- a/images/linux/scripts/installers/cmake.sh +++ b/images/linux/scripts/installers/cmake.sh @@ -4,6 +4,8 @@ ## Desc: Installs CMake ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + # Test to see if the software in question is already installed, if not install it echo "Checking to see if the installer script has already been run" if command -v cmake; then @@ -16,9 +18,4 @@ else && rm cmakeinstall.sh fi -# 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 cmake; then - echo "cmake was not installed" - exit 1 -fi +invoke_tests "Tools" "Cmake" diff --git a/images/linux/scripts/installers/erlang.sh b/images/linux/scripts/installers/erlang.sh index 467b4cd79..24f855e73 100644 --- a/images/linux/scripts/installers/erlang.sh +++ b/images/linux/scripts/installers/erlang.sh @@ -4,6 +4,8 @@ ## Desc: Installs erlang ################################################################################ +source $HELPER_SCRIPTS/invoke-tests.sh + source_list=/etc/apt/sources.list.d/eslerlang.list # Install Erlang @@ -17,14 +19,7 @@ wget -q -O rebar3 https://s3.amazonaws.com/rebar3/rebar3 chmod +x rebar3 mv rebar3 /usr/local/bin/rebar3 -# Run tests to determine that the software installed as expected -echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in erl erlc rebar3; do - if ! command -v $cmd; then - echo "$cmd was not installed or not found on PATH" - exit 1 - fi -done +invoke_tests "Tools" "erlang" # Clean up source list rm $source_list diff --git a/images/linux/scripts/installers/gcc.sh b/images/linux/scripts/installers/gcc.sh index 3b696e9ff..67767ff10 100644 --- a/images/linux/scripts/installers/gcc.sh +++ b/images/linux/scripts/installers/gcc.sh @@ -6,35 +6,25 @@ # Source the helpers for use with the script source $HELPER_SCRIPTS/os.sh +source $HELPER_SCRIPTS/invoke-tests.sh function InstallGcc { version=$1 echo "Installing $version..." apt-get install $version -y - - # 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 $version; then - echo "$version was not installed" - exit 1 - fi } # Install GNU C++ compiler add-apt-repository ppa:ubuntu-toolchain-r/test -y apt-get update -y -versions=( - "g++-7" - "g++-8" - "g++-9" -) +toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" -if ! isUbuntu16; then - versions+=("g++-10") -fi +versions=$(jq -r '.gcc.versions[]' $toolset) for version in ${versions[*]}; do InstallGcc $version done + +invoke_tests "Tools" "gcc" \ No newline at end of file diff --git a/images/linux/scripts/installers/gfortran.sh b/images/linux/scripts/installers/gfortran.sh index b82e8d39a..84080c557 100644 --- a/images/linux/scripts/installers/gfortran.sh +++ b/images/linux/scripts/installers/gfortran.sh @@ -3,36 +3,27 @@ ## File: gfortran.sh ## Desc: Installs GNU Fortran ################################################################################ + source $HELPER_SCRIPTS/os.sh +source $HELPER_SCRIPTS/invoke-tests.sh function InstallFortran { version=$1 echo "Installing $version..." apt-get install $version -y - - # 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 $version; then - echo "$version was not installed" - exit 1 - fi } # Install GNU Fortran compiler add-apt-repository ppa:ubuntu-toolchain-r/test -y apt-get update -y -versions=( - "gfortran-8" - "gfortran-9" -) - -if ! isUbuntu16; then - versions+=("gfortran-10") -fi +toolset="$INSTALLER_SCRIPT_FOLDER/toolset.json" +versions=$(jq -r '.gfortran.versions[]' $toolset) for version in ${versions[*]} do InstallFortran $version done + +invoke_tests "Tools" "gfortran" \ 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 2d257b128..19e10d3b5 100644 --- a/images/linux/scripts/tests/Tools.Tests.ps1 +++ b/images/linux/scripts/tests/Tools.Tests.ps1 @@ -14,4 +14,74 @@ Describe "azcopy" { It "azcopy10" { "azcopy10 --version" | Should -ReturnZeroExitCode } +} + +Describe "Ansible" { + It "Ansible" { + "ansible --version" | Should -ReturnZeroExitCode + } +} + +Describe "Bazel" { + It "" -TestCases @( + @{ ToolName = "bazel" } + @{ ToolName = "bazelisk" } + ) { + "$ToolName --version"| Should -ReturnZeroExitCode + } +} + +Describe "clang" { + [array]$testCases = (Get-ToolsetContent).clang.Versions | ForEach-Object { @{ClangVersion = $_} } + + It "clang " -TestCases $testCases { + param ( + [string] $ClangVersion + ) + + "clang-$ClangVersion --version" | Should -ReturnZeroExitCode + "clang++-$ClangVersion --version" | Should -ReturnZeroExitCode + } +} + +Describe "Cmake" { + It "cmake" { + "cmake --version" | Should -ReturnZeroExitCode + } +} + +Describe "erlang" { + $testCases = @("erl", "erlc", "rebar3") | ForEach-Object { @{ErlangCommand = $_} } + + It "erlang " -TestCases $testCases { + param ( + [string] $ErlangCommand + ) + + "$ErlangCommand -v" | Should -ReturnZeroExitCode + } +} + +Describe "gcc" { + [array]$testCases = (Get-ToolsetContent).gcc.Versions | ForEach-Object { @{GccVersion = $_} } + + It "gcc " -TestCases $testCases { + param ( + [string] $GccVersion + ) + + "$GccVersion --version" | Should -ReturnZeroExitCode + } +} + +Describe "gfortran" { + [array]$testCases = (Get-ToolsetContent).gfortran.Versions | ForEach-Object { @{GfortranVersion = $_} } + + It "gfortran " -TestCases $testCases { + param ( + [string] $GfortranVersion + ) + + "$GfortranVersion --version" | Should -ReturnZeroExitCode + } } \ No newline at end of file diff --git a/images/linux/toolsets/toolset-1604.json b/images/linux/toolsets/toolset-1604.json index 1ee8a2a59..0297fa57f 100644 --- a/images/linux/toolsets/toolset-1604.json +++ b/images/linux/toolsets/toolset-1604.json @@ -214,5 +214,26 @@ "3.1", "5.0" ] + }, + "clang": { + "versions": [ + "6.0", + "8", + "9" + ], + "default_version": "9" + }, + "gcc": { + "versions": [ + "g++-7", + "g++-8", + "g++-9" + ] + }, + "gfortran": { + "versions": [ + "gfortran-8", + "gfortran-9" + ] } } diff --git a/images/linux/toolsets/toolset-1804.json b/images/linux/toolsets/toolset-1804.json index 849766667..bc17b6a18 100644 --- a/images/linux/toolsets/toolset-1804.json +++ b/images/linux/toolsets/toolset-1804.json @@ -218,5 +218,28 @@ "3.1", "5.0" ] + }, + "clang": { + "versions": [ + "6.0", + "8", + "9" + ], + "default_version": "9" + }, + "gcc": { + "versions": [ + "g++-7", + "g++-8", + "g++-9", + "g++-10" + ] + }, + "gfortran": { + "versions": [ + "gfortran-8", + "gfortran-9", + "gfortran-10" + ] } } diff --git a/images/linux/toolsets/toolset-2004.json b/images/linux/toolsets/toolset-2004.json index 0fa2e990d..761e6daa1 100644 --- a/images/linux/toolsets/toolset-2004.json +++ b/images/linux/toolsets/toolset-2004.json @@ -190,5 +190,28 @@ "3.1", "5.0" ] + }, + "clang": { + "versions": [ + "8", + "9", + "10" + ], + "default_version": "10" + }, + "gcc": { + "versions": [ + "g++-7", + "g++-8", + "g++-9", + "g++-10" + ] + }, + "gfortran": { + "versions": [ + "gfortran-8", + "gfortran-9", + "gfortran-10" + ] } }