(self, dolongtest)
| 479 | |
| 480 | # void cTest::runConsistencyTest() { |
| 481 | def runConsistencyTest(self, dolongtest): |
| 482 | global settings, tmpdir, CONFIGDIR, EXPECTDIR |
| 483 | |
| 484 | confdir = os.path.join(self.tdir, CONFIGDIR) |
| 485 | rundir = os.path.join(tmpdir, self.name) |
| 486 | expectdir = os.path.join(self.tdir, EXPECTDIR) |
| 487 | |
| 488 | if not self.isConsistencyTest(): |
| 489 | self.result = "skipped (not a consistency test)" |
| 490 | self.disabled = True |
| 491 | return |
| 492 | |
| 493 | # If no expected results exist and in slave mode |
| 494 | if not self.has_expected and settings["mode"] == "slave": |
| 495 | self.result = "skipped (no expected results)" |
| 496 | self.disabled = True |
| 497 | return |
| 498 | |
| 499 | if settings.has_key("_reset_expected"): |
| 500 | if not self.scm.removeDirectory(expectdir): |
| 501 | print "Error: unable to remove expected directory for reset" |
| 502 | self.success = False |
| 503 | return |
| 504 | self.has_expected = False |
| 505 | |
| 506 | if self.has_expected and self.skip: |
| 507 | self.result = "skipped" |
| 508 | self.disabled = True |
| 509 | return |
| 510 | |
| 511 | if self.getConfig("consistency", "long", "no") in TRUE_STRINGS and not dolongtest: |
| 512 | self.result = "skipped (long)" |
| 513 | self.disabled = True |
| 514 | return |
| 515 | |
| 516 | # Create test directory and populate with config |
| 517 | try: |
| 518 | shutil.copytree(confdir, rundir) |
| 519 | except (IOError, OSError), e: |
| 520 | print "Error: unable to create run dir" |
| 521 | print " -- root cause: %s" % e |
| 522 | self.success = False |
| 523 | return |
| 524 | |
| 525 | self.scm.deleteMetadata(rundir) |
| 526 | |
| 527 | # Run test app, capturing output and exitcode |
| 528 | p = subprocess.Popen("cd %s; %s %s" % (rundir, self.app, self.args), shell=True, |
| 529 | stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True) |
| 530 | |
| 531 | # Process output from app |
| 532 | # Note: must at least swallow app output so that the process output |
| 533 | # buffer does not fill and block execution |
| 534 | if settings.has_key("_verbose"): |
| 535 | |
| 536 | for line in p.stdout: |
| 537 | if settings.has_key("_verbose"): |
| 538 | sys.stdout.write("%s output: %s" % (self.name, line)) |
no test coverage detected