diff --git a/testing/tests/l10n/lib/Mozilla/Tests.py b/testing/tests/l10n/lib/Mozilla/Tests.py index ff8f0be2abc5..fb8cade1a35d 100755 --- a/testing/tests/l10n/lib/Mozilla/Tests.py +++ b/testing/tests/l10n/lib/Mozilla/Tests.py @@ -312,3 +312,47 @@ class SearchTest(Base): failureResult[loc] = 2 else: failureResult[loc] |= 2 + +class RSSReaderTest(Base): + """Test class to collect information about RSS readers and to + verify that they might be working. + + """ + def __init__(self): + '''Set up the test class with a good leaf name''' + self.leafName = 'feed-reader-results.json' + pass + def run(self): + '''Collect the data from browsers region.properties for all locales + + ''' + locales = [loc.strip() for loc in open('mozilla/browser/locales/all-locales')] + uri = re.compile('browser\\.contentHandlers\\.types\\.([0-5])\\.uri') + title = re.compile('browser\\.contentHandlers\\.types\\.([0-5])\\.title') + res = {} + for loc in locales: + l = logging.getLogger('locales.' + loc) + regprop = Paths.get_path('browser', loc, 'chrome/browser-region/region.properties') + p = Parser.getParser(regprop) + p.read(regprop) + uris = {} + titles = {} + for key, val in p: + m = uri.match(key) + if m: + o = int(m.group(1)) + if uris.has_key(o): + l.error('Double definition of RSS reader ' + o) + uris[o] = val.strip() + else: + m = title.match(key) + if m: + o = int(m.group(1)) + if titles.has_key(o): + l.error('Double definition of RSS reader ' + o) + titles[o] = val.strip() + ind = sorted(uris.keys()) + if ind != range(len(ind)) or ind != sorted(titles.keys()): + l.error('RSS Readers are badly set up') + res[loc] = [(titles[o], uris[o]) for o in ind] + return res diff --git a/testing/tests/l10n/scripts/test-locales b/testing/tests/l10n/scripts/test-locales index d5bd8685f31b..efb2960fdba9 100755 --- a/testing/tests/l10n/scripts/test-locales +++ b/testing/tests/l10n/scripts/test-locales @@ -186,7 +186,7 @@ if not os.path.isdir(basePath): os.mkdir(basePath) -tests = [Tests.CompareTest(),Tests.SearchTest()] +tests = [Tests.CompareTest(), Tests.SearchTest(), Tests.RSSReaderTest()] drop = {} for test in tests: res = test.run() @@ -221,14 +221,17 @@ if len(water) > rotateLen * 1.5: suffix = '' if opts.gzip: suffix = '.gz' - fnames = [os.path.join(basePath, 'buildlog-%x.json'%i) + suffix for i in range(16)] + fnames = [os.path.join(opts.target, 'waterfall-%x.json'%i) + suffix for i in range(16)] # remove oldest log - if os.path.isfile(flames[15]): + if os.path.isfile(fnames[15]): os.remove(fnames[15]) for l in range(14, -1, -1): if os.path.isfile(fnames[l]): os.rename(fnames[l], fnames[l+1]) - saveJSON(water[:rotateLen], fnames[0]) + w0 = Wrapper('.', fnames[0]) + w0.open('w') + simplejson.dump(water[:rotateLen], w0, sort_keys=True) + w0.close() water = water[rotateLen:] w.open('w')