Skip to content

Commit

Permalink
tests: Adjust path for swtpm state to use path under /var/tmp/
Browse files Browse the repository at this point in the history
To avoid AppArmor-related test failures when functional test are run from
somewhere under /mnt, adjust the path to swtpm's state to use an AppArmor-
supported path, such as /var/tmp, which is provided by the python function
tempfile.TemporaryDirectory().

An update to swtpm's AppArmor profile is also being done to support /var/tmp.

Link: https://lore.kernel.org/qemu-devel/CAFEAcA8A=kWLtTZ+nua-MpzqkaEjW5srOYZruZnE2tB6vmoMig@mail.gmail.com/
Link: stefanberger/swtpm#944
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
  • Loading branch information
stefanberger authored and GitHub Actions Bot committed Nov 6, 2024
1 parent 51d7495 commit 7e867b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/functional/test_arm_aspeed.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,11 @@ def test_arm_ast2600_evb_buildroot_tpm(self):

image_path = self.ASSET_BR2_202302_AST2600_TPM_FLASH.fetch()

socket_dir = tempfile.TemporaryDirectory(prefix="qemu_")
socket = os.path.join(socket_dir.name, 'swtpm-socket')
tpmstate_dir = tempfile.TemporaryDirectory(prefix="qemu_")
socket = os.path.join(tpmstate_dir.name, 'swtpm-socket')

subprocess.run(['swtpm', 'socket', '-d', '--tpm2',
'--tpmstate', f'dir={self.vm.temp_dir}',
'--tpmstate', f'dir={tpmstate_dir.name}',
'--ctrl', f'type=unixio,path={socket}'])

self.vm.add_args('-chardev', f'socket,id=chrtpm,path={socket}')
Expand Down

0 comments on commit 7e867b1

Please sign in to comment.