Example #1
0
def main():
    args = parse_test_args()

    deno_dir = os.path.join(args.build_dir, ".deno_test")
    if os.path.isdir(deno_dir):
        rmtree(deno_dir)
    os.environ["DENO_DIR"] = deno_dir

    enable_ansi_colors()

    test_cases = [
        TestSetup,
        TestUtil,
        TestTarget,
        JsUnitTests,
        TestFetch,
        TestRepl,
        TestDenoDir,
        TestBenchmark,
        TestIsTty,
    ]
    test_cases += permission_prompt_tests()
    test_cases += complex_permissions_tests()
    # It is very slow, so do TestFmt at the end.
    test_cases += [TestFmt]

    with http_server.spawn():
        run_tests(test_cases)
Example #2
0
def main():
    enable_ansi_colors()
    os.chdir(root_path)

    parser = argparse.ArgumentParser()
    parser.add_argument("--js", help="run eslint", action="store_true")
    parser.add_argument("--py", help="run pylint", action="store_true")
    parser.add_argument("--rs", help="run clippy", action="store_true")
    args = parser.parse_args()

    did_fmt = False
    if args.js:
        eslint()
        did_fmt = True
    if args.py:
        pylint()
        did_fmt = True
    if args.rs:
        clippy()
        did_fmt = True

    if not did_fmt:
        eslint()
        pylint()
        clippy()
Example #3
0
def main(argv):
    if len(argv) == 2:
        build_dir = sys.argv[1]
    elif len(argv) == 1:
        build_dir = build_path()
    else:
        print "Usage: tools/test.py [build_dir]"
        sys.exit(1)

    enable_ansi_colors()

    http_server.spawn()

    deno_exe = os.path.join(build_dir, "deno" + executable_suffix)
    check_exists(deno_exe)
    deno_ns_exe = os.path.join(build_dir, "deno_ns" + executable_suffix)
    check_exists(deno_ns_exe)

    # Internal tools testing
    setup_test()
    util_test()
    benchmark_test(build_dir, deno_exe)

    test_cc = os.path.join(build_dir, "test_cc" + executable_suffix)
    check_exists(test_cc)
    run([test_cc])

    test_rs = os.path.join(build_dir, "test_rs" + executable_suffix)
    check_exists(test_rs)
    run([test_rs])

    unit_tests(deno_exe)

    check_output_test(deno_exe)
    check_output_test(deno_ns_exe)
Example #4
0
def main(argv):
    if len(argv) == 2:
        build_dir = sys.argv[1]
    elif len(argv) == 1:
        build_dir = build_path()
    else:
        print "Usage: tools/test.py [build_dir]"
        sys.exit(1)

    deno_dir = os.path.join(build_dir, ".deno_test")
    if os.path.isdir(deno_dir):
        rmtree(deno_dir)
    os.environ["DENO_DIR"] = deno_dir

    enable_ansi_colors()

    http_server.spawn()

    deno_exe = os.path.join(build_dir, "deno" + executable_suffix)
    check_exists(deno_exe)

    # Internal tools testing
    setup_test()
    util_test()
    benchmark_test(build_dir, deno_exe)

    test_cc = os.path.join(build_dir, "test_cc" + executable_suffix)
    check_exists(test_cc)
    run([test_cc])

    test_rs = os.path.join(build_dir, "test_rs" + executable_suffix)
    check_exists(test_rs)
    run([test_rs])

    unit_tests(deno_exe)

    prefetch_test(deno_exe)
    fmt_test(deno_exe)

    integration_tests(deno_exe)

    # TODO We currently skip testing the prompt and IsTTY in Windows completely.
    # Windows does not support the pty module used for testing the permission
    # prompt.
    if os.name != 'nt':
        from permission_prompt_test import permission_prompt_test
        from is_tty_test import is_tty_test
        permission_prompt_test(deno_exe)
        is_tty_test(deno_exe)

    repl_tests(deno_exe)

    rmtree(deno_dir)

    deno_dir_test(deno_exe, deno_dir)

    test_no_color(deno_exe)
Example #5
0
def main(argv):
    enable_ansi_colors()

    ninja_args = argv[1:]
    if not "-C" in ninja_args:
        if not os.path.isdir(build_path()):
            print("Build directory '%s' does not exist." % build_path(),
                  "Run tools/setup.py")
            sys.exit(1)
        ninja_args = ["-C", build_path()] + ninja_args

    run([third_party.ninja_path] + ninja_args,
        env=third_party.google_env(),
        quiet=True)
Example #6
0
File: build.py Project: F001/deno
def main(argv):
    enable_ansi_colors()

    third_party.fix_symlinks()

    ninja_args = argv[1:]
    if not "-C" in ninja_args:
        if not os.path.isdir(build_path()):
            print("Build directory '%s' does not exist." % build_path(),
                  "Run tools/setup.py")
            sys.exit(1)
        ninja_args = ["-C", build_path()] + ninja_args

    run([third_party.ninja_path] + ninja_args,
        env=third_party.google_env(),
        quiet=True)
Example #7
0
def main():
    enable_ansi_colors()

    os.chdir(root_path)

    third_party.download_gn()
    third_party.download_clang_format()
    third_party.download_clang()
    third_party.maybe_download_sysroot()
    write_lastchange()

    mode = build_mode(default=None)
    if mode is not None:
        gn_gen(mode)
    else:
        gn_gen("release")
        gn_gen("debug")
Example #8
0
File: setup.py Project: F001/deno
def main():
    enable_ansi_colors()

    os.chdir(root_path)

    third_party.fix_symlinks()
    third_party.download_gn()
    third_party.download_clang_format()
    third_party.download_clang()
    third_party.maybe_download_sysroot()
    write_lastchange()

    mode = build_mode(default=None)
    if mode is not None:
        gn_gen(mode)
    else:
        gn_gen("release")
        gn_gen("debug")
Example #9
0
def main(argv):
    enable_ansi_colors()

    args, rest_argv = parser.parse_known_args(argv)

    if "DENO_BUILD_MODE" not in os.environ:
        if args.release:
            os.environ["DENO_BUILD_MODE"] = "release"

    ninja_args = rest_argv[1:]
    if not "-C" in ninja_args:
        if not os.path.isdir(build_path()):
            print("Build directory '%s' does not exist." % build_path(),
                  "Run tools/setup.py")
            sys.exit(1)
        ninja_args = ["-C", build_path()] + ninja_args

    run([third_party.ninja_path] + ninja_args,
        env=third_party.google_env(),
        quiet=True)
Example #10
0
def main():
    enable_ansi_colors()
    os.chdir(root_path)

    args = get_cmd_args()

    did_fmt = False
    if args.js:
        eslint()
        did_fmt = True
    if args.py:
        pylint()
        did_fmt = True
    if args.rs:
        clippy()
        did_fmt = True

    if not did_fmt:
        eslint()
        pylint()
        clippy()
Example #11
0
def main(argv):
    args = test_args(argv)

    deno_dir = os.path.join(args.build_dir, ".deno_test")
    if os.path.isdir(deno_dir):
        rmtree(deno_dir)
    os.environ["DENO_DIR"] = deno_dir

    enable_ansi_colors()

    with spawn():
        test_cases = [
            TestSetup,
            TestUtil,
            TestTarget,
            JsUnitTests,
            FetchTest,
            FmtTest,
            TestIntegrations,
            TestRepl,
            TestDenoDir,
            TestBenchmark,
        ]
        # These tests are skipped, but to make the test output less noisy
        # we'll avoid triggering them.
        if os.name != 'nt':
            test_cases.append(TestIsTty)
            test_cases += permission_prompt_tests()
            test_cases += complex_permissions_tests()

        suite = unittest.TestSuite([
            unittest.TestLoader().loadTestsFromTestCase(tc)
            for tc in test_cases
        ])

        result = ColorTextTestRunner(
            verbosity=args.verbosity + 1, failfast=args.failfast).run(suite)
        if not result.wasSuccessful():
            sys.exit(1)
Example #12
0
def main():
    enable_ansi_colors()
    os.chdir(root_path)

    args = parser.parse_args()

    if args.no_binary_download:
        print "no binary download"
    else:
        print "binary download"
        third_party.download_gn()
        third_party.download_clang_format()
        third_party.download_clang()
        third_party.maybe_download_sysroot()

    write_lastchange()

    mode = build_mode(default=None)
    if mode is not None:
        gn_gen(mode)
    else:
        gn_gen("release")
        gn_gen("debug")
Example #13
0
#!/usr/bin/env python
# Copyright 2018 the Deno authors. All rights reserved. MIT license.
# Run this script if you are changing Deno's dependencies.
# To update the deno_third_party git repo after running this, try the following:
# cd third_party
# find . -type f | grep -v "\.git" | xargs -I% git add -f --no-warn-embedded-repo "%"

import third_party
import util

util.enable_ansi_colors()

third_party.fix_symlinks()

third_party.run_yarn()
third_party.run_cargo()
third_party.run_gclient_sync()
Example #14
0
def main(argv):
    if len(argv) == 2:
        build_dir = sys.argv[1]
    elif len(argv) == 1:
        build_dir = build_path()
    else:
        print "Usage: tools/test.py [build_dir]"
        sys.exit(1)

    deno_dir = os.path.join(build_dir, ".deno_test")
    if os.path.isdir(deno_dir):
        rmtree(deno_dir)
    os.environ["DENO_DIR"] = deno_dir

    enable_ansi_colors()

    http_server.spawn()

    deno_exe = os.path.join(build_dir, "deno" + executable_suffix)
    check_exists(deno_exe)

    # Python/build tools testing
    setup_test()
    util_test()
    run([
        "node", "./node_modules/.bin/ts-node", "--project",
        "tools/ts_library_builder/tsconfig.json",
        "tools/ts_library_builder/test.ts"
    ])

    libdeno_test = os.path.join(build_dir, "libdeno_test" + executable_suffix)
    check_exists(libdeno_test)
    run([libdeno_test])

    cli_test = os.path.join(build_dir, "cli_test" + executable_suffix)
    check_exists(cli_test)
    run([cli_test])

    deno_core_test = os.path.join(build_dir,
                                  "deno_core_test" + executable_suffix)
    check_exists(deno_core_test)
    run([deno_core_test])

    deno_core_http_bench_test = os.path.join(
        build_dir, "deno_core_http_bench_test" + executable_suffix)
    check_exists(deno_core_http_bench_test)
    run([deno_core_http_bench_test])

    unit_tests(deno_exe)

    fetch_test(deno_exe)
    fmt_test(deno_exe)

    integration_tests(deno_exe)

    # TODO We currently skip testing the prompt and IsTTY in Windows completely.
    # Windows does not support the pty module used for testing the permission
    # prompt.
    if os.name != 'nt':
        from is_tty_test import is_tty_test
        from permission_prompt_test import permission_prompt_test
        permission_prompt_test(deno_exe)
        is_tty_test(deno_exe)

    repl_tests(deno_exe)

    rmtree(deno_dir)

    deno_dir_test(deno_exe, deno_dir)

    test_no_color(deno_exe)

    benchmark_test(build_dir, deno_exe)
    exec_path_test(deno_exe)
Example #15
0
File: test.py Project: F001/deno
def main(argv):
    if len(argv) == 2:
        build_dir = sys.argv[1]
    elif len(argv) == 1:
        build_dir = build_path()
    else:
        print "Usage: tools/test.py [build_dir]"
        sys.exit(1)

    deno_dir = os.path.join(build_dir, ".deno_test")
    if os.path.isdir(deno_dir):
        rmtree(deno_dir)
    os.environ["DENO_DIR"] = deno_dir

    enable_ansi_colors()

    http_server.spawn()

    deno_exe = os.path.join(build_dir, "deno" + executable_suffix)
    check_exists(deno_exe)

    exec_path_test(deno_exe)

    # Internal tools testing
    run([
        "node", "./node_modules/.bin/ts-node", "--project",
        "tools/ts_library_builder/tsconfig.json",
        "tools/ts_library_builder/test.ts"
    ])
    setup_test()
    util_test()
    benchmark_test(build_dir, deno_exe)

    test_cc = os.path.join(build_dir, "test_cc" + executable_suffix)
    check_exists(test_cc)
    run([test_cc])

    test_rs = os.path.join(build_dir, "test_rs" + executable_suffix)
    check_exists(test_rs)
    run([test_rs])

    deno_core_test = os.path.join(build_dir,
                                  "deno_core_test" + executable_suffix)
    check_exists(deno_core_test)
    run([deno_core_test])

    unit_tests(deno_exe)

    prefetch_test(deno_exe)
    fmt_test(deno_exe)

    integration_tests(deno_exe)

    # TODO We currently skip testing the prompt and IsTTY in Windows completely.
    # Windows does not support the pty module used for testing the permission
    # prompt.
    if os.name != 'nt':
        from permission_prompt_test import permission_prompt_test
        from is_tty_test import is_tty_test
        permission_prompt_test(deno_exe)
        is_tty_test(deno_exe)

    repl_tests(deno_exe)

    rmtree(deno_dir)

    deno_dir_test(deno_exe, deno_dir)

    test_no_color(deno_exe)
Example #16
0
def main():
    enable_ansi_colors()
    os.chdir(root_path)
    cpplint()
    eslint()
    pylint()
Example #17
0
File: lint.py Project: F001/deno
#!/usr/bin/env python
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
# Does google-lint on c++ files and ts-lint on typescript files

import os
import sys
from util import enable_ansi_colors, find_exts, root_path, run

enable_ansi_colors()

third_party_path = os.path.join(root_path, "third_party")
cpplint = os.path.join(third_party_path, "cpplint", "cpplint.py")
tslint = os.path.join(third_party_path, "node_modules", "tslint", "bin",
                      "tslint")

os.chdir(root_path)
run([
    "python", cpplint, "--filter=-build/include_subdir",
    "--repository=libdeno", "--extensions=cc,h", "--recursive", "libdeno"
])

run(["node", tslint, "-p", ".", "--exclude", "**/gen/**/*.ts"])
run([
    "node", tslint, "./js/**/*_test.ts", "./tests/**/*.ts", "./core/*.js",
    "--exclude", "**/gen/**/*.ts", "--project", "tsconfig.json"
])

run([sys.executable, "third_party/depot_tools/pylint.py"] +
    find_exts(["tools", "build_extra"], [".py"], skip=["tools/clang"]))
Example #18
0
File: lint.py Project: veznlee/deno
#!/usr/bin/env python
# Does google-lint on c++ files and ts-lint on typescript files

import os
from util import enable_ansi_colors, run

enable_ansi_colors()

root_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
third_party_path = os.path.join(root_path, "third_party")
cpplint = os.path.join(third_party_path, "cpplint", "cpplint.py")
tslint = os.path.join(third_party_path, "node_modules", "tslint", "bin",
                      "tslint")

os.chdir(root_path)
run([
    "python", cpplint, "--filter=-build/include_subdir", "--repository=src",
    "--extensions=cc,h", "--recursive", "src/."
])

run(["node", tslint, "-p", ".", "--exclude", "**/gen/**/*.ts"])
run([
    "node", tslint, "./js/**/*_test.ts", "./tests/**/*.ts", "--exclude",
    "**/gen/**/*.ts", "--project", "tsconfig.json"
])
Example #19
0
#!/usr/bin/env python
# Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
# Run this script if you are changing Deno's dependencies.
# To update the deno_third_party git repo after running this, try the following:
# cd third_party
# find . -type f | grep -v "\.git" | \
#   xargs -I% git add -f --no-warn-embedded-repo "%"

import third_party
import util

util.enable_ansi_colors()

third_party.fix_symlinks()

third_party.run_yarn()
third_party.run_cargo()
third_party.run_pip()
third_party.run_gclient_sync()