diff options
author | Armin Kuster <akuster808@gmail.com> | 2022-05-21 11:43:47 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2022-05-26 16:09:42 -0700 |
commit | 1afcf4413bc6266cc178549ee5d9f12b1c9b06de (patch) | |
tree | 14cef17a87e8236951096568dcbfad4664a411b4 /meta-parsec/lib/oeqa | |
parent | 6805f23867aeafda189cb55de15a9347410859d9 (diff) | |
download | meta-security-1afcf4413bc6266cc178549ee5d9f12b1c9b06de.tar.gz |
oeqa: add parsec runtime tests
Signed-off-by: Armin Kuster <akuster808@gmail.com>
---
v2]
Add parsec-cli-tests.sh to mix
Signed-off-by: Armin Kuster <akuster808@gmail.com>
Diffstat (limited to 'meta-parsec/lib/oeqa')
-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])) | ||