Skip to content

Commit 4cb7c83

Browse files
omajidclaude
andcommitted
Don't fail when rpm is not installed
In environments where rpm is not available, the TestRunner.LogEnvironment method throws an exception: Unhandled exception: System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'rpm' with working directory 'Samples'. No such file or directory The code tries to handle these environments (like alpine), but doesn't catch the actual Win32Exception thrown when the rpm command is not found. It only catches InvalidOperationException (which happens when rpm command exits with an error). Also update CI to catch issues like this by adding an alpine leg. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 6ce0abf commit 4cb7c83

2 files changed

Lines changed: 68 additions & 24 deletions

File tree

.github/workflows/ci.yml

Lines changed: 65 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
container_image:
17+
- docker.io/library/alpine:latest
1718
- quay.io/centos/centos:stream9
1819
- quay.io/centos/centos:stream10
19-
- registry.fedoraproject.org/fedora:42
2020
- registry.fedoraproject.org/fedora:43
21+
- registry.fedoraproject.org/fedora:44
2122
- registry.fedoraproject.org/fedora:rawhide
2223
- registry.access.redhat.com/ubi8
2324
- registry.access.redhat.com/ubi9
@@ -36,13 +37,28 @@ jobs:
3637
timeout-minutes: 5
3738
run: |
3839
set -euo pipefail
39-
dnf install -y dotnet-sdk-${{ matrix.dotnet_version }} git make
40-
dnf install -y \
41-
dotnet-sdk-dbg-${{ matrix.dotnet_version }} \
42-
dotnet-runtime-dbg-${{ matrix.dotnet_version }} \
43-
aspnetcore-runtime-dbg-${{ matrix.dotnet_version }}
44-
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
45-
dnf install -y dotnet-sdk-aot-${{ matrix.dotnet_version }}
40+
if grep fedora /etc/os-release; then
41+
dnf install -y dotnet-sdk-${{ matrix.dotnet_version }} git make
42+
dnf install -y \
43+
dotnet-sdk-dbg-${{ matrix.dotnet_version }} \
44+
dotnet-runtime-dbg-${{ matrix.dotnet_version }} \
45+
aspnetcore-runtime-dbg-${{ matrix.dotnet_version }}
46+
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
47+
dnf install -y dotnet-sdk-aot-${{ matrix.dotnet_version }}
48+
fi
49+
elif grep alpine /etc/os-release; then
50+
if grep edge /etc/os-release; then
51+
echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
52+
fi
53+
apk upgrade -a
54+
apk add dotnet-sdk-${{ matrix.dotnet_version }} dotnet-doc
55+
apk add \
56+
dotnet-sdk-dbg-${{ matrix.dotnet_version }} \
57+
dotnet-runtime-dbg-${{ matrix.dotnet_version }} \
58+
aspnetcore-runtime-dbg-${{ matrix.dotnet_version }}
59+
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
60+
apk add dotnet-sdk-aot-${{ matrix.dotnet_version }}
61+
fi
4662
fi
4763
4864
- uses: actions/checkout@v2
@@ -78,6 +94,7 @@ jobs:
7894
fail-fast: false
7995
matrix:
8096
container_image:
97+
- docker.io/library/alpine:latest
8198
- quay.io/centos/centos:stream9
8299
- quay.io/centos/centos:stream10
83100
- registry.fedoraproject.org/fedora:42
@@ -100,13 +117,28 @@ jobs:
100117
timeout-minutes: 5
101118
run: |
102119
set -euo pipefail
103-
dnf install -y dotnet-sdk-${{ matrix.dotnet_version }} git make
104-
dnf install -y \
105-
dotnet-sdk-dbg-${{ matrix.dotnet_version }} \
106-
dotnet-runtime-dbg-${{ matrix.dotnet_version }} \
107-
aspnetcore-runtime-dbg-${{ matrix.dotnet_version }}
108-
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
109-
dnf install -y dotnet-sdk-aot-${{ matrix.dotnet_version }}
120+
if grep fedora /etc/os-release; then
121+
dnf install -y dotnet-sdk-${{ matrix.dotnet_version }} git make
122+
dnf install -y \
123+
dotnet-sdk-dbg-${{ matrix.dotnet_version }} \
124+
dotnet-runtime-dbg-${{ matrix.dotnet_version }} \
125+
aspnetcore-runtime-dbg-${{ matrix.dotnet_version }}
126+
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
127+
dnf install -y dotnet-sdk-aot-${{ matrix.dotnet_version }}
128+
fi
129+
elif grep alpine /etc/os-release; then
130+
if grep edge /etc/os-release; then
131+
echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
132+
fi
133+
apk upgrade -a
134+
apk add dotnet-sdk-${{ matrix.dotnet_version }} dotnet-doc
135+
apk add \
136+
dotnet-sdk-dbg-${{ matrix.dotnet_version }} \
137+
dotnet-runtime-dbg-${{ matrix.dotnet_version }} \
138+
aspnetcore-runtime-dbg-${{ matrix.dotnet_version }}
139+
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
140+
apk add dotnet-sdk-aot-${{ matrix.dotnet_version }}
141+
fi
110142
fi
111143
112144
# We need to fetch the tags, so 'git tag' in 'make publish' below works
@@ -129,22 +161,33 @@ jobs:
129161
- name: Install Test dependencies
130162
timeout-minutes: 2
131163
run: |
132-
dnf install -y python3 wget $(grep '^Dependencies(dnf): ' dotnet-regular-tests/README.md | cut -d: -f2-) --skip-broken
164+
if grep fedora /etc/os-release; then
165+
dnf install -y python3 wget $(grep '^Dependencies(dnf): ' dotnet-regular-tests/README.md | cut -d: -f2-) --skip-broken
166+
elif grep alpine /etc/os-release; then
167+
apk add python3 wget curl $(grep '^Dependencies(apk): ' dotnet-regular-tests/README.md | cut -d: -f2-)
168+
echo -e '[PostgreSQL]\nDescription=PostgreSQL Unicode\nDriver=/usr/lib/psqlodbcw.so\nUsageCount=1' > /etc/odbcinst.ini
169+
fi
133170
134171
- name: Run reproducers
172+
shell: bash
135173
run: |
136174
set -euo pipefail
137-
### HACK: Filter tests that can't pass in Containers
138-
rm -r dotnet-regular-tests/debugging-sos-lldb* dotnet-regular-tests/createdump-aspnet dotnet-regular-tests/cgroup-limit
139175
140-
### HACK: UBI 8 is missing strace and bash-completion packages for these tests
141-
if [[ ${{ matrix.container_image }} == *ubi* ]] ; then
142-
rm -r dotnet-regular-tests/telemetry-is-off-by-default dotnet-regular-tests/bash-completion dotnet-regular-tests/system-data-odbc
176+
trait_flags=()
177+
178+
if [[ ${{ matrix.container_image }} == *ubi8 ]] ; then
179+
trait_flags+=( --trait ubi8-repos )
180+
fi
181+
if [[ ${{ matrix.container_image }} == *ubi9 ]] ; then
182+
trait_flags+=( --trait ubi9-repos )
183+
fi
184+
if [[ ${{ matrix.container_image }} == *ubi10 ]] ; then
185+
trait_flags+=( --trait ubi10-repos )
143186
fi
144187
145188
dotnet --info
189+
dotnet turkey/Turkey.dll dotnet-regular-tests -v --timeout 600 --trait github-ci "${trait_flags[@]}"
146190
147-
dotnet turkey/Turkey.dll dotnet-regular-tests -v --timeout 600
148191
149192
- name: Show Logs
150193
if: ${{ always() }}

Turkey/TestRunner.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using System.Diagnostics;
45
using System.IO;
56
using System.Linq;
@@ -184,15 +185,15 @@ private static void LogEnvironment(string logDir)
184185
string installedPackages = ProcessRunner.Run("rpm", "--query", "--all");
185186
File.WriteAllText(Path.Combine(logDir, "packages"), installedPackages);
186187
}
187-
catch (InvalidOperationException e)
188+
catch (Exception e) when (e is InvalidOperationException or Win32Exception)
188189
{
189190
string error = e.Message;
190191
try
191192
{
192193
string installedPackages = ProcessRunner.Run("apk", "list", "--installed");
193194
File.WriteAllText(Path.Combine(logDir, "packages"), installedPackages);
194195
}
195-
catch (InvalidOperationException e2)
196+
catch (Exception e2) when (e2 is InvalidOperationException or Win32Exception)
196197
{
197198
error = error + Environment.NewLine + e2.Message;
198199
string installedPackages = "could not find installed packages" + Environment.NewLine + error;

0 commit comments

Comments
 (0)