From 1afcf4413bc6266cc178549ee5d9f12b1c9b06de Mon Sep 17 00:00:00 2001 From: Armin Kuster Date: Sat, 21 May 2022 11:43:47 -0700 Subject: oeqa: add parsec runtime tests Signed-off-by: Armin Kuster --- v2] Add parsec-cli-tests.sh to mix Signed-off-by: Armin Kuster --- meta-parsec/lib/oeqa/runtime/cases/parsec.py | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 meta-parsec/lib/oeqa/runtime/cases/parsec.py (limited to 'meta-parsec/lib') diff --git a/meta-parsec/lib/oeqa/runtime/cases/parsec.py b/meta-parsec/lib/oeqa/runtime/cases/parsec.py new file mode 100644 index 0000000..547f74c --- /dev/null +++ b/meta-parsec/lib/oeqa/runtime/cases/parsec.py @@ -0,0 +1,33 @@ +# Copyright (C) 2022 Armin Kuster +# +import re + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage + +class ParsecTest(OERuntimeTestCase): + @OEHasPackage(['parsec-service']) + @OETestDepends(['ssh.SSHTest.test_ssh']) + def test_parsec_service(self): + toml_file = '/etc/parsec/config.tom' + status, output = self.target.run('echo library_path = "/usr/lib/softhsm/libsofthsm2.so" >> %s' %(toml_file)) + status, output = self.target.run('echo slot_number = 0 >> %s' %(toml_file)) + status, output = self.target.run('echo user_pin = "123456" >> %s' %(toml_file)) + cmds = [ + '/etc/init.d/parsec stop', + 'sleep 5', + 'softhsm2-util --init-token --slot 0 --label "Parsec Service" --pin 123456 --so-pin 123456', + 'for d in /var/lib/softhsm/tokens/*; do chown -R parsec $d; done', + 'mkdir /tmp/myvtpm', + 'swtpm socket --tpmstate dir=/tmp/myvtpm --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init &', + 'export TPM2TOOLS_TCTI="swtpm:port=2321"', + 'tpm2_startup -c', + 'sleep 2', + '/etc/init.d/parsec start', + 'parsec-cli-tests.sh' + ] + + for cmd in cmds: + status, output = self.target.run(cmd) + self.assertEqual(status, 0, msg='\n'.join([cmd, output])) -- cgit v1.2.3-54-g00ecf