blob: df47b353ed245cb84a4f55ae599c99c196e15535 [file] [log] [blame]
Andrew Geissler78b72792022-06-14 06:47:25 -05001# 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)