summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorMariano Lopez <mariano.lopez@linux.intel.com>2017-02-22 13:12:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-02-23 12:49:52 -0800
commit01be63828c2d88ca10524716b357a73023743443 (patch)
treef53c1f1e87e8fc0bfc612dee7f61efd76c239b53 /meta/lib
parent134db01e7b76803d11c930201cd080337c7c4f6e (diff)
downloadpoky-01be63828c2d88ca10524716b357a73023743443.tar.gz
selftest/eSDK.py: Cleanup when there is an error in setUpClass
Lately autobuilders are experiencing hangs with selftest, it seems it is cause if an error happens in setUpClass method of oeSDKExtSelfTest class because HTTP server keeps running in background. This patch will ensure tearDownClass will be run if there is an error in setUpClass. (From OE-Core rev: eb1383949f76c6eb36f86c051057f761a71016a3) Signed-off-by: Mariano Lopez <mariano.lopez@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oeqa/selftest/eSDK.py46
1 files changed, 25 insertions, 21 deletions
diff --git a/meta/lib/oeqa/selftest/eSDK.py b/meta/lib/oeqa/selftest/eSDK.py
index ee1ca6a4ec..b68e997ba9 100644
--- a/meta/lib/oeqa/selftest/eSDK.py
+++ b/meta/lib/oeqa/selftest/eSDK.py
@@ -64,7 +64,7 @@ class oeSDKExtSelfTest(oeSelfTest):
64 runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA)) 64 runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA))
65 65
66 cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) 66 cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA)
67 67
68 sstate_config=""" 68 sstate_config="""
69SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" 69SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS"
70SSTATE_MIRRORS = "file://.* http://%s/PATH" 70SSTATE_MIRRORS = "file://.* http://%s/PATH"
@@ -73,37 +73,41 @@ CORE_IMAGE_EXTRA_INSTALL = "perl"
73 73
74 with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: 74 with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f:
75 f.write(sstate_config) 75 f.write(sstate_config)
76
77 76
78 @classmethod 77 @classmethod
79 def setUpClass(cls): 78 def setUpClass(cls):
80 # Start to serve sstate dir 79 # If there is an exception in setUpClass it will not run tearDownClass
81 sstate_dir = get_bb_var('SSTATE_DIR') 80 # method and it leaves HTTP server running forever, so we need to be
82 cls.http_service = HTTPService(sstate_dir) 81 # sure tearDownClass is run.
83 cls.http_service.start() 82 try:
83 cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA')
84 84
85 cls.http_url = "http://127.0.0.1:%d" % cls.http_service.port 85 # Start to serve sstate dir
86 86 sstate_dir = get_bb_var('SSTATE_DIR')
87 cls.image = 'core-image-minimal' 87 cls.http_service = HTTPService(sstate_dir)
88 cls.http_url = "http://127.0.0.1:%d" % cls.http_service.port
89 cls.http_service.start()
88 90
89 cls.tmpdir_eSDKQA = tempfile.mkdtemp(prefix='eSDKQA') 91 cls.image = 'core-image-minimal'
90 oeSDKExtSelfTest.generate_eSDK(cls.image) 92 oeSDKExtSelfTest.generate_eSDK(cls.image)
91 93
92 # Install eSDK 94 # Install eSDK
93 cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image) 95 cls.ext_sdk_path = oeSDKExtSelfTest.get_eSDK_toolchain(cls.image)
94 runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA)) 96 runCmd("%s -y -d \"%s\"" % (cls.ext_sdk_path, cls.tmpdir_eSDKQA))
95 97
96 cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA) 98 cls.env_eSDK = oeSDKExtSelfTest.get_esdk_environment('', cls.tmpdir_eSDKQA)
97 99
98 # Configure eSDK to use sstate mirror from poky 100 # Configure eSDK to use sstate mirror from poky
99 sstate_config=""" 101 sstate_config="""
100SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS" 102SDK_LOCAL_CONF_WHITELIST = "SSTATE_MIRRORS"
101SSTATE_MIRRORS = "file://.* http://%s/PATH" 103SSTATE_MIRRORS = "file://.* http://%s/PATH"
102 """ % cls.http_url 104 """ % cls.http_url
103 with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f: 105 with open(os.path.join(cls.tmpdir_eSDKQA, 'conf', 'local.conf'), 'a+') as f:
104 f.write(sstate_config) 106 f.write(sstate_config)
107 except:
108 cls.tearDownClass()
109 raise
105 110
106
107 @classmethod 111 @classmethod
108 def tearDownClass(cls): 112 def tearDownClass(cls):
109 shutil.rmtree(cls.tmpdir_eSDKQA) 113 shutil.rmtree(cls.tmpdir_eSDKQA)