Commits

Akeem Wells authored 29c82d8ab71
Update Fetch and Gather functions to include tests from plotms, regression and almatasks

casatestutils/runtest.py

Modified
169 169
170 170 infile.close()
171 171 return List
172 172
173 173 def list_tests():
174 174 print('Full list of unit tests')
175 175 print('-----------------------')
176 176 if IS_CASA6:
177 177 git_fetch_casa_tests(os.getcwd() +"/testlist/casa6")
178 178 gather_all_tests(os.getcwd() +"/testlist/casa6",os.getcwd() +"/testlist/")
179 + gather_all_tests(os.getcwd() +"/testlist/casaplotms/", workdir + "testlist/")
179 180 tests = sorted(os.listdir(os.getcwd() +"/testlist/"))
180 181 for test in tests:
181 182 if test.startswith("test"):
182 183 print(test)
183 184 else:
184 185 for t in readfile(LISTofTESTS):
185 186 print(t)
186 187
187 188 def git_fetch_casa_tests(path):
188 189
189 190 cwd = os.getcwd()
190 191 if os.path.exists(path):
191 192 try:
192 193 os.rmdir(path)
193 194 except:
194 195 shutil.rmtree(path)
195 196 os.makedirs(path)
196 197
197 198 os.chdir(path)
198 - subprocess.call(["git","init", "--quiet"])
199 199 FNULL = open(os.devnull, 'w')
200 +
201 + ## Main
202 + subprocess.call(["git","init", "--quiet"])
200 203 subprocess.call(["git","remote","add","-f","origin", "https://open-bitbucket.nrao.edu/scm/casa/casa6.git"], stdout=FNULL, stderr=subprocess.STDOUT)
201 204 subprocess.call(["git","config","core.sparseCheckout","true"])
202 205
203 206 print("casatasks/tests/tasks", file=open(".git/info/sparse-checkout", "a"))
204 207
205 208 print("casatools/tests/tools/agentflagger", file=open(".git/info/sparse-checkout", "a"))
206 209 print("casatools/tests/tools/calanalysis", file=open(".git/info/sparse-checkout", "a"))
207 210 print("casatools/tests/tools/componentlist", file=open(".git/info/sparse-checkout", "a"))
208 211 print("casatools/tests/tools/coordsys", file=open(".git/info/sparse-checkout", "a"))
209 212 print("casatools/tests/tools/image", file=open(".git/info/sparse-checkout", "a"))
210 213 print("casatools/tests/tools/imagepol", file=open(".git/info/sparse-checkout", "a"))
211 214 print("casatools/tests/tools/measures", file=open(".git/info/sparse-checkout", "a"))
212 215 print("casatools/tests/tools/ms", file=open(".git/info/sparse-checkout", "a"))
213 216 print("casatools/tests/tools/msmetadata", file=open(".git/info/sparse-checkout", "a"))
214 217 print("casatools/tests/tools/regionmanager", file=open(".git/info/sparse-checkout", "a"))
215 218 print("casatools/tests/tools/sdm", file=open(".git/info/sparse-checkout", "a"))
216 219 print("casatools/tests/tools/vpmmanager", file=open(".git/info/sparse-checkout", "a"))
217 220
218 221 print("casatests/benchmarks", file=open(".git/info/sparse-checkout", "a"))
219 - print("casatests/e2e", file=open(".git/info/sparse-checkout", "a"))
222 + print("casatests/regression", file=open(".git/info/sparse-checkout", "a"))
220 223 print("casatests/performance", file=open(".git/info/sparse-checkout", "a"))
221 224 print("casatests/pipeline", file=open(".git/info/sparse-checkout", "a"))
222 225 print("casatests/stakeholders", file=open(".git/info/sparse-checkout", "a"))
223 226
224 227 subprocess.call(["git","pull","--quiet","origin","master"])
228 +
229 + ## Plotms
230 + os.chdir(os.path.dirname(os.getcwd()))
231 + os.makedirs("casaplotms")
232 + os.chdir("casaplotms")
233 + subprocess.call(["git","init", "--quiet"])
234 + subprocess.call(["git","remote","add","-f","origin", "https://open-bitbucket.nrao.edu/scm/casa/casaplotms.git"], stdout=FNULL, stderr=subprocess.STDOUT)
235 + subprocess.call(["git","config","core.sparseCheckout","true"])
236 + print("tests/plotms", file=open(".git/info/sparse-checkout", "a"))
237 + subprocess.call(['git','pull','--quiet','origin','master'])
238 +
239 + ## Almatasks
240 +
241 + os.chdir(os.path.dirname(os.getcwd()))
242 + os.makedirs("almatasks")
243 + os.chdir("almatasks")
244 + subprocess.call(["git","init", "--quiet"])
245 + subprocess.call(["git","remote","add","-f","origin", "https://open-bitbucket.nrao.edu/scm/casa/almatasks.git"], stdout=FNULL, stderr=subprocess.STDOUT)
246 + subprocess.call(["git","config","core.sparseCheckout","true"])
247 + print("tests/tasks", file=open(".git/info/sparse-checkout", "a"))
248 + subprocess.call(['git','pull','--quiet','origin','master'])
249 + os.chdir(os.path.dirname(os.getcwd()))
250 +
251 +
225 252 os.chdir(cwd)
226 253
227 254 def git_fetch_casa_tests_branch(path, branch):
228 255
229 256 cwd = os.getcwd()
230 257 if os.path.exists(path):
231 258 try:
232 259 os.rmdir(path)
233 260 except:
234 261 shutil.rmtree(path)
421 448
422 449 clean_working_directory(workpath)
423 450 # Copy Tests to Working Directory
424 451 os.makedirs(workdir)
425 452
426 453 if RUN_ALL:
427 454 print("Gathering All Tests")
428 455 git_fetch_casa_tests( workpath + 'casa6')
429 456 os.makedirs(workdir + "all/")
430 457 gather_all_tests(workpath +'casa6/', workdir + "all/")
458 + gather_all_tests(workpath +'casaplotms/', workdir + "all/")
459 + gather_all_tests(workpath +'almatasks/', workdir + "all/")
431 460 cmd = [ workdir ]
432 461 cmd = ["--continue-on-collection-errors"] + cmd
433 462 if verbose:
434 463 cmd = ["--verbose"] + cmd
435 464
436 465
437 466 if DRY_RUN:
438 467 cmd = ["--collect-only"] + cmd
439 468
440 469 if not os.path.isdir(workpath + '/xml/all/'):
493 522 print("Setting Working Directory: {}".format(workdir + "{}/".format(test if not test.endswith(".py") else test[:-3])))
494 523 os.makedirs(workdir + "{}/".format(test if not test.endswith(".py") else test[:-3]))
495 524 cmd = [ workdir + "{}/".format(test if not test.endswith(".py") else test[:-3]) ] + cmd
496 525
497 526 # Check to see if tests need to be pulled from git. Only needs to be done once
498 527 if not test.endswith(".py") and gittest == True:
499 528 if JIRA_BRANCH is not None:
500 529 git_fetch_casa_tests_branch(workpath + 'casa6/', JIRA_BRANCH)
501 530 os.makedirs(workdir + "tests/")
502 531 gather_all_tests(workpath +'casa6/', workdir + "tests/")
532 + # gather_all_tests(workpath +'casaplotms/', workdir + "tests/")
533 + # gather_all_tests(workpath +'almatasks/', workdir + "tests/")
503 534 gittest = False
504 535
505 536 else:
506 537 print("Fetching Tests From Git Main Since No Local Test is Given")
507 538 git_fetch_casa_tests( workpath + 'casa6/')
508 539 os.makedirs(workdir + "tests/")
509 540 gather_all_tests(workpath +'casa6/', workdir + "tests/")
541 + gather_all_tests(workpath +'casaplotms/', workdir + "tests/")
542 + gather_all_tests(workpath +'almatasks/', workdir + "tests/")
510 543 gittest = False
511 544
512 545 if test.endswith(".py"):
513 546 try:
514 547 print("Copying: {} to {}".format(test, workdir + "{}/".format(test if not test.endswith(".py") else test[:-3])))
515 548 shutil.copy2(test, workdir + "{}/".format(test if not test.endswith(".py") else test[:-3]))
516 549 except:
517 550 traceback.print_exc()
518 551 else:
519 552 try:

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut