forked from mozilla/areweslimyet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_slimtest.py
executable file
·43 lines (32 loc) · 1.36 KB
/
run_slimtest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright © 2012 Mozilla Corporation
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), "benchtester")))
execfile(os.path.join(os.path.dirname(sys.argv[0]), "slimtest_config.py"))
# Load
import BenchTester
tester = BenchTester.BenchTester()
# Load modules for tests we have
for test in AreWeSlimYetTests.values():
if not tester.load_module(test['type']):
sys.exit(1)
# Parse command line arguments
args = tester.parse_args(sys.argv[1:])
if not args or not tester.setup(args):
sys.exit(1)
# Run tests
for testname, testinfo in AreWeSlimYetTests.items():
if not tester.run_test(testname, testinfo['type'], testinfo['vars']):
sys.stderr.write("SlimTest: Failed at test %s -- Errors: %s -- Warnings: %s\n" % (testname, tester.errors, tester.warnings))
sys.exit(1)
if len(tester.warnings):
sys.stderr.write("SlimTest: Generated %u warnings: %s" % (len(tester.warnings), tester.warnings))
if len(tester.errors):
sys.stderr.write("!! SlimTest: Completed with %u errors: %s" % (len(tester.errors), tester.errors))
sys.exit(1)
sys.stderr.write("SlimTest: Test run successful")