Skip to content

Commit 8a500d7

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 8a500d7

2 files changed

Lines changed: 69 additions & 27 deletions

File tree

.github/workflows/ci.yml

Lines changed: 66 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
container_image:
17+
- docker.io/library/alpine:latest
18+
- docker.io/library/alpine:edge
1719
- quay.io/centos/centos:stream9
1820
- quay.io/centos/centos:stream10
19-
- registry.fedoraproject.org/fedora:42
2021
- registry.fedoraproject.org/fedora:43
22+
- registry.fedoraproject.org/fedora:44
2123
- registry.fedoraproject.org/fedora:rawhide
2224
- registry.access.redhat.com/ubi8
2325
- registry.access.redhat.com/ubi9
@@ -26,7 +28,7 @@ jobs:
2628
- "8.0"
2729
- "9.0"
2830
- "10.0"
29-
31+
3032
container:
3133
image: ${{ matrix.container_image }}
3234
options: --security-opt seccomp=unconfined
@@ -36,13 +38,21 @@ jobs:
3638
timeout-minutes: 5
3739
run: |
3840
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 }}
41+
# grep fedora matches Fedora, CentOS, and RHEL/UBI (via ID_LIKE="fedora")
42+
if grep fedora /etc/os-release; then
43+
dnf install -y dotnet-sdk-${{ matrix.dotnet_version }} git make
44+
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
45+
dnf install -y dotnet-sdk-aot-${{ matrix.dotnet_version }}
46+
fi
47+
elif grep alpine /etc/os-release; then
48+
if grep edge /etc/os-release; then
49+
echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
50+
fi
51+
apk upgrade -a
52+
apk add bash git make dotnet-sdk-${{ matrix.dotnet_version }}
53+
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
54+
apk add dotnet-sdk-aot-${{ matrix.dotnet_version }}
55+
fi
4656
fi
4757
4858
- uses: actions/checkout@v2
@@ -78,10 +88,12 @@ jobs:
7888
fail-fast: false
7989
matrix:
8090
container_image:
91+
- docker.io/library/alpine:latest
92+
- docker.io/library/alpine:edge
8193
- quay.io/centos/centos:stream9
8294
- quay.io/centos/centos:stream10
83-
- registry.fedoraproject.org/fedora:42
8495
- registry.fedoraproject.org/fedora:43
96+
- registry.fedoraproject.org/fedora:44
8597
- registry.fedoraproject.org/fedora:rawhide
8698
- registry.access.redhat.com/ubi8
8799
- registry.access.redhat.com/ubi9
@@ -100,13 +112,30 @@ jobs:
100112
timeout-minutes: 5
101113
run: |
102114
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 }}
115+
# grep fedora matches Fedora, CentOS, and RHEL/UBI (via ID_LIKE="fedora")
116+
if grep fedora /etc/os-release; then
117+
dnf install -y dotnet-sdk-${{ matrix.dotnet_version }} git make
118+
dnf install -y \
119+
dotnet-sdk-dbg-${{ matrix.dotnet_version }} \
120+
dotnet-runtime-dbg-${{ matrix.dotnet_version }} \
121+
aspnetcore-runtime-dbg-${{ matrix.dotnet_version }}
122+
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
123+
dnf install -y dotnet-sdk-aot-${{ matrix.dotnet_version }}
124+
fi
125+
elif grep alpine /etc/os-release; then
126+
if grep edge /etc/os-release; then
127+
echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories
128+
fi
129+
apk upgrade -a
130+
# dotnet-doc provides man pages tested by some reproducers
131+
apk add bash git make dotnet-sdk-${{ matrix.dotnet_version }} dotnet-doc
132+
apk add \
133+
dotnet-sdk-dbg-${{ matrix.dotnet_version }} \
134+
dotnet-runtime-dbg-${{ matrix.dotnet_version }} \
135+
aspnetcore-runtime-dbg-${{ matrix.dotnet_version }}
136+
if [[ ${{ matrix.dotnet_version }} != 8.* ]]; then
137+
apk add dotnet-sdk-aot-${{ matrix.dotnet_version }}
138+
fi
110139
fi
111140
112141
# We need to fetch the tags, so 'git tag' in 'make publish' below works
@@ -129,22 +158,34 @@ jobs:
129158
- name: Install Test dependencies
130159
timeout-minutes: 2
131160
run: |
132-
dnf install -y python3 wget $(grep '^Dependencies(dnf): ' dotnet-regular-tests/README.md | cut -d: -f2-) --skip-broken
161+
set -euo pipefail
162+
# grep fedora matches Fedora, CentOS, and RHEL/UBI (via ID_LIKE="fedora")
163+
if grep fedora /etc/os-release; then
164+
dnf install -y python3 wget $(grep '^Dependencies(dnf): ' dotnet-regular-tests/README.md | cut -d: -f2-) --skip-broken
165+
elif grep alpine /etc/os-release; then
166+
apk add python3 wget curl $(grep '^Dependencies(apk): ' dotnet-regular-tests/README.md | cut -d: -f2-)
167+
echo -e '[PostgreSQL]\nDescription=PostgreSQL Unicode\nDriver=/usr/lib/psqlodbcw.so\nUsageCount=1' > /etc/odbcinst.ini
168+
fi
133169
134170
- name: Run reproducers
171+
shell: bash
135172
run: |
136173
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
139174
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
175+
trait_flags=()
176+
177+
if [[ ${{ matrix.container_image }} == *ubi8 ]] ; then
178+
trait_flags+=( --trait ubi8-repos )
179+
fi
180+
if [[ ${{ matrix.container_image }} == *ubi9 ]] ; then
181+
trait_flags+=( --trait ubi9-repos )
182+
fi
183+
if [[ ${{ matrix.container_image }} == *ubi10 ]] ; then
184+
trait_flags+=( --trait ubi10-repos )
143185
fi
144186
145187
dotnet --info
146-
147-
dotnet turkey/Turkey.dll dotnet-regular-tests -v --timeout 600
188+
dotnet turkey/Turkey.dll dotnet-regular-tests -v --timeout 600 --trait github-ci "${trait_flags[@]}"
148189
149190
- name: Show Logs
150191
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)