diff --git a/createdump-aspnet/test.json b/createdump-aspnet/test.json new file mode 100644 index 0000000..f4843ec --- /dev/null +++ b/createdump-aspnet/test.json @@ -0,0 +1,10 @@ +{ + "name": "createdump-aspnet", + "enabled": true, + "version": "2.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "platformBlacklist":[ + ] +} diff --git a/createdump-aspnet/test.sh b/createdump-aspnet/test.sh new file mode 100755 index 0000000..75f11af --- /dev/null +++ b/createdump-aspnet/test.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# WARNING: This kills off all dotnet processes on the system at the end + +# Enable "unofficial bash strict mode" +set -euo pipefail + +set -x + +version="$1" + +dotnet new --force web +# The tool install command can fail because the tool is already installed +# so ignore that. We will fail later on if the tool can't be executed. +dotnet tool install -g dotnet-dev-certs || true +dotnet dev-certs https + +# Do not kick off compiler servers that hang around after a build +dotnet build -p:UseRazorBuildServer=false -p:UseSharedCompilation=false /m:1 + +dotnet run --no-build --no-restore & + +sleep 2 + +pids=$(pgrep dotnet) + +failed=0 + +dotnet_home="$(dirname "$(readlink -f "$(command -v dotnet)")")" +for pid in ${pids}; do + if "${dotnet_home}"/shared/Microsoft.NETCore.App/"${version}"*/createdump -f "$(pwd)"/'coredump.%d' "${pid}"; then + echo "createdump worked" + else + echo "createdump failed" + failed=1 + fi +done + +for pid in ${pids}; do + kill -s SIGTERM "${pid}" +done +sleep 2 +for pid in ${pids}; do + if ps -p ${pid}; then + kill "${pid}" + fi +done + +if [ ${failed} -eq 1 ]; then + echo "FAIL: createdump failed" + exit 1 +fi + +echo "PASS: createdump worked"