From 900e8f40aa49540570d8139000b2735b84028b3f Mon Sep 17 00:00:00 2001 From: Tom Deseyn Date: Tue, 9 Jun 2026 14:36:36 +0200 Subject: [PATCH] Add bundled-tools-can-execute test to verify SDK bundled tools work. --- bundled-tools-can-execute/test.json | 10 +++++++++ bundled-tools-can-execute/test.sh | 35 +++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 bundled-tools-can-execute/test.json create mode 100755 bundled-tools-can-execute/test.sh diff --git a/bundled-tools-can-execute/test.json b/bundled-tools-can-execute/test.json new file mode 100644 index 0000000..4d43596 --- /dev/null +++ b/bundled-tools-can-execute/test.json @@ -0,0 +1,10 @@ +{ + "name": "bundled-tools-can-execute", + "enabled": true, + "requiresSdk": true, + "version": "8.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs": [] +} diff --git a/bundled-tools-can-execute/test.sh b/bundled-tools-can-execute/test.sh new file mode 100755 index 0000000..aa08ab0 --- /dev/null +++ b/bundled-tools-can-execute/test.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# Verify that the bundled SDK tools can execute. + +set -euo pipefail +IFS=$'\n\t' +set -x + +# Maps a tool name to some output that is expected to be in the output when invoked with '--help'. +declare -A tools=( + [dev-certs]="Usage: dotnet dev-certs" + [format]="Formats code" + [user-jwts]="Usage: dotnet user-jwts" + [user-secrets]="Usage: dotnet user-secrets" + [watch]="dotnet watch" +) + +failed=0 + +for tool in "${!tools[@]}"; do + expected="${tools[$tool]}" + + # Ignore the exit code because 'dotnet user-secrets' has a non-zero exit for '--help'. + output=$(dotnet "${tool}" --help 2>&1) || true + + if echo "${output}" | grep -q "${expected}"; then + echo "PASS: dotnet ${tool} --help" + else + echo "FAIL: dotnet ${tool} --help did not contain '${expected}'" + echo "Output was: ${output}" + failed=1 + fi +done + +exit "${failed}"