From 7e1c37ae2ca5bd39d7ee18a7fac048182da66db3 Mon Sep 17 00:00:00 2001 From: "axel%pike.org" Date: Sat, 2 Sep 2006 15:43:53 +0000 Subject: [PATCH] bug 348731, fix waterfall log rotation, add RSS reader test --- testing/tests/l10n/lib/Mozilla/Tests.py | 44 +++++++++++++++++++++++++ testing/tests/l10n/scripts/test-locales | 11 ++++--- 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/testing/tests/l10n/lib/Mozilla/Tests.py b/testing/tests/l10n/lib/Mozilla/Tests.py index ff8f0be2abc..fb8cade1a35 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 d5bd8685f31..efb2960fdba 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')