# HG changeset patch # User raptorbot # Date 1263842412 0 # Node ID 0092642f198e874612e23d2a739b0c04a42d3530 # Parent 2648751b64b4dcbe93cbecdc660fcb30f6012f88 Elimitate those testing messups that result from the case of the drive letter in SBS_HOME or EPOCROOT diff -r 2648751b64b4 -r 0092642f198e sbsv2/raptor/test/common/run_tests.py --- a/sbsv2/raptor/test/common/run_tests.py Mon Jan 18 17:09:57 2010 +0000 +++ b/sbsv2/raptor/test/common/run_tests.py Mon Jan 18 19:20:12 2010 +0000 @@ -517,6 +517,18 @@ return keys +# Make SBS_HOME, EPOCROOT have uppercase drive letters to match os.getcwd() and +# thus stop all those insane test problems which result from one being uppercase +# and the other lowercase + +if sys.platform.startswith("win"): + sh = os.environ['SBS_HOME'] + if sh[1] == ':': + os.environ['SBS_HOME'] = sh[0].upper() + sh[1:] + er = os.environ['EPOCROOT'] + if er[1] == ':': + os.environ['EPOCROOT'] = er[0].upper() + er[1:] + # Clean epocroot before running tests raptor_tests.clean_epocroot() run_tests = SuiteRun(suitepattern = options.suite, testpattern = options.tests, diff -r 2648751b64b4 -r 0092642f198e sbsv2/raptor/test/unit_suite/raptor_meta_unit.py --- a/sbsv2/raptor/test/unit_suite/raptor_meta_unit.py Mon Jan 18 17:09:57 2010 +0000 +++ b/sbsv2/raptor/test/unit_suite/raptor_meta_unit.py Mon Jan 18 19:20:12 2010 +0000 @@ -256,18 +256,23 @@ def __testExport(self, aExportObject, aSource, aDestination, aAction): self.assertEquals(aExportObject.getSource(), aSource) - self.assertEqualsOrContains(aExportObject.getDestination(), aDestination) + self.assertEqualsOrContainsPath(aExportObject.getDestination(), aDestination) self.assertEquals(aExportObject.getAction(), aAction) - def assertEqualsOrContains(self, aPathStringOrPathStringList, aPathString): - # If aPathStringOrPathStringList is a list, which it might well be, we should + def assertEqualsOrContainsPath(self, aRequirement, aCandidate): + # If aRequirement is a list, which it might well be, we should # assert that aPathString is contained in it - # If aPathStringOrPathStringList is not a list, it will be a string, and + # If aRequirement not a list, it will be a string, and # we should assert equality of the strings - if isinstance(aPathStringOrPathStringList, list): - self.assert_(aPathString in aPathStringOrPathStringList) + # On windows we shouldn't care about the case of the drive letter. + + if isinstance(aRequirement, list): + pathsequal = False + for r in aRequirement: + pathsequal = path_compare_notdrivelettercase(r,aCandidate) or pathsequal + self.assertTrue(pathsequal) else: - self.assertEquals(aPathStringOrPathStringList, aPathString) + self.assertTrue(path_compare_notdrivelettercase(aRequirement,aCandidate)) def testBldInfExports(self): bldInfTestRoot = self.__testRoot.Append('metadata/project/bld.infs') @@ -646,10 +651,8 @@ m.deffile = self.deffilekeyword m.nostrictdef = self.nostrictdef f = m.resolveDefFile(self.target, self.platform) - del m - if self.resolveddeffile == f: - return True - return False + + return path_compare_notdrivelettercase(self.resolveddeffile,f) defFileTests = [] @@ -734,7 +737,8 @@ ]) for t in defFileTests: - self.assertEquals(t.test(self.raptor), True) + result = t.test(self.raptor) + self.assertEquals(result, True) def dummyMetaReader(self): "make raptor_meta.MetaReader.__init__ into a none operation" @@ -841,6 +845,16 @@ self.assertEquals(moduleName, result["result"]) self.restoreMetaReader() + + +def path_compare_notdrivelettercase(aRequirement, aCandidate): + if sys.platform.startswith("win"): + if aRequirement[1] == ":": + aRequirement = aRequirement[0].lower() + aRequirement[1:] + aCandidate = aCandidate[0].lower() + aCandidate[1:] + + return aRequirement == aCandidate + # run all the tests