aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManasi Godse <magodse@redhat.com>2022-08-04 17:32:19 -0700
committerJohn Kacur <jkacur@redhat.com>2022-08-05 11:27:32 -0400
commitab0ac019ebfdb397ce57d185b5b97d0ae7928fe4 (patch)
treebc6c2dfe3f1e747e919c1f2497343f49aa9c5dff
parent11cbb9e47bf49fa53d880eb0e024c6687d7a7efb (diff)
downloadrteval-ab0ac019ebfdb397ce57d185b5b97d0ae7928fe4.tar.gz
rteval: enhancement to --kcompile-source option for kernel tarball
The --kcompile-source option is enhanced such that it can find the kernel source tarballs using the values as 'linux-5.18.1' , '5.18.1', 'linux-5.18.1.tar.xz' This eliminates the need to type the entire source filename as a value to the option. The enhancement will look for the tarballs in the loadsource directory. Signed-off-by: Manasi Godse <magodse@redhat.com> Reviewed-by: Leah Leshchinsky <lleshchi@redhat.com> Signed-off-by: John Kacur <jkacur@redhat.com>
-rw-r--r--rteval/modules/loads/kcompile.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py
index 6dd8d94..7d78d0f 100644
--- a/rteval/modules/loads/kcompile.py
+++ b/rteval/modules/loads/kcompile.py
@@ -166,16 +166,33 @@ class Kcompile(CommandLineLoad):
raise rtevalRuntimeError(self, \
f"error removing builddir ({self.buildir}) (ret={ret})")
+ def _find_tarball(self):
+ # If the user specifies the full kernel name, check if available
+ tarfile = os.path.join(self.srcdir, self._cfg.source)
+ if os.path.exists(tarfile):
+ return tarfile
+
+ if 'rc' in self._cfg.source:
+ tarfile_prefix = re.search(r"\d{1,2}\.\d{1,3}\-[a-z]*\d{1,2}", self._cfg.source).group(0)
+ else:
+ tarfile_prefix = re.search(r"\d{1,2}\.\d{1,3}\.*\d{1,2}", self._cfg.source).group(0)
+
+ # either a tar.xz or tar.gz might exist. Check for both.
+ xz_file = os.path.join(self.srcdir,"linux-" + tarfile_prefix + ".tar.xz" )
+ gz_file = os.path.join(self.srcdir,"linux-" + tarfile_prefix + ".tar.gz" )
+ if os.path.exists(xz_file):
+ return xz_file
+ elif os.path.exists(gz_file):
+ return gz_file
+ raise rtevalRuntimeError(self, f"tarfile {tarfile} does not exist!")
+
def _WorkloadSetup(self):
if self._donotrun:
return
# find our source tarball
if self._cfg.source:
- tarfile = os.path.join(self.srcdir, self._cfg.source)
- if not os.path.exists(tarfile):
- raise rtevalRuntimeError(self, f" tarfile {tarfile} does not exist!")
- self.source = tarfile
+ self.source = self._find_tarball()
kernel_prefix = re.search(r"linux-\d{1,2}\.\d{1,3}\.*\d{1,2}", self.source).group(0)
else:
tarfiles = glob.glob(os.path.join(self.srcdir, f"{DEFAULT_KERNEL_PREFIX}*"))