Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Yun-Ting committed Oct 6, 2023
1 parent c48df7f commit f47ed19
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci-concurrency.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Concurrency tests
name: Concurrency Tests

on:
push:
Expand All @@ -18,6 +18,7 @@ jobs:
os: [ windows-latest ]
version: [ net8.0 ]
coyote-version: [ 1.7.10 ]
methodsToTest: [ MultithreadedLongHistogramTest_Coyote ]

runs-on: ${{ matrix.os }}
steps:
Expand All @@ -36,4 +37,4 @@ jobs:

- name: Coyote Test
shell: pwsh
run: .\build\test-threadSafety.ps1 ${{ matrix.coyote-version }} ${{ matrix.version }}
run: .\build\test-threadSafety.ps1 ${{ matrix.coyote-version }} ${{ matrix.version }} ${{ matrix.methodsToTest }}
3 changes: 1 addition & 2 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
.dockerignore = .dockerignore
.editorconfig = .editorconfig
.github\workflows\ci-concurrency.yml = .github\workflows\ci-concurrency.yml
build\concurrency-tests-with-Coyote.ps1 = build\concurrency-tests-with-Coyote.ps1
CONTRIBUTING.md = CONTRIBUTING.md
Directory.Packages.props = Directory.Packages.props
test\Directory.Packages.props = test\Directory.Packages.props
Expand All @@ -23,7 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
NuGet.config = NuGet.config
OpenTelemetry.proj = OpenTelemetry.proj
README.md = README.md
build\test-threadSafety.ps1 = build\test-threadSafety.ps1
VERSIONING.md = VERSIONING.md
EndProjectSection
EndProject
Expand All @@ -47,6 +45,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7CB2F02E
build\RELEASING.md = build\RELEASING.md
build\stylecop.json = build\stylecop.json
build\test-aot-compatibility.ps1 = build\test-aot-compatibility.ps1
build\test-threadSafety.ps1 = build\test-threadSafety.ps1
build\xunit.runner.json = build\xunit.runner.json
EndProjectSection
EndProject
Expand Down
22 changes: 5 additions & 17 deletions build/test-threadSafety.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
param(
[Parameter(Mandatory=$true)][string]$coyoteVersion="",
[Parameter(Mandatory=$true)][string]$targetFramework
[Parameter(Mandatory=$true)][string]$targetFramework,
[Parameter(Mandatory=$true)][string]$methodNames,
)

Write-Host "Test running Coyote."
$rootDirectory = Split-Path $PSScriptRoot -Parent

Write-Host "Install Coyote CLI."
Expand All @@ -14,34 +14,22 @@ dotnet build $rootDirectory\test\OpenTelemetry.Tests\OpenTelemetry.Tests.csproj

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

Write-Host "ArtifactsPath is:", $artifactsPath

Write-Host "Generating Coyote rewriting options JSON file."
Write-Host "Generate 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"

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
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 $methodNames

Write-Host "Verify test pass."
Write-Host "Coyote test output:"
foreach ($line in $($Output -split "`r`n"))
{
Write-Host $line
if ($line -contains "*pass*")
{
Write-Host "PASSED!"
}
}

0 comments on commit f47ed19

Please sign in to comment.