summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rwxr-xr-xtools/benchmark.py23
-rwxr-xr-xtools/fmt_test.py3
-rwxr-xr-xtools/format.ts15
-rwxr-xr-xtools/integration_tests.py7
-rwxr-xr-xtools/is_tty_test.py3
-rwxr-xr-xtools/lint.py4
-rw-r--r--tools/permission_prompt_test.ts4
-rwxr-xr-xtools/test.py1
-rw-r--r--tools/third_party.py3
-rwxr-xr-xtools/unit_tests.py3
-rw-r--r--tools/util.py1
11 files changed, 42 insertions, 25 deletions
diff --git a/tools/benchmark.py b/tools/benchmark.py
index ce08c8ea3..c9b9823de 100755
--- a/tools/benchmark.py
+++ b/tools/benchmark.py
@@ -57,15 +57,20 @@ def import_data_from_gh_pages():
def get_binary_sizes(build_dir):
path_dict = {
- "deno": os.path.join(build_dir, "deno" + executable_suffix),
- "main.js": os.path.join(build_dir, "gen/bundle/main.js"),
- "main.js.map": os.path.join(build_dir, "gen/bundle/main.js.map"),
- "compiler.js": os.path.join(build_dir, "gen/bundle/compiler.js"),
- "compiler.js.map": os.path.join(build_dir,
- "gen/bundle/compiler.js.map"),
- "snapshot_deno.bin": os.path.join(build_dir, "gen/snapshot_deno.bin"),
- "snapshot_compiler.bin": os.path.join(build_dir,
- "gen/snapshot_compiler.bin")
+ "deno":
+ os.path.join(build_dir, "deno" + executable_suffix),
+ "main.js":
+ os.path.join(build_dir, "gen/bundle/main.js"),
+ "main.js.map":
+ os.path.join(build_dir, "gen/bundle/main.js.map"),
+ "compiler.js":
+ os.path.join(build_dir, "gen/bundle/compiler.js"),
+ "compiler.js.map":
+ os.path.join(build_dir, "gen/bundle/compiler.js.map"),
+ "snapshot_deno.bin":
+ os.path.join(build_dir, "gen/snapshot_deno.bin"),
+ "snapshot_compiler.bin":
+ os.path.join(build_dir, "gen/snapshot_compiler.bin")
}
sizes = {}
for name, path in path_dict.items():
diff --git a/tools/fmt_test.py b/tools/fmt_test.py
index c8eb83399..4b066a47b 100755
--- a/tools/fmt_test.py
+++ b/tools/fmt_test.py
@@ -18,8 +18,7 @@ def fmt_test(deno_exe):
# Set DENO_DIR to //js/ so we don't have to rely on an intenet
# connection to download https://deno.land/x/std/prettier/main.ts
deno_dir = os.path.join(root_path, "js")
- run(
- [deno_exe, dst, "--fmt", "--allow-read"],
+ run([deno_exe, dst, "--fmt", "--allow-read"],
merge_env={"DENO_DIR": deno_dir})
with open(fixed_filename) as f:
expected = f.read()
diff --git a/tools/format.ts b/tools/format.ts
index d6cfc8ec4..37fbd18e3 100755
--- a/tools/format.ts
+++ b/tools/format.ts
@@ -10,12 +10,20 @@ const yapf = join("third_party", "python_packages", "bin", "yapf");
const rustfmt = join("third_party", "rustfmt", deno.platform.os, "rustfmt");
const rustfmtConfig = ".rustfmt.toml";
-const run = (...args: string[]) => {
+const decoder = new TextDecoder();
+
+async function run(...args: string[]): Promise<void> {
if (deno.platform.os === "win") {
args = ["cmd.exe", "/c", ...args];
}
- return deno.run({ args, stdout: "null", stderr: "piped" }).status();
-};
+ const p = deno.run({ args, stdout: "piped", stderr: "piped" });
+ const { code } = await p.status();
+ if (code !== 0) {
+ console.log(decoder.decode(await deno.readAll(p.stderr)));
+ console.log(decoder.decode(await deno.readAll(p.stdout)));
+ deno.exit(code);
+ }
+}
(async () => {
console.log("clang_format");
@@ -49,6 +57,7 @@ const run = (...args: string[]) => {
console.log("prettier");
await run(
lookupDenoPath(),
+ "--allow-read",
"--allow-write",
"js/deps/https/deno.land/x/std/prettier/main.ts",
"rollup.config.js",
diff --git a/tools/integration_tests.py b/tools/integration_tests.py
index dfb83e19a..5c3b24f75 100755
--- a/tools/integration_tests.py
+++ b/tools/integration_tests.py
@@ -45,7 +45,7 @@ def str2bool(v):
raise ValueError("Bad boolean value")
-def integration_tests(deno_exe, test_filter = None):
+def integration_tests(deno_exe, test_filter=None):
assert os.path.isfile(deno_exe)
tests = sorted([
filename for filename in os.listdir(tests_path)
@@ -97,11 +97,12 @@ def integration_tests(deno_exe, test_filter = None):
print green_ok()
+
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--filter", help="Run specific tests")
- parser.add_argument("--release", help="Use release build of Deno",
- action="store_true")
+ parser.add_argument(
+ "--release", help="Use release build of Deno", action="store_true")
parser.add_argument("--executable", help="Use external executable of Deno")
args = parser.parse_args()
diff --git a/tools/is_tty_test.py b/tools/is_tty_test.py
index 218e7f620..867fd7a1c 100755
--- a/tools/is_tty_test.py
+++ b/tools/is_tty_test.py
@@ -10,15 +10,18 @@ from permission_prompt_test import tty_capture
IS_TTY_TEST_TS = "tests/is_tty.ts"
+
def is_tty_test(deno_exe):
cmd = [deno_exe, IS_TTY_TEST_TS]
code, stdout, _ = tty_capture(cmd, b'')
assert code == 0
assert str(stdin.isatty()).lower() in stdout
+
def main():
deno_exe = os.path.join(build_path(), "deno" + executable_suffix)
is_tty_test(deno_exe)
+
if __name__ == "__main__":
main()
diff --git a/tools/lint.py b/tools/lint.py
index 1e22703b5..148cc4728 100755
--- a/tools/lint.py
+++ b/tools/lint.py
@@ -15,8 +15,8 @@ tslint = os.path.join(third_party_path, "node_modules", "tslint", "bin",
os.chdir(root_path)
run([
- "python", cpplint, "--filter=-build/include_subdir", "--repository=libdeno",
- "--extensions=cc,h", "--recursive", "libdeno"
+ "python", cpplint, "--filter=-build/include_subdir",
+ "--repository=libdeno", "--extensions=cc,h", "--recursive", "libdeno"
])
run(["node", tslint, "-p", ".", "--exclude", "**/gen/**/*.ts"])
diff --git a/tools/permission_prompt_test.ts b/tools/permission_prompt_test.ts
index 954d12a6e..7e8bfee3d 100644
--- a/tools/permission_prompt_test.ts
+++ b/tools/permission_prompt_test.ts
@@ -1,10 +1,10 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
-import { args, listen, env, exit, makeTempDirSync, readFile, run} from "deno";
+import { args, listen, env, exit, makeTempDirSync, readFile, run } from "deno";
const name = args[1];
const test = {
needsRead: () => {
- readFile("package.json")
+ readFile("package.json");
},
needsWrite: () => {
makeTempDirSync();
diff --git a/tools/test.py b/tools/test.py
index 0fe1d6a23..51f31fbf4 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -38,7 +38,6 @@ def test_no_color(deno_exe):
print green_ok()
-
def main(argv):
if len(argv) == 2:
build_dir = sys.argv[1]
diff --git a/tools/third_party.py b/tools/third_party.py
index 4f8a8b5b7..e08e8307d 100644
--- a/tools/third_party.py
+++ b/tools/third_party.py
@@ -255,8 +255,7 @@ def download_clang_format():
# Download clang by calling the clang update script.
def download_clang():
- run(['python', tp('v8/tools/clang/scripts/update.py')],
- env=google_env())
+ run(['python', tp('v8/tools/clang/scripts/update.py')], env=google_env())
def maybe_download_sysroot():
diff --git a/tools/unit_tests.py b/tools/unit_tests.py
index 542db4642..32e100b8b 100755
--- a/tools/unit_tests.py
+++ b/tools/unit_tests.py
@@ -46,7 +46,8 @@ def unit_tests(deno_exe):
run_unit_test(deno_exe, "permR0W0N0E0U0")
run_unit_test(deno_exe, "permR1W0N0E0U0", ["--allow-read"])
run_unit_test(deno_exe, "permR0W1N0E0U0", ["--allow-write"])
- run_unit_test(deno_exe, "permR1W1N0E0U0", ["--allow-read", "--allow-write"])
+ run_unit_test(deno_exe, "permR1W1N0E0U0",
+ ["--allow-read", "--allow-write"])
run_unit_test(deno_exe, "permR1W0N1E0U0", ["--allow-read", "--allow-net"])
run_unit_test(deno_exe, "permR0W0N0E1U0", ["--allow-env"])
run_unit_test(deno_exe, "permR0W0N0E0U1", ["--allow-run"])
diff --git a/tools/util.py b/tools/util.py
index ca18faf54..8ab82e2d3 100644
--- a/tools/util.py
+++ b/tools/util.py
@@ -383,6 +383,7 @@ def parse_wrk_output(output):
def platform():
return {"linux2": "linux", "darwin": "mac", "win32": "win"}[sys.platform]
+
def mkdtemp():
# On Windows, set the base directory that mkdtemp() uses explicitly. If not,
# it'll use the short (8.3) path to the temp dir, which triggers the error