1414from pathlib import Path
1515from typing import List
1616from typing import Optional
17+ from typing import Union
1718
1819from drgn_tools .util import download_file
1920from testing .util import BASE_DIR
2425)
2526REPODATA = "repodata/repomd.xml"
2627
27- DEBUGINFO_URL = "https://oss.oracle.com/ol{ol_ver}/debuginfo/kernel-uek -debuginfo-{release}.rpm"
28+ DEBUGINFO_URL = "https://oss.oracle.com/ol{ol_ver}/debuginfo/{pkgbase} -debuginfo-{release}.rpm"
2829
2930YUM_CACHE_DIR = BASE_DIR / "yumcache"
3031
@@ -91,7 +92,7 @@ def download_file_cached(
9192
9293class TestKernel :
9394 ol_ver : int
94- uek_ver : int
95+ uek_ver : Union [ int , str ]
9596 arch : str
9697 pkgs : List [str ]
9798
@@ -104,11 +105,15 @@ def __init__(
104105 arch : str ,
105106 pkgs : List [str ],
106107 cache_dir : Optional [Path ] = None ,
108+ pkgbase : str = "kernel-uek" ,
109+ yum_fmt : Optional [str ] = None ,
107110 ) -> None :
108111 self .ol_ver = ol_ver
109112 self .uek_ver = uek_ver
110113 self .arch = arch
111114 self .pkgs = pkgs
115+ self .yum_fmt = yum_fmt
116+ self .pkgbase = pkgbase
112117
113118 self ._release : str = ""
114119 self ._rpm_urls : List [str ] = []
@@ -136,7 +141,7 @@ def _cache_key(self, kind: str) -> str:
136141 def _getlatest (self ) -> None :
137142 # Fetch Yum index (repomd.xml) to get the database filename.
138143 # This is never cached, and it's a small file.
139- yumbase = UEK_YUM .format (
144+ yumbase = ( self . yum_fmt or UEK_YUM ) .format (
140145 ol_ver = self .ol_ver ,
141146 uek_ver = self .uek_ver ,
142147 arch = self .arch ,
@@ -170,14 +175,13 @@ def _getlatest(self) -> None:
170175 # Finally, search for the latest version in the DB. We always search for
171176 # kernel-uek since even if the package is split, that's the
172177 # meta-package.
173- pkg = "kernel-uek"
174178 conn = sqlite3 .connect (str (db_path ))
175179 rows = conn .execute (
176180 """
177181 SELECT version, release, location_href FROM packages
178182 WHERE name=? AND arch=?;
179183 """ ,
180- (pkg , self .arch ),
184+ (self . pkgbase , self .arch ),
181185 ).fetchall ()
182186 conn .close ()
183187
@@ -193,10 +197,12 @@ def key(t):
193197 self ._rpm_urls = []
194198 rpm_url = yumbase + href
195199 for final_pkg in self .pkgs :
196- self ._rpm_urls .append (rpm_url .replace (pkg , final_pkg ))
200+ self ._rpm_urls .append (rpm_url .replace (self . pkgbase , final_pkg ))
197201 self ._release = f"{ ver } -{ rel } .{ self .arch } "
198202 self ._dbinfo_url = DEBUGINFO_URL .format (
199- ol_ver = self .ol_ver , release = self ._release
203+ ol_ver = self .ol_ver ,
204+ release = self ._release ,
205+ pkgbase = self .pkgbase ,
200206 )
201207
202208 def _get_rpms (self ) -> None :
@@ -236,6 +242,28 @@ def get_oot_modules(self) -> List[Path]:
236242
237243
238244TEST_KERNELS = [
245+ # UEK-next is a snapshot of the latest upstream kernel, with UEK
246+ # configurations and any customizations. It's not officially supported, but
247+ # it's an excellent test bed to ensure we are ready to support the latest
248+ # upstream features.
249+ # We also apparently need to add "-modules-core" RPMs, because there weren't
250+ # enough kernel RPMs yet.
251+ # Tests currently fail on UEK-next. Uncomment this to enable the tests:
252+ # TestKernel(
253+ # 9,
254+ # "next",
255+ # "x86_64",
256+ # [
257+ # "kernel-ueknext-core",
258+ # "kernel-ueknext-modules",
259+ # "kernel-ueknext-modules-core",
260+ # ],
261+ # yum_fmt=(
262+ # "https://yum.oracle.com/repo/OracleLinux/OL{ol_ver}/"
263+ # "developer/UEK{uek_ver}/{arch}/"
264+ # ),
265+ # pkgbase="kernel-ueknext",
266+ # ),
239267 # UEK7 switches from a single "kernel-uek" to "-core" and "-modules".
240268 # The "kernel-uek" package still exists as a placeholder.
241269 TestKernel (9 , 7 , "x86_64" , ["kernel-uek-core" , "kernel-uek-modules" ]),
0 commit comments