...
1#Requires -Version 7.0
2
3Param(
4 [string] $serviceDirectory
5)
6
7$repoRoot = Resolve-Path "$PSScriptRoot/../../"
8
9Push-Location $repoRoot/eng/tools/smoketests
10
11# create a smoketests directory
12$smoketestsDir = Join-Path $repoRoot sdk smoketests
13Write-Host "Creating a new directory for smoketests at $smoketestsDir"
14New-Item -Path $smoketestsDir -ItemType Directory
15
16Push-Location $smoketestsDir
17Write-Host "Running 'go mod init' in $pwd"
18go mod init github.com/Azure/azure-sdk-for-go/sdk/smoketests
19Pop-Location
20
21# Run smoketests script
22Write-Host "Running 'go run . -serviceDirectory $serviceDirectory'"
23go run . -serviceDirectory $serviceDirectory
24if ($LASTEXITCODE) {
25 exit $LASTEXITCODE
26}
27
28Pop-Location
29
30# Run go mod tidy and go build. If these succeed the smoke tests pass
31Push-Location $smoketestsDir
32go fmt ./...
33Write-Host "Printing content of go.mod file:"
34Get-Content go.mod
35Write-Host "Printing content of main.go file"
36Get-Content main.go
37go mod tidy
38go build ./...
39go run .
40
41Pop-Location
42
43# Clean-up the directory created
44Remove-Item -Path $smoketestsDir -Recurse -Force
View as plain text