oeqa.runtime.smart: work around smart race issues

Yucku hack around test failures which ultimately are caused by a race in
smartpm itself. Issuing smartpm commands in quick succession causes
races in package cache of smartpm on some systems. This patch mitigates
the problem by sleeping for 1 second after each smartpm command that
modifies the system.

[YOCTO #10244]

(From OE-Core rev: 4d268abc2fc892c5d34449f78c8e9f2b1a9d6bac)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Markus Lehtonen
2016-09-09 11:27:11 +03:00
committed by Richard Purdie
parent d3991342ed
commit 68e35c8e37

View File

@@ -2,6 +2,7 @@ import unittest
import re import re
import oe import oe
import subprocess import subprocess
from time import sleep
from oeqa.oetest import oeRuntimeTest, skipModule from oeqa.oetest import oeRuntimeTest, skipModule
from oeqa.utils.decorators import * from oeqa.utils.decorators import *
from oeqa.utils.httpserver import HTTPService from oeqa.utils.httpserver import HTTPService
@@ -144,13 +145,21 @@ class SmartRepoTest(SmartTest):
@skipUnlessPassed('test_smart_channel_add') @skipUnlessPassed('test_smart_channel_add')
def test_smart_install(self): def test_smart_install(self):
self.smart('remove -y psplash-default') self.smart('remove -y psplash-default')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
self.smart('install -y psplash-default') self.smart('install -y psplash-default')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
@testcase(728) @testcase(728)
@skipUnlessPassed('test_smart_install') @skipUnlessPassed('test_smart_install')
def test_smart_install_dependency(self): def test_smart_install_dependency(self):
self.smart('remove -y psplash') self.smart('remove -y psplash')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
self.smart('install -y psplash-default') self.smart('install -y psplash-default')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
@testcase(723) @testcase(723)
@skipUnlessPassed('test_smart_channel_add') @skipUnlessPassed('test_smart_channel_add')
@@ -158,6 +167,8 @@ class SmartRepoTest(SmartTest):
self.smart('remove -y psplash-default') self.smart('remove -y psplash-default')
self.smart('download psplash-default') self.smart('download psplash-default')
self.smart('install -y ./psplash-default*') self.smart('install -y ./psplash-default*')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
@testcase(725) @testcase(725)
@skipUnlessPassed('test_smart_channel_add') @skipUnlessPassed('test_smart_channel_add')
@@ -166,19 +177,29 @@ class SmartRepoTest(SmartTest):
url = re.search('(http://.*/psplash-default.*\.rpm)', output) url = re.search('(http://.*/psplash-default.*\.rpm)', output)
self.assertTrue(url, msg="Couln't find download url in %s" % output) self.assertTrue(url, msg="Couln't find download url in %s" % output)
self.smart('remove -y psplash-default') self.smart('remove -y psplash-default')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
self.smart('install -y %s' % url.group(0)) self.smart('install -y %s' % url.group(0))
# NOTE: this sleep is a hack for working around #10244
sleep(1)
@testcase(729) @testcase(729)
@skipUnlessPassed('test_smart_install') @skipUnlessPassed('test_smart_install')
def test_smart_reinstall(self): def test_smart_reinstall(self):
self.smart('reinstall -y psplash-default') self.smart('reinstall -y psplash-default')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
@testcase(727) @testcase(727)
@skipUnlessPassed('test_smart_channel_add') @skipUnlessPassed('test_smart_channel_add')
def test_smart_remote_repo(self): def test_smart_remote_repo(self):
self.smart('update') self.smart('update')
self.smart('install -y psplash') self.smart('install -y psplash')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
self.smart('remove -y psplash') self.smart('remove -y psplash')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
@testcase(726) @testcase(726)
def test_smart_local_dir(self): def test_smart_local_dir(self):
@@ -192,6 +213,8 @@ class SmartRepoTest(SmartTest):
self.smart('channel --disable '+str(i)) self.smart('channel --disable '+str(i))
self.target.run('cd $HOME') self.target.run('cd $HOME')
self.smart('install psplash') self.smart('install psplash')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
for i in output.split("\n"): for i in output.split("\n"):
if ("rpmsys" != str(i)) and ("myrpmdir" != str(i)): if ("rpmsys" != str(i)) and ("myrpmdir" != str(i)):
self.smart('channel --enable '+str(i)) self.smart('channel --enable '+str(i))
@@ -215,4 +238,6 @@ class SmartRepoTest(SmartTest):
@skipUnlessPassed('test_smart_channel_add') @skipUnlessPassed('test_smart_channel_add')
def test_smart_remove_package(self): def test_smart_remove_package(self):
self.smart('install -y psplash') self.smart('install -y psplash')
# NOTE: this sleep is a hack for working around #10244
sleep(1)
self.smart('remove -y psplash') self.smart('remove -y psplash')