diff options
| author | Armin Kuster <akuster808@gmail.com> | 2019-03-30 13:22:40 -0700 |
|---|---|---|
| committer | Armin Kuster <akuster808@gmail.com> | 2019-03-31 10:37:09 -0700 |
| commit | 00f00d28971355a1a5ce9d38b617adfd991104bd (patch) | |
| tree | 8d2b796bd65a887d1a49fec6f1d2bbac18d528af | |
| parent | 6d3aa03272b9472bd8e48baf4f45b78c09715f38 (diff) | |
| download | meta-security-00f00d28971355a1a5ce9d38b617adfd991104bd.tar.gz | |
clamav: add basic runtime tests
Signed-off-by: Armin Kuster <akuster808@gmail.com>
| -rw-r--r-- | lib/oeqa/runtime/cases/clamav.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/oeqa/runtime/cases/clamav.py b/lib/oeqa/runtime/cases/clamav.py new file mode 100644 index 0000000..fc77330 --- /dev/null +++ b/lib/oeqa/runtime/cases/clamav.py | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | # Copyright (C) 2019 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 | |||
| 10 | class ClamavTest(OERuntimeTestCase): | ||
| 11 | |||
| 12 | @OEHasPackage(['clamav']) | ||
| 13 | @OETestDepends(['ssh.SSHTest.test_ssh']) | ||
| 14 | def test_freshclam_help(self): | ||
| 15 | status, output = self.target.run('freshclam --help ') | ||
| 16 | msg = ('freshclam --hlep command does not work as expected. ', | ||
| 17 | 'Status and output:%s and %s' % (status, output)) | ||
| 18 | self.assertEqual(status, 0, msg = msg) | ||
| 19 | |||
| 20 | @OETestDepends(['clamav.ClamavTest.test_freshclam_help']) | ||
| 21 | def test_freshclam_download(self): | ||
| 22 | status, output = self.target.run('freshclam --show-progress') | ||
| 23 | match = re.search('Database updated', output) | ||
| 24 | #match = re.search('main.cvd is up to date', output) | ||
| 25 | if not match: | ||
| 26 | msg = ('freshclam : DB dowbload failed. ' | ||
| 27 | 'Status and output:%s and %s' % (status, output)) | ||
| 28 | self.assertEqual(status, 1, msg = msg) | ||
| 29 | |||
| 30 | @OETestDepends(['clamav.ClamavTest.test_freshclam_download']) | ||
| 31 | def test_freshclam_check_mirrors(self): | ||
| 32 | status, output = self.target.run('freshclam --list-mirrors') | ||
| 33 | match = re.search('Failures: 0', output) | ||
| 34 | if not match: | ||
| 35 | msg = ('freshclam --list-mirrors: failed. ' | ||
| 36 | 'Status and output:%s and %s' % (status, output)) | ||
| 37 | self.assertEqual(status, 1, msg = msg) | ||
| 38 | |||
