Free cookie consent management tool by TermsFeed Policy Generator

source: branches/3140_NumberSymbol/Test.ps1 @ 18183

Last change on this file since 18183 was 18070, checked in by jkarder, 3 years ago

#3017: sign Build.ps1 and Test.ps1

File size: 11.2 KB
Line 
1# find ms build
2$programFilesX86Dir = ($Env:ProgramFiles, ${Env:ProgramFiles(x86)})[[bool]${Env:ProgramFiles(x86)}]
3$vsDir = [System.IO.Path]::Combine($programFilesX86Dir, "Microsoft Visual Studio")
4$years = @("2019", "2017")
5$editions = @("Enterprise", "Professional", "Community", "BuildTools")
6$versions = @("Current", "15.0")
7
8$msBuildPath = $undefined
9$vstestPath = $undefined
10:search Foreach ($year in $years) {
11  $loc = [System.IO.Path]::Combine($vsDir, $year)
12  Foreach ($edition in $editions) {
13    $edLoc = [System.IO.Path]::Combine($loc, $edition, "MSBuild")
14    Foreach ($version in $versions) {
15      $binLoc = [System.IO.Path]::Combine($edLoc, $version, "Bin")
16      $loc64 = [System.IO.Path]::Combine($binLoc, "amd64", "MSBuild.exe")
17      $loc32 = [System.IO.Path]::Combine($binLoc, "MSBuild.exe")
18
19      If ([System.IO.File]::Exists($loc64)) {
20        $msBuildPath = $loc64
21        $vstestPath = [System.IO.Path]::Combine($loc, $edition, "Common7", "IDE", "CommonExtensions", "Microsoft", "TestWindow", "vstest.console.exe")
22        Break search;
23      }
24      If ([System.IO.File]::Exists($loc32)) {
25        $msBuildPath = $loc32
26        $vstestPath = [System.IO.Path]::Combine($loc, $edition, "Common7", "IDE", "CommonExtensions", "Microsoft", "TestWindow", "vstest.console.exe")
27        Break search;
28      }
29    }
30  }
31}
32
33If ($vstestPath -eq $undefined) {
34  "Could not locate vstest.console.exe, ABORTING ..."
35  Return
36}
37
38If(-not [System.IO.File]::Exists($vstestPath)) {
39  "vstest.console.exe is not found at $vstestPath, ABORTING ..."
40  Return
41}
42
43$testcontainer = "HeuristicLab.Tests.dll"
44$input = Read-Host "Which container to test? [$($testcontainer)]"
45$testcontainer = ($testcontainer, $input)[[bool]$input]
46
47$testplatform = "x64"
48$input = Read-Host "Which platform to run the tests? [$($testplatform)]"
49$testplatform = ($testplatform, $input)[[bool]$input]
50
51$testcategory = "Essential"
52$input = Read-Host "Which category do you want to run? [$($testcategory)]"
53$testcategory = ($testcategory, $input)[[bool]$input]
54
55# query whether to build
56$input = Read-Host "Should the tests be rebuilt y/N?"
57$input = ([string]("n", $input)[[bool]$input]).ToLowerInvariant()
58$dobuild = $input -eq "y"
59
60If($dobuild) {
61  $curPath = $MyInvocation.MyCommand.Path
62  $curDir = Split-Path $curPath
63
64  $slnFiles = Get-ChildItem $curDir -Filter *Tests.sln
65
66  If ($slnFiles.Count -le 0) {
67    "No solutions found, ABORTING ..."
68    Return
69  }
70
71  $slnIndices = @()
72
73  If ($slnFiles.Count -eq 1) {
74    "Selecting the only solution found: `"{0}`"" -f $slnFiles[0].Name
75    $slnIndices += 0
76  } Else {
77    "Found the following solutions:"
78
79    ""
80
81    $slnFiles | % { $i = 0 } { ("  {0}. `"{1}`"" -f ($i + 1), $_.Name); $i++ }
82
83    ""
84
85    $success = $false
86
87    # query solution to build
88    $slnIndex = -1
89    Do {
90        $input = Read-Host "Which solution(s) to build? (e.g.: 1 2 3) { 1..$($slnFiles.Count) }"
91        $inputParts = $input -Split " "
92
93        Foreach ($part in $inputParts) {
94          If ($part -eq "") { Continue }
95
96          $success = [int]::TryParse($part, [ref]$slnIndex) -and ($slnIndex -gt 0) -and ($slnIndex -le $slnFiles.Count)
97
98          If ($success) {
99            $slnIndices += $slnIndex - 1
100          } Else {
101            $slnIndices = @()
102            Break
103          }
104        }
105    } While (-Not $success)
106
107    $slnIndices = $slnIndices | Select-Object -Unique
108  }
109
110
111  # query configuration to build
112  $config = "Release"
113  $input = Read-Host "Which configuration to build? [$($config)]"
114  $config = ($config, $input)[[bool]$input]
115
116  # query platform to build
117  $platform = "Any CPU"
118  $input = Read-Host "Which platform to build? [$($platform)]"
119  $platform = ($platform, $input)[[bool]$input]
120
121  # query clean desire
122  $clean = $false
123  Do {
124      $input = Read-Host "Would you like to clean before building? [y/N]"
125      $input = ([string]("n", $input)[[bool]$input]).ToLowerInvariant()
126      $success = $input -eq "n" -or ($clean = $input -eq "y")
127  } While (-Not $success)
128
129  ""
130
131  If ($clean) {
132    Foreach ($slnIndex in $slnIndices) {
133      $solution = $slnFiles[$slnIndex]
134      "Cleaning `"$($solution.Name)`" ..."
135      $args = @(
136        $solution.FullName,
137        "/t:Clean",
138        "/p:Configuration=`"$config`",Platform=`"$platform`"",
139        "/m", "/nologo", "/verbosity:q", "/clp:ErrorsOnly"
140      )
141      & $msBuildPath $args
142      "===== CLEAN FINISHED ====="
143    }
144  }
145
146  Foreach ($slnIndex in $slnIndices) {
147    $solution = $slnFiles[$slnIndex]
148    "Building `"$($solution.Name)`" ($config|$platform) ..."
149    $args = @(
150      $solution.FullName,
151      "/t:Restore,Build",
152      "/p:Configuration=`"$config`",Platform=`"$platform`"",
153      "/m", "/nologo", "/verbosity:q", "/clp:ErrorsOnly"
154    )
155    & $msBuildPath $args
156    "===== BUILD FINISHED ====="
157  }
158}
159
160& $vstestPath "bin\$testcontainer" /Framework:framework40 /Platform:$testplatform /TestCaseFilter:"TestCategory=$testcategory"
161# SIG # Begin signature block
162# MIIRPwYJKoZIhvcNAQcCoIIRMDCCESwCAQExDzANBglghkgBZQMEAgEFADB5Bgor
163# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
164# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCAJ0I/t/xZNoRef
165# SWG1a9MeW996RfVwX+NKpwaPNeHob6CCDo4wggbaMIIEwqADAgECAhNoAAE6ILAh
166# JeBjaP8pAAEAATogMA0GCSqGSIb3DQEBCwUAMD4xEjAQBgoJkiaJk/IsZAEZFgJh
167# dDEVMBMGCgmSJomT8ixkARkWBWZob29lMREwDwYDVQQDEwhGSE9PZUNBMTAeFw0x
168# OTExMDYwOTI1N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g83zouWpb+G6TTANBgkqhkiG9w0BAQEFAASCAQAF0ha6sm0rEfVTS6ot
249# vyp0nokYc/jNw174T/jZgKM2g4t+TehmVgYZAiimkBCidURXpKaNf3URjmeGY2hA
250# /Yl1oKG+kR0SmUgB1qryGqMIn1o0zXJKSY0XtahKFleDXFkhYCbLxr6Nq/i0Yfbd
251# MsfX3soN/aG6N9bRq9RviS1K6O8X8S4ZWYKkdcf0LT5ANqVZukvHcgSCHCeo/osl
252# 3EoTo/n1i2uo0z8MtrhMiqaKj0Rg48ZQtEO3ee/OGBFRDZcnptkSNpDOreyPFKx3
253# 9TzLOHwdmFSC85eAtDt7ciWzoLA0Z2UrbKIRGrXDDRQRlvGgFOtf5dfQFJuMRwKy
254# Qp84
255# SIG # End signature block
Note: See TracBrowser for help on using the repository browser.