From 6f8a96c28135dbcfaef7a48ab25618c7836cbf96 Mon Sep 17 00:00:00 2001 From: Laurent Demailly Date: Mon, 5 Oct 2015 21:34:59 -0700 Subject: [PATCH] improving cont build so it emails when rm fails and using wdt-builds@ instead of hardcoding our name, fixing mkdir race condition in tests Summary: improving cont build so it emails when rm fails and using wdt-builds@ instead of hardcoding our name, fixing mkdir race condition in tests Reviewed By: @nikunjy Differential Revision: D2511598 fb-gh-sync-id: cdaa58229a59e150d743e52d5fb76ef42111a0b0 --- common_utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/common_utils.py b/common_utils.py index 453d57c0..ea7b26ae 100644 --- a/common_utils.py +++ b/common_utils.py @@ -9,6 +9,7 @@ from random import randint import shutil import tempfile +import errno def start_receiver(receiver_cmd, root_dir, test_count): print("Receiver: " + receiver_cmd) @@ -36,8 +37,13 @@ def check_transfer_status(status, root_dir, test_count): exit(status) def create_directory(root_dir): - if not os.path.exists(root_dir): - os.makedirs(root_dir) + # race condition during stress test can happen even if we check first + try: + os.mkdir(root_dir) + except OSError as e: + if e.errno != errno.EEXIST: + raise e + pass def create_test_directory(prefix): user = os.environ['USER']