Skip to content

Commit

Permalink
update shell
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Ting committed Oct 6, 2023
1 parent f11877e commit c48df7f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions build/test-threadSafety.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,31 @@ Write-Host "Install Coyote CLI."
dotnet tool install --global Microsoft.Coyote.CLI

Write-Host "Build OpenTelemetry.Tests project."
dotnet build $rootDirectory/test/OpenTelemetry.Tests/OpenTelemetry.Tests.csproj
dotnet build $rootDirectory\test\OpenTelemetry.Tests\OpenTelemetry.Tests.csproj

$artifactsPath = Join-Path $rootDirectory "test/OpenTelemetry.Tests/bin/Debug/$targetNetFramework"
$artifactsPath = Join-Path $rootDirectory "test\OpenTelemetry.Tests\bin\Debug\$targetFramework"

Write-Host "ArtifactsPath is:", $artifactsPath

Write-Host "Generating Coyote rewriting options JSON file."
$assemblies = Get-ChildItem $artifactsPath -Filter OpenTelemetry*.dll | ForEach-Object {$_.Name}

$RewriteOptionsJson = @{}
[void]$RewriteOptionsJson.Add("AssembliesPath", $artifactsPath)
[void]$RewriteOptionsJson.Add("Assemblies", $assemblies)
$RewriteOptionsJson | ConvertTo-Json -Compress | Set-Content "$rootDirectory/test/OpenTelemetry.Tests/rewrite.coyote.json"
$RewriteOptionsJson | ConvertTo-Json -Compress | Set-Content "$rootDirectory\test\OpenTelemetry.Tests\rewrite.coyote.json"

Write-Host "Rewritten Json file:", $RewriteOptionsJson
Write-Host "Rewritten Json file:"
$obj = Get-Content -Path $rootDirectory\test\OpenTelemetry.Tests\rewrite.coyote.json -Raw | ConvertFrom-Json
Write-Host $obj

Write-Host "Run Coyote rewrite."
coyote rewrite $rootDirectory/test/OpenTelemetry.Tests/rewrite.coyote.json
coyote rewrite $rootDirectory\test\OpenTelemetry.Tests\rewrite.coyote.json
Write-Host "Done re-written."

Write-Host "Execute re-written binary."
# test name can be passed in
$Output = dotnet test $artifactsPath/OpenTelemetry.Tests.dll --filter MultithreadedLongHistogramTest_Coyote
$Output = dotnet test $artifactsPath\OpenTelemetry.Tests.dll --filter MultithreadedLongHistogramTest_Coyote

Write-Host "Verify test pass."
foreach ($line in $($Output -split "`r`n"))
Expand Down

0 comments on commit c48df7f

Please sign in to comment.