Skip to content

Commit

Permalink
testing: litevm: remove RPM & extracted files after each test
Browse files Browse the repository at this point in the history
This reduces the total disk space required during each test, and avoids
errors resulting from filling up the disk.

Signed-off-by: Stephen Brennan <[email protected]>
  • Loading branch information
brenns10 committed Aug 6, 2024
1 parent dd9f75e commit b0582a4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/litevm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ jobs:
tox list
tox --notest
tox -e runner --notest
- name: Fetch RPMs
run: |
tox -e runner -- python -m testing.litevm.rpm
- name: Run tests
run: |
tox -e runner -- python -m testing.litevm.vm --python-version 3${{ matrix.python-minor }}
tox -e runner -- python -m testing.litevm.vm --delete-after-test --python-version 3${{ matrix.python-minor }}
5 changes: 5 additions & 0 deletions testing/litevm/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ def get_rpms(self) -> List[Path]:
self._get_rpms()
return self._rpm_paths + [self._dbinfo_path]

def delete_cache(self) -> None:
"""Removes all RPMs and the RPM cache."""
tree = self.cache_dir / self.slug()
shutil.rmtree(tree)

def get_oot_modules(self) -> List[Path]:
key = f"ol{self.ol_ver}uek{self.uek_ver}{self.arch}"
path = Path(__file__).parent / "mod" / key
Expand Down
10 changes: 10 additions & 0 deletions testing/litevm/vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ def main():
action="store_true",
help="Use CTF debuginfo for tests rather than DWARF",
)
parser.add_argument(
"--delete-after-test",
action="store_true",
help="Delete RPM cache and extract directory after test",
)
parser.add_argument(
"command",
nargs="*",
Expand All @@ -423,7 +428,12 @@ def main():
section_name = f"uek{k.uek_ver}"
section_text = f"Run tests on UEK{k.uek_ver}"
with ci_section(section_name, section_text):
release = k.latest_release()
extract_dir = args.extract_dir / release
run_vm(k, args.extract_dir, commands)
if args.delete_after_test:
shutil.rmtree(extract_dir)
k.delete_cache()


if __name__ == "__main__":
Expand Down

0 comments on commit b0582a4

Please sign in to comment.