From 81942c8299ade2a7c017362711dbca501d217db1 Mon Sep 17 00:00:00 2001 From: Chris Gavin Date: Wed, 9 Sep 2020 15:50:49 +0100 Subject: [PATCH] Convert CodeQL Windows test to a Pester test. --- images/win/scripts/Installers/Install-CodeQLBundle.ps1 | 3 ++- images/win/scripts/Tests/Tools.Tests.ps1 | 7 +++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/images/win/scripts/Installers/Install-CodeQLBundle.ps1 b/images/win/scripts/Installers/Install-CodeQLBundle.ps1 index 7878d6c6..d5ecf1b5 100644 --- a/images/win/scripts/Installers/Install-CodeQLBundle.ps1 +++ b/images/win/scripts/Installers/Install-CodeQLBundle.ps1 @@ -19,4 +19,5 @@ $UnGzipedCodeQLBundlePath = Join-Path $DownloadDirectoryPath "codeql-bundle.tar" Extract-7Zip -Path $UnGzipedCodeQLBundlePath -DestinationPath $ExtractionDirectory # Test that the tool has been extracted successfully. -& (Join-Path $ExtractionDirectory "codeql" "codeql.exe") version +$Env:CODEQL_EXTRACTION_DIRECTORY = $ExtractionDirectory +Invoke-PesterTests -TestFile "Tools" -TestName "CodeQLBundle" diff --git a/images/win/scripts/Tests/Tools.Tests.ps1 b/images/win/scripts/Tests/Tools.Tests.ps1 index 88f2ca88..c2b52baf 100644 --- a/images/win/scripts/Tests/Tools.Tests.ps1 +++ b/images/win/scripts/Tests/Tools.Tests.ps1 @@ -41,6 +41,13 @@ Describe "CMake" { } } +Describe "CodeQLBundle" { + It "CodeQLBundle" { + $CodeQLPath = Join-Path $Env:CODEQL_EXTRACTION_DIRECTORY -ChildPath "codeql" | Join-Path -ChildPath "codeql.exe" + "$CodeQLPath version" | Should -ReturnZeroExitCode + } +} + Describe "R" { It "Rscript" { "Rscript --version" | Should -ReturnZeroExitCode