tests: Fix race condition in download fixture

Change-Id: Idace0e9e71a484080fc581e232ce217b449085c1
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17453
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
This commit is contained in:
Jason Lowe-Power
2019-03-14 16:36:34 -07:00
parent 76d9c83887
commit ee0e0ff6a0

View File

@@ -229,9 +229,14 @@ class DownloadedProgram(Fixture):
self.url = self.urlbase + self.path
def _download(self):
import urllib
import errno
log.test_log.debug("Downloading " + self.url + " to " + self.path)
if not os.path.exists(self.program_dir):
os.makedirs(self.program_dir)
try:
os.makedirs(self.program_dir)
except OSError as e:
if e.errno != errno.EEXIST:
raise
urllib.urlretrieve(self.url, self.path)
def _getremotetime(self):