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 --- .../lib/oeqa/runtime/cases/samhain.py | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 external/meta-security/lib/oeqa/runtime/cases/samhain.py (limited to 'external/meta-security/lib/oeqa/runtime/cases/samhain.py') diff --git a/external/meta-security/lib/oeqa/runtime/cases/samhain.py b/external/meta-security/lib/oeqa/runtime/cases/samhain.py new file mode 100644 index 00000000..5043a38c --- /dev/null +++ b/external/meta-security/lib/oeqa/runtime/cases/samhain.py @@ -0,0 +1,43 @@ +# Copyright (C) 2019 Armin Kuster +# +import re +import os + +from oeqa.runtime.case import OERuntimeTestCase +from oeqa.core.decorator.depends import OETestDepends +from oeqa.runtime.decorator.package import OEHasPackage + + +class SamhainTest(OERuntimeTestCase): + + @OEHasPackage(['samhain-standalone']) + @OETestDepends(['ssh.SSHTest.test_ssh']) + def test_samhain_help(self): + machine = self.td.get('MACHINE', '') + status, output = self.target.run('echo "127.0.0.1 %s.localdomain %s" >> /etc/hosts' % (machine, machine)) + msg = ("samhain can't append hosts. " + 'Status and output:%s and %s' % (status, output)) + self.assertEqual(status, 0, msg = msg) + + status, output = self.target.run('samhain --help') + msg = ('samhain command does not work as expected. ' + 'Status and output:%s and %s' % (status, output)) + self.assertEqual(status, 0, msg = msg) + + @OETestDepends(['samhain.SamhainTest.test_samhain_help']) + def test_samhain_init_db(self): + status, output = self.target.run('samhain -t init') + match = re.search('FAILED: 0 ', output) + if not match: + msg = ('samhain database init had an unexpected failure. ' + 'Status and output:%s and %s' % (status, output)) + self.assertEqual(status, 0, msg = msg) + + @OETestDepends(['samhain.SamhainTest.test_samhain_init_db']) + def test_samhain_db_check(self): + status, output = self.target.run('samhain -t check') + match = re.search('FAILED: 0 ', output) + if not match: + msg = ('samhain errors found in db. ' + 'Status and output:%s and %s' % (status, output)) + self.assertEqual(status, 0, msg = msg) -- cgit 1.2.3-korg