Skip to content

Commit

Permalink
Improve tests for alpine
Browse files Browse the repository at this point in the history
- WIP
  • Loading branch information
omajid committed Apr 20, 2022
1 parent 5027c53 commit 9c1fa19
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 25 deletions.
9 changes: 6 additions & 3 deletions assemblies-valid/AssembliesValid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class AssembliesValid
public void ValidateAssemblies()
{
string dotnetPath = null;
int exitCode = RunProcessAndGetOutput(new string[] { "bash", "-c", "\"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");
Expand Down Expand Up @@ -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))
Expand Down
3 changes: 2 additions & 1 deletion distribution-packages/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"type": "bash",
"cleanup": true,
"ignoredRIDs":[
"rhel7"
"rhel7",
"linux-musl"
]
}
3 changes: 0 additions & 3 deletions distribution-packages/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ runtime_id=$(../runtime-id)
# This might be the final/only netstandard version from now on
netstandard_version=2.1

# disabled for alpine
[ -z "${runtime_id##alpine*}" ] && { echo Disabled for Alpine; exit 0; }

./test-standard-packages \
"${runtime_id}" \
"${runtime_version}" "${runtime_version}" \
Expand Down
12 changes: 5 additions & 7 deletions liblttng-ust_sys-sdt.h/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -x
RUNTIME_ID=$(../runtime-id)
set +e # disable abort-on-error so we can have the pipeline below fail
case $RUNTIME_ID in
alpine*)packageName=$(apk list dotnet*lttng-ust);;
alpine*)packageName="" ;;
*)packageName=$(rpm -qa | grep 'dotnet.*lttng-ust');;
esac
set -e
Expand All @@ -16,22 +16,20 @@ if [[ -z "$packageName" ]]; then
case $RUNTIME_ID in
alpine*)
packageName="lttng-ust"
;;
;;
*)
packageName=$(rpm -qa | grep 'lttng-ust')
;;
;;
esac
fi
# If a dotnet-specific lttng package doesn't exist, we must be using
# the normal system-wide lttng package.
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)'
Expand Down
1 change: 1 addition & 0 deletions omnisharp/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"type": "bash",
"cleanup": true,
"ignoredRIDs":[
"linux-musl",
"linux-s390x"
]
}
3 changes: 0 additions & 3 deletions omnisharp/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ pushd workdir

runtime_id="$(../../runtime-id --portable)"

# disabled for alpine
[ -z "${runtime_id##*musl*}" ] && { echo No musl release of omnisharp, disabled; exit 0; }

wget --no-verbose "https://github.com/OmniSharp/omnisharp-roslyn/releases/latest/download/omnisharp-${runtime_id}.tar.gz"

mkdir omnisharp
Expand Down
15 changes: 8 additions & 7 deletions runtime-id
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -38,14 +38,15 @@ while [[ $# -gt 0 ]]; do
done

if [[ ${portable_rid} == 1 ]]; then
case "${ID}" in
alpine)echo "linux-musl-${arch}" ;;
*) echo "linux-${arch}" ;;
esac
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|alpine|rocky) rid_version=${VERSION_ID%.*} ;;
# Remove the minor version
alpine|ol|rhel|rocky) rid_version=${VERSION_ID%.*} ;;

*) rid_version=${VERSION_ID} ;;
esac
Expand Down
2 changes: 1 addition & 1 deletion template-test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ dotnet help > /dev/null 2>/dev/null

readarray -t allAutoTemplates < <(
dotnet new --list |
sed '0,/^------/d' |
sed '0,/^--*/d' |
awk -F ' +' ' { print $2 }' |
sed 's/,/\n/' |
sed -e '/^ *$/d' |
Expand Down

0 comments on commit 9c1fa19

Please sign in to comment.