aboutsummaryrefslogtreecommitdiffstats
path: root/tests/wpt/update.py
blob: 2091b1fed66be2dd6bed91694f47300cae5f2b8f (plain) (blame)
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
44
# 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 https://mozilla.org/MPL/2.0/.

import os
import sys
from wptrunner import wptcommandline

here = os.path.split(__file__)[0]


def wpt_path(*args):
    return os.path.join(here, *args)

# Imports
from update import updatecommandline


def update_tests(**kwargs):
    import update

    set_defaults(kwargs)
    logger = update.setup_logging(kwargs, {"mach": sys.stdout})

    rv = update.run_update(logger, **kwargs)
    return 1 if rv is update.exit_unclean else 0


def set_defaults(kwargs):
    if kwargs["product"] is None:
        kwargs["product"] = "servo"
    if kwargs["config"] is None:
        kwargs["config"] = wpt_path('config.ini')
    kwargs["store_state"] = False
    updatecommandline.check_args(kwargs)


def main():
    parser = wptcommandline.create_parser()
    kwargs = vars(parser.parse_args())
    return update_tests(**kwargs)

if __name__ == "__main__":
    sys.exit(0 if main() else 1)