Skip to content

Commit

Permalink
Add a test for non-portable SDK RID
Browse files Browse the repository at this point in the history
We have recently updated a number of tests to use the SDK's RID (instead
of the expected OS non-portable RID). We should have a test that
explicitly tests that the SDK's RID matches the expected OS-specific
non-portable RID. This is that test.

Also fix publish-ready-to-run to use the SDK's runtime id.
  • Loading branch information
omajid committed Jun 28, 2024
1 parent c3b481c commit cfbcd7c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion distribution-packages/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set -x
sdk_version="$(dotnet --version)"
runtime_version="$(dotnet --list-runtimes | grep Microsoft.NETCore.App | awk '{ print $2 }')"
aspnetcore_runtime_version="$(dotnet --list-runtimes | grep Microsoft.AspNetCore.App | awk '{ print $2 }')"
runtime_id=$(../runtime-id)
runtime_id=$(../runtime-id --sdk)
# This might be the final/only netstandard version from now on
netstandard_version=2.1

Expand Down
12 changes: 12 additions & 0 deletions non-portable-rid/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "non-portable-rid",
"enabled": true,
"requiresSdk": true,
"version": "6.0",
"versionSpecific": false,
"type": "bash",
"cleanup": true,
"skipWhen":[
"portable", // this test only tests non-portable SDKs
]
}
13 changes: 13 additions & 0 deletions non-portable-rid/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

set -euo pipefail
IFS=$'\n\t'
set -x

sdk_rid="$(../runtime-id --sdk)"
os_rid="$(../runtime-id)"

if [[ $sdk_rid != $os_rid ]]; then
echo "SDK RID ($sdk_rid) did not match expected RID ($os_rid)"
exit 1
fi
2 changes: 1 addition & 1 deletion publish-ready-to-run/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ IFS=$'\n\t'
set -x

dotnet new console --no-restore
dotnet publish -r "$(../runtime-id)" /p:PublishReadyToRun=true
dotnet publish -r "$(../runtime-id --sdk)" /p:PublishReadyToRun=true

0 comments on commit cfbcd7c

Please sign in to comment.