Skip to content

Commit 0666232

Browse files
authored
Merge pull request #3228 from andrew-platt/b/reg_test_CopyTree
regtest: check if destination dirs exist before copyTree call
2 parents 8acb31d + 2e23291 commit 0666232

9 files changed

+19
-16
lines changed

reg_tests/executeAerodiskRegressionCase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
if not os.path.isdir(inputsDirectory):
8989
rtl.exitWithError("The test data inputs directory, {}, does not exist. Verify your local repository is up to date.".format(inputsDirectory))
9090

91-
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'adsk_driver.outb':'adsk_driver_ref.outb'})
91+
if not os.path.isdir(testBuildDirectory):
92+
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'adsk_driver.outb':'adsk_driver_ref.outb'})
9293

9394
### Run aerodisk on the test case
9495
if not noExec:

reg_tests/executeAerodynPyRegressionCase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090

9191

9292
# create the local output directory and initialize it with input files
93-
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'py_ad_driver.out':'py_ad_driver_ref.out'})
93+
if not os.path.isdir(testBuildDirectory):
94+
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'py_ad_driver.out':'py_ad_driver_ref.out'})
9495
# , excludeExt=['.out','.outb'])
9596

9697
### Run aerodyn on the test case

reg_tests/executeAerodynRegressionCase.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,12 @@
9292
# Special case, copy the BAR Baseline files
9393
dst = os.path.join(buildDirectory, "BAR_Baseline")
9494
src = os.path.join(moduleDirectory, "BAR_Baseline")
95-
try:
95+
if not os.path.isdir(dst):
9696
rtl.copyTree(src, dst)
97-
except:
98-
# This can fail if two processes are copying the file at the same time
99-
print('>>> Copy failed')
100-
import time
101-
time.sleep(1)
10297

10398
# create the local output directory and initialize it with input files
104-
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'ad_driver.outb':'ad_driver_ref.outb'})
99+
if not os.path.isdir(testBuildDirectory):
100+
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'ad_driver.outb':'ad_driver_ref.outb'})
105101
# , excludeExt=['.out','.outb'])
106102

107103
### Run aerodyn on the test case

reg_tests/executeHydrodynPyRegressionCase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090

9191

9292
# create the local output directory and initialize it with input files
93-
rtl.copyTree(inputsDirectory, testBuildDirectory)
93+
if not os.path.isdir(testBuildDirectory):
94+
rtl.copyTree(inputsDirectory, testBuildDirectory)
9495
# , excludeExt=['.out','.outb'])
9596

9697
### Run HydroDyn on the test case

reg_tests/executeMoordynPyRegressionCase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@
9090
rtl.exitWithError("The test data inputs directory, {}, does not exist. Verify your local repository is up to date.".format(inputsDirectory))
9191

9292
# create the local output directory and initialize it with input files
93-
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'MD.out':'MD_ref.out','MDroot.MD.out':'MDroot.MD_ref.out'})
93+
if not os.path.isdir(testBuildDirectory):
94+
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'MD.out':'MD_ref.out','MDroot.MD.out':'MDroot.MD_ref.out'})
9495
# , excludeExt=['.out','.outb'])
9596

9697
### Run MoorDyn on the test case

reg_tests/executeOpenfastLinearRegressionCase.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ def indent(msg, sindent='\t'):
163163
shutil.copy2(srcname, dstname)
164164
#
165165
# Copying the actual test directory
166-
# if not os.path.isdir(testBuildDirectory):
167-
rtl.copyTree(inputsDirectory, testBuildDirectory, excludeExt=excludeExt, renameExtDict={'.lin':'.ref_lin'})
166+
if not os.path.isdir(testBuildDirectory):
167+
rtl.copyTree(inputsDirectory, testBuildDirectory, excludeExt=excludeExt, renameExtDict={'.lin':'.ref_lin'})
168168

169169
### Run openfast on the test case
170170
if not noExec:

reg_tests/executeSimpleElastodynRegressionCase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@
8888
if not os.path.isdir(inputsDirectory):
8989
rtl.exitWithError("The test data inputs directory, {}, does not exist. Verify your local repository is up to date.".format(inputsDirectory))
9090

91-
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'sed_driver.outb':'sed_driver_ref.outb'})
91+
if not os.path.isdir(testBuildDirectory):
92+
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict={'sed_driver.outb':'sed_driver_ref.outb'})
9293

9394
### Run SED on the test case
9495
if not noExec:

reg_tests/executeSubdynRegressionCase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@
8989
rtl.exitWithError("The test data inputs directory, {}, does not exist. Verify your local repository is up to date.".format(inputsDirectory))
9090

9191
# create the local output directory and initialize it with input files (overwrite if exists)
92-
rtl.copyTree(inputsDirectory, testBuildDirectory, renameExtDict={'.out':'_ref.out'}, includeExt=['.dvr','.dat','.out','.csv'])
92+
if not os.path.isdir(testBuildDirectory):
93+
rtl.copyTree(inputsDirectory, testBuildDirectory, renameExtDict={'.out':'_ref.out'}, includeExt=['.dvr','.dat','.out','.csv'])
9394

9495

9596
### Run SubDyn on the test case

reg_tests/executeUnsteadyAeroRegressionCase.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@
9292
# create the local output directory and initialize it with input files
9393
renameDict={'UA'+str(i)+'.outb':'UA'+str(i)+'_ref.outb' for i in [2,3,4,5,6,7]}
9494

95-
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict=renameDict
95+
if not os.path.isdir(testBuildDirectory):
96+
rtl.copyTree(inputsDirectory, testBuildDirectory, renameDict=renameDict
9697
, excludeExt=['.sum'])
9798
# , excludeExt=['.out','.outb','.sum'])
9899

0 commit comments

Comments
 (0)