Skip to content

Commit 3ab904a

Browse files
committed
testing.litevm: skip up to 4 kernels w/o debuginfo
We've seen tests fail due to debuginfo being missing from oss.oracle.com. This is an ongoing issue and rather than have it block our tests, we need to add a bit more flexibility. This is still only activated when the github label is applied to the PR, so in most cases, up-to-date debuginfo is still required. This just unblocks pull request review and merge. Orabug: 38625032 Signed-off-by: Stephen Brennan <[email protected]>
1 parent e778d09 commit 3ab904a

File tree

1 file changed

+26
-13
lines changed

1 file changed

+26
-13
lines changed

testing/litevm/rpm.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def __init__(
123123
cache_dir: Optional[Path] = None,
124124
pkgbase: str = "kernel-uek",
125125
yum_fmt: Optional[str] = None,
126+
frozen_release: Optional[str] = None,
126127
) -> None:
127128
self.ol_ver = ol_ver
128129
self.uek_ver = uek_ver
@@ -131,7 +132,7 @@ def __init__(
131132
self.yum_fmt = yum_fmt
132133
self.pkgbase = pkgbase
133134

134-
self._release: str = ""
135+
self._release: str = frozen_release or ""
135136
self._rpm_urls: List[str] = []
136137
self._dbinfo_url: str = ""
137138

@@ -188,17 +189,26 @@ def _getlatest(self) -> None:
188189
)
189190
db_path = db_path_dec
190191

191-
# Finally, search for the latest version in the DB. We always search for
192-
# kernel-uek since even if the package is split, that's the
193-
# meta-package.
194192
conn = sqlite3.connect(str(db_path))
195-
rows = conn.execute(
196-
"""
197-
SELECT version, release, location_href FROM packages
198-
WHERE name=? AND arch=?;
199-
""",
200-
(self.pkgbase, self.arch),
201-
).fetchall()
193+
if self._release:
194+
# If a release was specified, we'll search for just that version in
195+
# the sqlite db.
196+
rows = conn.execute(
197+
"""
198+
SELECT version, release, location_href FROM packages
199+
WHERE name=? AND (version || '-' || release || '.' || arch)=?;
200+
""",
201+
(self.pkgbase, self._release),
202+
).fetchall()
203+
else:
204+
# Otherwise, fetch all versions so we can find the latest.
205+
rows = conn.execute(
206+
"""
207+
SELECT version, release, location_href FROM packages
208+
WHERE name=? AND arch=?;
209+
""",
210+
(self.pkgbase, self.arch),
211+
).fetchall()
202212
conn.close()
203213

204214
# Sqlite can't sort versions correctly, so we load them all and sort
@@ -211,7 +221,10 @@ def key(t):
211221
)
212222
rows.sort(key=key, reverse=True)
213223
versions_tried = []
214-
for ver, rel, href in rows[:2]:
224+
# We will try a maximum of the 5 most recent kernel to see whether
225+
# debuginfo is available. This adds a bit of wiggle room in case of
226+
# situations where debuginfo is not up-to-date online.
227+
for ver, rel, href in rows[:5]:
215228
# Check whether all RPMs are either cached or available via HTTP
216229
rpm_urls: List[str] = []
217230
rpm_url = yumbase + href
@@ -260,7 +273,7 @@ def key(t):
260273
)
261274

262275
def _get_rpms(self) -> None:
263-
if not self._release:
276+
if not self._rpm_urls:
264277
self._getlatest()
265278

266279
self._rpm_paths = []

0 commit comments

Comments
 (0)