From ee0e0ff6a01f135d14ac93e73eb7e1f5affcfbc1 Mon Sep 17 00:00:00 2001 From: Jason Lowe-Power Date: Thu, 14 Mar 2019 16:36:34 -0700 Subject: [PATCH] tests: Fix race condition in download fixture Change-Id: Idace0e9e71a484080fc581e232ce217b449085c1 Signed-off-by: Jason Lowe-Power Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/17453 Reviewed-by: Andreas Sandberg --- tests/gem5/fixture.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/gem5/fixture.py b/tests/gem5/fixture.py index 9d9319c1e..c4fd12f52 100644 --- a/tests/gem5/fixture.py +++ b/tests/gem5/fixture.py @@ -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): -- 2.30.2