test_ukify: explicitly remove big temporary directories
pytest intentionally keeps around a limited number of the previous test temporary directories [1]. This is generally OK, but in our tests that generate initrds, we create a few very large files (both the initrd and kernel in a few copies), which quickly adds up. I had a particularly large initrd (because of some mkosi-initrd shenanigans), and I unded up with dozens of gigabytes of temporary files from the tests. Let's just nuke the dirs where we write kernel data. [1] https://github.com/pytest-dev/pytest/issues/543
This commit is contained in:
@@ -438,6 +438,8 @@ def test_basic_operation(kernel_initrd, tmp_path):
|
||||
# let's check that objdump likes the resulting file
|
||||
subprocess.check_output(['objdump', '-h', output])
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
def test_sections(kernel_initrd, tmp_path):
|
||||
if kernel_initrd is None:
|
||||
pytest.skip('linux+initrd not found')
|
||||
@@ -466,6 +468,8 @@ def test_sections(kernel_initrd, tmp_path):
|
||||
for sect in 'text osrel cmdline linux initrd uname test'.split():
|
||||
assert re.search(fr'^\s*\d+\s+\.{sect}\s+[0-9a-f]+', dump, re.MULTILINE)
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
def test_addon(tmp_path):
|
||||
output = f'{tmp_path}/addon.efi'
|
||||
args = [
|
||||
@@ -572,6 +576,8 @@ def test_efi_signing_sbsign(days, kernel_initrd, tmp_path):
|
||||
|
||||
assert 'Signature verification OK' in dump
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
def test_efi_signing_pesign(kernel_initrd, tmp_path):
|
||||
if kernel_initrd is None:
|
||||
pytest.skip('linux+initrd not found')
|
||||
@@ -615,6 +621,8 @@ def test_efi_signing_pesign(kernel_initrd, tmp_path):
|
||||
|
||||
assert f"The signer's common name is {author}" in dump
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
def test_inspect(kernel_initrd, tmp_path, capsys):
|
||||
if kernel_initrd is None:
|
||||
pytest.skip('linux+initrd not found')
|
||||
@@ -660,6 +668,7 @@ def test_inspect(kernel_initrd, tmp_path, capsys):
|
||||
expected_linux = '.linux:\n size:'
|
||||
assert expected_linux in text
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
def test_pcr_signing(kernel_initrd, tmp_path):
|
||||
if kernel_initrd is None:
|
||||
@@ -724,6 +733,8 @@ def test_pcr_signing(kernel_initrd, tmp_path):
|
||||
assert list(sig.keys()) == ['sha1']
|
||||
assert len(sig['sha1']) == 4 # four items for four phases
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
def test_pcr_signing2(kernel_initrd, tmp_path):
|
||||
if kernel_initrd is None:
|
||||
pytest.skip('linux+initrd not found')
|
||||
@@ -794,6 +805,8 @@ def test_pcr_signing2(kernel_initrd, tmp_path):
|
||||
assert list(sig.keys()) == ['sha1']
|
||||
assert len(sig['sha1']) == 6 # six items for six phases paths
|
||||
|
||||
shutil.rmtree(tmp_path)
|
||||
|
||||
def test_key_cert_generation(tmp_path):
|
||||
opts = ukify.parse_args([
|
||||
'genkey',
|
||||
|
||||
Reference in New Issue
Block a user