diff options
Diffstat (limited to 'meta-parsec/lib/oeqa/runtime/cases/parsec.py')
| -rw-r--r-- | meta-parsec/lib/oeqa/runtime/cases/parsec.py | 33 |
1 files changed, 33 insertions, 0 deletions
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 @@ | |||
| 1 | # Copyright (C) 2022 Armin Kuster <akuster808@gmail.com> | ||
| 2 | # | ||
| 3 | import re | ||
| 4 | |||
| 5 | from oeqa.runtime.case import OERuntimeTestCase | ||
| 6 | from oeqa.core.decorator.depends import OETestDepends | ||
| 7 | from oeqa.runtime.decorator.package import OEHasPackage | ||
| 8 | |||
| 9 | class ParsecTest(OERuntimeTestCase): | ||
| 10 | @OEHasPackage(['parsec-service']) | ||
| 11 | @OETestDepends(['ssh.SSHTest.test_ssh']) | ||
| 12 | def test_parsec_service(self): | ||
| 13 | toml_file = '/etc/parsec/config.tom' | ||
| 14 | status, output = self.target.run('echo library_path = "/usr/lib/softhsm/libsofthsm2.so" >> %s' %(toml_file)) | ||
| 15 | status, output = self.target.run('echo slot_number = 0 >> %s' %(toml_file)) | ||
| 16 | status, output = self.target.run('echo user_pin = "123456" >> %s' %(toml_file)) | ||
| 17 | cmds = [ | ||
| 18 | '/etc/init.d/parsec stop', | ||
| 19 | 'sleep 5', | ||
| 20 | 'softhsm2-util --init-token --slot 0 --label "Parsec Service" --pin 123456 --so-pin 123456', | ||
| 21 | 'for d in /var/lib/softhsm/tokens/*; do chown -R parsec $d; done', | ||
| 22 | 'mkdir /tmp/myvtpm', | ||
| 23 | 'swtpm socket --tpmstate dir=/tmp/myvtpm --tpm2 --ctrl type=tcp,port=2322 --server type=tcp,port=2321 --flags not-need-init &', | ||
| 24 | 'export TPM2TOOLS_TCTI="swtpm:port=2321"', | ||
| 25 | 'tpm2_startup -c', | ||
| 26 | 'sleep 2', | ||
| 27 | '/etc/init.d/parsec start', | ||
| 28 | 'parsec-cli-tests.sh' | ||
| 29 | ] | ||
| 30 | |||
| 31 | for cmd in cmds: | ||
| 32 | status, output = self.target.run(cmd) | ||
| 33 | self.assertEqual(status, 0, msg='\n'.join([cmd, output])) | ||
