summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa
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-09-11 17:15:55 +0100
commitce4016c070ffc81267b0d071bbc738fb688fb902 (patch)
treebea7ce454335bd192a49c82cb70a81c807267659 /meta/lib/oeqa
parent4ff1c8ddbadfbcaef969fb97fb4caab92d4fa519 (diff)
downloadpoky-ce4016c070ffc81267b0d071bbc738fb688fb902.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) (From OE-Core rev: 5dc68a378d9f4ec2c313ac395e91225a02e5b2c7) 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/oeqa')
-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 c95ca6deb2..4c58d2b410 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)