From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- .../meta-tpm/lib/oeqa/runtime/cases/tpm2.py | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 external/meta-security/meta-tpm/lib/oeqa/runtime/cases/tpm2.py (limited to 'external/meta-security/meta-tpm/lib/oeqa/runtime/cases/tpm2.py') diff --git a/external/meta-security/meta-tpm/lib/oeqa/runtime/cases/tpm2.py b/external/meta-security/meta-tpm/lib/oeqa/runtime/cases/tpm2.py new file mode 100644 index 00000000..c6f9d922 --- /dev/null +++ b/external/meta-security/meta-tpm/lib/oeqa/runtime/cases/tpm2.py @@ -0,0 +1,43 @@ +# Copyright (C) 2019 Armin Kuster +# +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage + + +class Tpm2Test(OERuntimeTestCase): + def check_endlines(self, results, expected_endlines): + for line in results.splitlines(): + for el in expected_endlines: + if line == el: + expected_endlines.remove(el) + break + + if expected_endlines: + self.fail('Missing expected line endings:\n %s' % '\n '.join(expected_endlines)) + + @OEHasPackage(['tpm2-tss']) + @OEHasPackage(['tpm2-abrmd']) + @OEHasPackage(['tpm2-tools']) + @OEHasPackage(['ibmswtpm2']) + @OETestDepends(['ssh.SSHTest.test_ssh']) + def test_tpm2_sim(self): + cmds = [ + 'tpm_server &', + 'tpm2-abrmd --allow-root --tcti=mssim &' + ] + + for cmd in cmds: + status, output = self.target.run(cmd) + self.assertEqual(status, 0, msg='\n'.join([cmd, output])) + + @OETestDepends(['tpm2.Tpm2Test.test_tpm2_sim']) + def test_tpm2(self): + (status, output) = self.target.run('tpm2_pcrlist') + expected_endlines = [] + expected_endlines.append('sha1 :') + expected_endlines.append(' 0 : 0000000000000000000000000000000000000003') + expected_endlines.append(' 1 : 0000000000000000000000000000000000000000') + + self.check_endlines(output, expected_endlines) + -- cgit 1.2.3-korg