diff --git a/apphost-framework-lookup/test.sh b/apphost-framework-lookup/test.sh index bde33209..771b8b8b 100755 --- a/apphost-framework-lookup/test.sh +++ b/apphost-framework-lookup/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [ -f /etc/profile ]; then source /etc/profile diff --git a/aspnet-same-runtime-version-2x/test.sh b/aspnet-same-runtime-version-2x/test.sh index 3c0c72fe..0d2bedba 100755 --- a/aspnet-same-runtime-version-2x/test.sh +++ b/aspnet-same-runtime-version-2x/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/aspnet-same-runtime-version/test.sh b/aspnet-same-runtime-version/test.sh index 7e8509b4..35a091df 100755 --- a/aspnet-same-runtime-version/test.sh +++ b/aspnet-same-runtime-version/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/aspnetpatch-21/test.sh b/aspnetpatch-21/test.sh index ffca7c20..c1be634f 100755 --- a/aspnetpatch-21/test.sh +++ b/aspnetpatch-21/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail set -x diff --git a/assemblies-valid/AssembliesValid.cs b/assemblies-valid/AssembliesValid.cs index 3cf75b12..8a6edb13 100644 --- a/assemblies-valid/AssembliesValid.cs +++ b/assemblies-valid/AssembliesValid.cs @@ -44,7 +44,7 @@ public class AssembliesValid public void ValidateAssemblies() { string dotnetPath = null; - int exitCode = RunProcessAndGetOutput(new string[] { "command", "-v", "dotnet" }, out dotnetPath); + int exitCode = RunProcessAndGetOutput(new string[] { "bash", "-c", "command -v dotnet" }, out dotnetPath); if (exitCode != 0) { Console.Error.WriteLine("'dotnet' command not found"); @@ -91,8 +91,8 @@ public void ValidateAssemblies() if (hasMethods && !hasAot) { #if NET6_0_OR_GREATER - // s390x doesn't have aot support, and that's okay for now - if (architecture != Architecture.S390x) + // s390x (and arm) doesn't have aot support, and that's okay for now + if (architecture != Architecture.S390x && architecture != Architecture.Arm) { #endif valid = false; @@ -120,8 +120,11 @@ public void ValidateAssemblies() static int RunProcessAndGetOutput(string[] processAndArguments, out string standardOutput) { ProcessStartInfo startInfo = new ProcessStartInfo(); - startInfo.FileName = processAndArguments[0]; - startInfo.Arguments = string.Join(" ", processAndArguments.Skip(1)); + startInfo.FileName = processAndArguments[0]; + foreach (string arg in processAndArguments.Skip(1)) + { + startInfo.ArgumentList.Add(arg); + } startInfo.RedirectStandardOutput = true; using (Process p = Process.Start(startInfo)) diff --git a/bash-completion/get-completions.sh b/bash-completion/get-completions.sh index 431dc744..510c2b1d 100755 --- a/bash-completion/get-completions.sh +++ b/bash-completion/get-completions.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash get_completion_function_name_from_complete_output() { diff --git a/bash-completion/test.sh b/bash-completion/test.sh index 90105093..3f63a1c0 100755 --- a/bash-completion/test.sh +++ b/bash-completion/test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/bundled-libunwind/test.sh b/bundled-libunwind/test.sh index 87430727..7a34a79c 100755 --- a/bundled-libunwind/test.sh +++ b/bundled-libunwind/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/cgroup-limit/test.sh b/cgroup-limit/test.sh index 413ba781..5bbf2632 100755 --- a/cgroup-limit/test.sh +++ b/cgroup-limit/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail @@ -13,6 +13,12 @@ if [[ "$(stat -f -c "%T" /sys/fs/cgroup)" == "cgroup2fs" ]] && [[ $(dotnet --ver exit 0 fi + +if [ -z "$(command -v systemctl)" ]; then + echo "Environment does not use systemd" + exit 0 +fi + dotnet publish SYSTEMD_RUN="systemd-run" diff --git a/commit-ids-in-binaries/test.sh b/commit-ids-in-binaries/test.sh index 4ee952a1..5f6bfb02 100755 --- a/commit-ids-in-binaries/test.sh +++ b/commit-ids-in-binaries/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # .NET Core native binaries (coreclr.so, System.Native.so) contain a # commit id as text somewhere in the binary. For example diff --git a/createdump-aspnet/test.sh b/createdump-aspnet/test.sh index e0af9096..c14d8078 100755 --- a/createdump-aspnet/test.sh +++ b/createdump-aspnet/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Enable "unofficial bash strict mode" set -euo pipefail diff --git a/curl-certificate-store/test.sh b/curl-certificate-store/test.sh index a74161f6..39cb11cd 100755 --- a/curl-certificate-store/test.sh +++ b/curl-certificate-store/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/debugging-sos-lldb-via-core-2x/test.sh b/debugging-sos-lldb-via-core-2x/test.sh index 8d28bdfc..8b307af6 100755 --- a/debugging-sos-lldb-via-core-2x/test.sh +++ b/debugging-sos-lldb-via-core-2x/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Check whether coredumps produced by .NET Core can be used by sos # successfully. This test uses the built-in CoreCLR sos support, not diff --git a/debugging-sos-lldb-via-core/test.sh b/debugging-sos-lldb-via-core/test.sh index 6ee806c1..12d2590b 100755 --- a/debugging-sos-lldb-via-core/test.sh +++ b/debugging-sos-lldb-via-core/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Check whether coredumps produced by .NET Core can be used by sos # successfully. This test uses the `dotnet sos` global tool. diff --git a/distribution-packages/test.json b/distribution-packages/test.json index 6aa2b6d5..18ce2bba 100644 --- a/distribution-packages/test.json +++ b/distribution-packages/test.json @@ -6,6 +6,7 @@ "type": "bash", "cleanup": true, "ignoredRIDs":[ - "rhel7" + "rhel7", + "linux-musl" ] } diff --git a/distribution-packages/test.sh b/distribution-packages/test.sh index 01a24058..926e182b 100755 --- a/distribution-packages/test.sh +++ b/distribution-packages/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/dotnet-info-commit-ids/test.sh b/dotnet-info-commit-ids/test.sh index 04debe7b..73580016 100755 --- a/dotnet-info-commit-ids/test.sh +++ b/dotnet-info-commit-ids/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # unofficial bash strict mode set -euo pipefail diff --git a/extract-bundle-dir/test.sh b/extract-bundle-dir/test.sh index 0d960312..0733c369 100755 --- a/extract-bundle-dir/test.sh +++ b/extract-bundle-dir/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # The profile file sets DOTNET_BUNDLE_EXTRACT_BASE_DIR to avoid multi-user issues. # see: https://bugzilla.redhat.com/show_bug.cgi?id=1752350. diff --git a/fdd-no-nuget/test.sh b/fdd-no-nuget/test.sh index d00fd29b..b49b0f27 100755 --- a/fdd-no-nuget/test.sh +++ b/fdd-no-nuget/test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set +x @@ -21,4 +21,4 @@ if [ $? -eq 1 ]; then exit 1 fi -echo "PASS: successfully published FDD without nuget.org access" \ No newline at end of file +echo "PASS: successfully published FDD without nuget.org access" diff --git a/file-permissions/test.sh b/file-permissions/test.sh index 7a4b1261..cd3c60c6 100755 --- a/file-permissions/test.sh +++ b/file-permissions/test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' diff --git a/hardened-binaries/test.sh b/hardened-binaries/test.sh index 81f8e858..ede89f09 100755 --- a/hardened-binaries/test.sh +++ b/hardened-binaries/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' @@ -8,7 +8,7 @@ echo ".NET Core base directory: $root" # TODO handle more architectures can just x86-64 -file_list=$(find "$root/" -type f -exec file {} \; | grep -E 'ELF 64-bit [LM]SB' | cut -d: -f 1 | sort -u) +file_list=$(find "$root/" -type f -exec file {} \; | grep -E 'ELF [[:digit:]][[:digit:]]-bit [LM]SB' | cut -d: -f 1 | sort -u) mapfile -t binaries <<< "$file_list" for binary in "${binaries[@]}"; do echo "$binary" diff --git a/helloworld/test.sh b/helloworld/test.sh index 9de4d325..96458b1e 100755 --- a/helloworld/test.sh +++ b/helloworld/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/install-location/test.sh b/install-location/test.sh index 274f7342..c89ecc93 100755 --- a/install-location/test.sh +++ b/install-location/test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' diff --git a/liblttng-ust_sys-sdt.h/test.sh b/liblttng-ust_sys-sdt.h/test.sh index 7ab7597b..da44ba53 100755 --- a/liblttng-ust_sys-sdt.h/test.sh +++ b/liblttng-ust_sys-sdt.h/test.sh @@ -1,22 +1,41 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail set -x +RUNTIME_ID=$(../runtime-id) set +e # disable abort-on-error so we can have the pipeline below fail -packageName=$(rpm -qa | grep 'dotnet.*lttng-ust') +case $RUNTIME_ID in + alpine*)packageName="" ;; + *)packageName=$(rpm -qa | grep 'dotnet.*lttng-ust');; +esac set -e # If a dotnet-specific lttng package doesn't exist, we must be using # the normal system-wide lttng package. if [[ -z "$packageName" ]]; then - packageName=$(rpm -qa | grep 'lttng-ust') + case $RUNTIME_ID in + alpine*) + packageName="lttng-ust" + ;; + *) + packageName=$(rpm -qa | grep 'lttng-ust') + ;; + esac fi -filePath=$(rpm -ql "$packageName" | grep -E 'liblttng-ust.so.[01]$') +case $RUNTIME_ID in + alpine*) + filePath="/$(apk info -L "$packageName" | grep -E 'liblttng-ust.so.[01]$')" + ;; + *) + filePath=$(rpm -ql "$packageName" | grep -E 'liblttng-ust.so.[01]$') + ;; +esac + readelf -n "$filePath" | grep -F 'NT_STAPSDT (SystemTap probe descriptors)' if [[ $? -eq 1 ]]; then - echo "NO NT_STAPSDT were found in lttng-ust: FAL" + echo "NO NT_STAPSDT were found in lttng-ust: FAIL" exit 1 fi diff --git a/libuv-kestrel-sample-app-2x/test.sh b/libuv-kestrel-sample-app-2x/test.sh index 3f8b1f54..24eaacf3 100755 --- a/libuv-kestrel-sample-app-2x/test.sh +++ b/libuv-kestrel-sample-app-2x/test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/lttng/test.sh b/lttng/test.sh index 01c7ac01..7a06aac2 100755 --- a/lttng/test.sh +++ b/lttng/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail @@ -49,8 +49,11 @@ wait $DOTNET_PID echo "== Ending lttng session" end_session +CMD="$(command -v babeltrace || true)" +[ -z "${CMD}" ] && CMD="$(command -v babeltrace2)" + # Retrieve trace -LTTNG_TRACE=$(babeltrace "$TRACE_FOLDER/ust/uid/$(id -u)/64-bit" | grep "vpid = $DOTNET_PID") +LTTNG_TRACE=$($CMD "$TRACE_FOLDER/ust/uid/$(id -u)/64-bit" | grep "vpid = $DOTNET_PID") # Clean up remove_test_folder diff --git a/man-pages/test.sh b/man-pages/test.sh index 7a8bba68..b06b41d8 100755 --- a/man-pages/test.sh +++ b/man-pages/test.sh @@ -1,9 +1,14 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail helpPages=$(dotnet --help | grep -A 999 'SDK commands' | grep -E -B 999 'Common options|Additional commands' | awk 'NR>1 {print $1}' | head -n-2) -manPages=$(rpm -qd $(rpm -qa | grep 'dotnet') | grep 'man1/dotnet-') + +RUNTIME_ID=$(../runtime-id) +case $RUNTIME_ID in + alpine*)manPages=$(apk info -L dotnet-doc);; + *)manPages=$(rpm -qd $(rpm -qa | grep 'dotnet') | grep 'man1/dotnet-');; +esac failed=0 for page in $helpPages; do diff --git a/managed-symbols-available/test.sh b/managed-symbols-available/test.sh index b733091e..c5d819b8 100755 --- a/managed-symbols-available/test.sh +++ b/managed-symbols-available/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Check that managed symbol files are available diff --git a/omnisharp/test.json b/omnisharp/test.json index 1dfef1b0..aad18bfb 100644 --- a/omnisharp/test.json +++ b/omnisharp/test.json @@ -6,6 +6,7 @@ "type": "bash", "cleanup": true, "ignoredRIDs":[ + "linux-musl", "linux-s390x" ] } diff --git a/omnisharp/test.sh b/omnisharp/test.sh index 741508bf..fb7c95b5 100755 --- a/omnisharp/test.sh +++ b/omnisharp/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' diff --git a/openssl-alpn/test.sh b/openssl-alpn/test.sh index 6511eee5..2f92afd4 100755 --- a/openssl-alpn/test.sh +++ b/openssl-alpn/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Make sure .NET Core has linked to SSL_*_alpn_* functions from OpenSSL diff --git a/publish-ready-to-run-linux/test.sh b/publish-ready-to-run-linux/test.sh index f8b6e933..42a044c0 100755 --- a/publish-ready-to-run-linux/test.sh +++ b/publish-ready-to-run-linux/test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -euo pipefail set -x diff --git a/publish-ready-to-run/test.sh b/publish-ready-to-run/test.sh index d7651811..03cacdd8 100755 --- a/publish-ready-to-run/test.sh +++ b/publish-ready-to-run/test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -euo pipefail set -x diff --git a/restore-with-rid/test.sh b/restore-with-rid/test.sh index 3c080199..d6581e84 100755 --- a/restore-with-rid/test.sh +++ b/restore-with-rid/test.sh @@ -1,4 +1,4 @@ -#!/usr/bin/bash +#!/usr/bin/env bash set -euo pipefail set -x diff --git a/runtime-id b/runtime-id index 32248604..5673bbab 100755 --- a/runtime-id +++ b/runtime-id @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This is a script called by multiple tests to find the runtime id of # the current platform. @@ -38,11 +38,15 @@ while [[ $# -gt 0 ]]; do done if [[ ${portable_rid} == 1 ]]; then - echo "linux-${arch}" + if (ldd --version 2>&1 || true) | grep -q musl ; then + echo "linux-musl-${arch}" + else + echo "linux-${arch}" + fi else case "${ID}" in - # Remove the RHEL minor version - rhel) rid_version=${VERSION_ID%.*} ;; + # Remove the minor version + alpine|ol|rhel|rocky) rid_version=${VERSION_ID%.*} ;; *) rid_version=${VERSION_ID} ;; esac diff --git a/sdks-are-available/test.sh b/sdks-are-available/test.sh index 0abdee4d..2847b917 100755 --- a/sdks-are-available/test.sh +++ b/sdks-are-available/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail IFS=$'\n\t' diff --git a/system-libcurl/test.sh b/system-libcurl/test.sh index 1f13dc63..33c7cf93 100755 --- a/system-libcurl/test.sh +++ b/system-libcurl/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/system-libunwind/test.sh b/system-libunwind/test.sh index 7396685e..d6239a57 100755 --- a/system-libunwind/test.sh +++ b/system-libunwind/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/system-openssl/test.sh b/system-openssl/test.sh index 00cebc5e..b98625da 100755 --- a/system-openssl/test.sh +++ b/system-openssl/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Make sure .NET has ldd-visible links to OpenSSL. We prefer that over # using OpenSSL via dlopen (which is more likely to fail at runtime). diff --git a/targeting-packs-bad-files/test.sh b/targeting-packs-bad-files/test.sh index 713a68e2..2e20b7cc 100755 --- a/targeting-packs-bad-files/test.sh +++ b/targeting-packs-bad-files/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -euo pipefail diff --git a/telemetry-is-off-by-default/test-telemetry-tcpdump.sh b/telemetry-is-off-by-default/test-telemetry-tcpdump.sh index 5c0c3603..d391c5d0 100755 --- a/telemetry-is-off-by-default/test-telemetry-tcpdump.sh +++ b/telemetry-is-off-by-default/test-telemetry-tcpdump.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This test is *NOT* executed by default. diff --git a/telemetry-is-off-by-default/test.sh b/telemetry-is-off-by-default/test.sh index b9e42c2d..d0bcd656 100755 --- a/telemetry-is-off-by-default/test.sh +++ b/telemetry-is-off-by-default/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # This test ensures telemetry is not being sent for (some) commands by # checking that no network connections are being made when not diff --git a/template-test/test.sh b/template-test/test.sh index cc21f6c4..2a4d02a0 100755 --- a/template-test/test.sh +++ b/template-test/test.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # this file tests templates created by # dotnet new