2017-04-03 04:14:38 +03:00
|
|
|
# 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/.
|
|
|
|
|
2018-05-22 16:22:46 +03:00
|
|
|
# ----------------------------------------------------------------------------
|
2017-04-03 04:14:38 +03:00
|
|
|
# This script checks bytecode documentation in js/src/vm/Opcodes.h
|
2018-05-22 16:22:46 +03:00
|
|
|
# ----------------------------------------------------------------------------
|
2017-04-03 04:14:38 +03:00
|
|
|
|
2019-07-08 20:30:34 +03:00
|
|
|
from __future__ import absolute_import
|
2017-04-03 04:14:38 +03:00
|
|
|
from __future__ import print_function
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2018-05-22 01:01:01 +03:00
|
|
|
scriptname = os.path.basename(__file__)
|
2017-04-03 04:14:38 +03:00
|
|
|
topsrcdir = os.path.dirname(os.path.dirname(__file__))
|
|
|
|
|
2018-05-22 01:01:01 +03:00
|
|
|
|
2017-04-03 04:14:38 +03:00
|
|
|
def log_pass(text):
|
|
|
|
print("TEST-PASS | {} | {}".format(scriptname, text))
|
|
|
|
|
2018-05-22 01:01:01 +03:00
|
|
|
|
2017-04-03 04:14:38 +03:00
|
|
|
def log_fail(text):
|
|
|
|
print("TEST-UNEXPECTED-FAIL | {} | {}".format(scriptname, text))
|
|
|
|
|
2018-05-22 01:01:01 +03:00
|
|
|
|
2017-04-03 04:14:38 +03:00
|
|
|
def check_opcode():
|
|
|
|
sys.path.insert(0, os.path.join(topsrcdir, "js", "src", "vm"))
|
2018-11-12 06:55:30 +03:00
|
|
|
import jsopcode
|
2017-04-03 04:14:38 +03:00
|
|
|
|
|
|
|
try:
|
2018-11-12 06:55:30 +03:00
|
|
|
jsopcode.get_opcodes(topsrcdir)
|
2017-04-03 04:14:38 +03:00
|
|
|
except Exception as e:
|
|
|
|
log_fail(e.args[0])
|
2018-11-02 11:26:39 +03:00
|
|
|
return False
|
2017-04-03 04:14:38 +03:00
|
|
|
|
|
|
|
log_pass("ok")
|
|
|
|
return True
|
|
|
|
|
2018-05-22 01:01:01 +03:00
|
|
|
|
2017-04-03 04:14:38 +03:00
|
|
|
def main():
|
|
|
|
if not check_opcode():
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
sys.exit(0)
|
|
|
|
|
2018-05-22 01:01:01 +03:00
|
|
|
|
2017-04-03 04:14:38 +03:00
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|