config/check_js_opcode.py
author Mozilla Releng Treescript <release+treescript@mozilla.org>
Mon, 24 Sep 2018 23:25:50 +0000
changeset 492667 2231ea6517eb7e2b8fd1f47162ffc9ce5d03340e
parent 476323 da3c81f986fa63b42a2874b1791eddcdbfbe8424
child 503288 19a802e5b33298741d6efcc2e8374ae48f1e8b28
permissions -rw-r--r--
No bug - Tagging 946cccc1bb45ab0f7c271b550ed5dc43cbf392f9 with FIREFOX_63_0b9_BUILD1 a=release CLOSED TREE DONTBUILD

# vim: set ts=8 sts=4 et sw=4 tw=99:
# 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/.

# ----------------------------------------------------------------------------
# This script checks bytecode documentation in js/src/vm/Opcodes.h
# ----------------------------------------------------------------------------

from __future__ import print_function

import os
import sys

scriptname = os.path.basename(__file__)
topsrcdir = os.path.dirname(os.path.dirname(__file__))


def log_pass(text):
    print('TEST-PASS | {} | {}'.format(scriptname, text))


def log_fail(text):
    print('TEST-UNEXPECTED-FAIL | {} | {}'.format(scriptname, text))


def check_opcode():
    sys.path.insert(0, os.path.join(topsrcdir, 'js', 'src', 'vm'))
    import opcode

    try:
        opcode.get_opcodes(topsrcdir)
    except Exception as e:
        log_fail(e.args[0])

    log_pass('ok')
    return True


def main():
    if not check_opcode():
        sys.exit(1)

    sys.exit(0)


if __name__ == '__main__':
    main()