Skip to content

Commit

Permalink
improve test experience (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
cklutz authored Oct 21, 2024
1 parent 52fd11d commit 68b1218
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 20 deletions.
10 changes: 1 addition & 9 deletions test/test-docker-linux.ps1
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
# -e VSTEST_HOST_DEBUG=1 `
$mydir = $PSScriptRoot
$project = './test/LockCheck.Tests/LockCheck.Tests.csproj'
$dotnet = '/usr/share/dotnet/dotnet'

$script = "$dotnet test -c Release -f net8.0 && $dotnet test -c Debug -f net8.0"
$script = $script.Replace("`r", "")

docker run --rm --name LockCheck.Tests -v ${mydir}/..:/mnt/lc -w /mnt/lc mcr.microsoft.com/dotnet/sdk:8.0 bash -c $script
docker run --rm --name LockCheck.Tests -v ${PSScriptRoot}/..:/mnt/lc -w /mnt/lc mcr.microsoft.com/dotnet/sdk:8.0 bash /mnt/lc/test/test-linux.sh
15 changes: 15 additions & 0 deletions test/test-linux.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

frameworks=('net8.0')
configurations=('Release' 'Debug')
platforms=('x64')
project="$(dirname $0)/LockCheck.Tests/LockCheck.Tests.csproj"

for framework in "${frameworks[@]}"; do
for configuration in "${configurations[@]}"; do
for platform in "${platforms[@]}"; do
echo -e "\n\033[34m[$framework - $configuration - $platform]\033[0m"
/usr/share/dotnet/dotnet test --logger console -c $configuration -f $framework -a $platform $project || exit 1
done
done
done
23 changes: 12 additions & 11 deletions test/test-windows.ps1
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Simply run all test assemblies that are found in the tree.
# If we have builds for debug and release, they are both run.
# Requires that vstest.console.exe is in the PATH.

$frameworks = ('net481', 'net8.0')
$configurations = ('Debug', 'Release')
$platforms = ('x86', 'x64')
$assemblies = Get-ChildItem LockCheck.Tests.dll -Recurse | where { $_.FullName -like "*\bin\*" }
$project = "$PSScriptRoot\LockCheck.Tests\LockCheck.Tests.csproj"

foreach ($assembly in $assemblies) {
foreach ($framework in $frameworks) {
foreach ($platform in $platforms) {
echo "vstest.console.exe $assembly /Platform:$platform"
& vstest.console.exe $assembly /Platform:$platform
if ($LASTEXITCODE -ne 0) {
exit 1
foreach ($configuration in $configurations) {
Write-Host -Foreground DarkBlue "`n[$framework - $configuration - $platform]"

& dotnet test -c $configuration -f $framework -a $platform $project
if ($LASTEXITCODE -ne 0) {
exit 1
}
}
}
}
}

0 comments on commit 68b1218

Please sign in to comment.