summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArmin Kuster <akuster808@gmail.com>2022-05-30 07:14:16 -0700
committerArmin Kuster <akuster808@gmail.com>2022-06-07 16:58:24 -0700
commit50eff83d428598630d5277904eeeb4b668c31c22 (patch)
tree864f83eec7251464e36d6988e6fa9d89829042de
parent3cb0ec30868f3a0a2ad1560f3e20a8c6cc7c12dd (diff)
downloadmeta-security-50eff83d428598630d5277904eeeb4b668c31c22.tar.gz
oeqa/swtpm: add swtpm runtime
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta-tpm/lib/oeqa/runtime/cases/swtpm.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/meta-tpm/lib/oeqa/runtime/cases/swtpm.py b/meta-tpm/lib/oeqa/runtime/cases/swtpm.py
new file mode 100644
index 0000000..df47b35
--- /dev/null
+++ b/meta-tpm/lib/oeqa/runtime/cases/swtpm.py
@@ -0,0 +1,24 @@
1# Copyright (C) 2022 Armin Kuster <akuster808@gmail.com>
2#
3from oeqa.runtime.case import OERuntimeTestCase
4from oeqa.core.decorator.depends import OETestDepends
5from oeqa.runtime.decorator.package import OEHasPackage
6from oeqa.core.decorator.data import skipIfNotFeature
7
8class SwTpmTest(OERuntimeTestCase):
9 @classmethod
10 def setUpClass(cls):
11 cls.tc.target.run('mkdir /tmp/myvtpm2')
12 cls.tc.target.run('chown tss:root /tmp/myvtpm2')
13
14 @classmethod
15 def tearDownClass(cls):
16 cls.tc.target.run('rm -fr /tmp/myvtpm2')
17
18 @skipIfNotFeature('tpm2','Test tpm2_swtpm_socket requires tpm2 to be in DISTRO_FEATURES')
19 @OETestDepends(['ssh.SSHTest.test_ssh'])
20 @OEHasPackage(['swtpm'])
21 def test_swtpm2_ek_cert(self):
22 cmd = 'swtpm_setup --tpmstate /tmp/myvtpm2 --create-ek-cert --create-platform-cert --tpm2',
23 status, output = self.target.run(cmd)
24 self.assertEqual(status, 0, msg="swtpm create-ek-cert failed: %s" % output)