1*19323693SBrad Bishop# Copyright (C) 2019 Armin Kuster <akuster808@gmail.com> 2*19323693SBrad Bishop# 3*19323693SBrad Bishopimport re 4*19323693SBrad Bishop 5*19323693SBrad Bishopfrom oeqa.runtime.case import OERuntimeTestCase 6*19323693SBrad Bishopfrom oeqa.core.decorator.depends import OETestDepends 7*19323693SBrad Bishopfrom oeqa.runtime.decorator.package import OEHasPackage 8*19323693SBrad Bishop 9*19323693SBrad Bishop 10*19323693SBrad Bishopclass ClamavTest(OERuntimeTestCase): 11*19323693SBrad Bishop 12*19323693SBrad Bishop @OEHasPackage(['clamav']) 13*19323693SBrad Bishop @OETestDepends(['ssh.SSHTest.test_ssh']) 14*19323693SBrad Bishop def test_freshclam_help(self): 15*19323693SBrad Bishop status, output = self.target.run('freshclam --help ') 16*19323693SBrad Bishop msg = ('freshclam --hlep command does not work as expected. ', 17*19323693SBrad Bishop 'Status and output:%s and %s' % (status, output)) 18*19323693SBrad Bishop self.assertEqual(status, 0, msg = msg) 19*19323693SBrad Bishop 20*19323693SBrad Bishop @OETestDepends(['clamav.ClamavTest.test_freshclam_help']) 21*19323693SBrad Bishop def test_freshclam_download(self): 22*19323693SBrad Bishop status, output = self.target.run('freshclam --show-progress') 23*19323693SBrad Bishop match = re.search('Database updated', output) 24*19323693SBrad Bishop #match = re.search('main.cvd is up to date', output) 25*19323693SBrad Bishop if not match: 26*19323693SBrad Bishop msg = ('freshclam : DB dowbload failed. ' 27*19323693SBrad Bishop 'Status and output:%s and %s' % (status, output)) 28*19323693SBrad Bishop self.assertEqual(status, 1, msg = msg) 29*19323693SBrad Bishop 30*19323693SBrad Bishop @OETestDepends(['clamav.ClamavTest.test_freshclam_download']) 31*19323693SBrad Bishop def test_freshclam_check_mirrors(self): 32*19323693SBrad Bishop status, output = self.target.run('freshclam --list-mirrors') 33*19323693SBrad Bishop match = re.search('Failures: 0', output) 34*19323693SBrad Bishop if not match: 35*19323693SBrad Bishop msg = ('freshclam --list-mirrors: failed. ' 36*19323693SBrad Bishop 'Status and output:%s and %s' % (status, output)) 37*19323693SBrad Bishop self.assertEqual(status, 1, msg = msg) 38*19323693SBrad Bishop 39