diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/benchmark.py | 14 | ||||
-rwxr-xr-x | tools/fmt_test.py | 2 | ||||
-rwxr-xr-x | tools/permission_prompt_test.py | 31 | ||||
-rwxr-xr-x | tools/throughput_benchmark.py | 2 | ||||
-rwxr-xr-x | tools/unit_tests.py | 2 |
5 files changed, 25 insertions, 26 deletions
diff --git a/tools/benchmark.py b/tools/benchmark.py index db2ef0fb2..2e3ac26e4 100755 --- a/tools/benchmark.py +++ b/tools/benchmark.py @@ -23,8 +23,8 @@ exec_time_benchmarks = [ ("hello", ["tests/002_hello.ts"]), ("relative_import", ["tests/003_relative_import.ts"]), ("error_001", ["tests/error_001.ts"]), - ("cold_hello", ["tests/002_hello.ts", "--reload"]), - ("cold_relative_import", ["tests/003_relative_import.ts", "--reload"]), + ("cold_hello", ["--reload", "tests/002_hello.ts"]), + ("cold_relative_import", ["--reload", "tests/003_relative_import.ts"]), ("workers_startup", ["tests/workers_startup_bench.ts"]), ("workers_round_robin", ["tests/workers_round_robin_bench.ts"]), ] @@ -127,10 +127,10 @@ def get_strace_summary(test_args): def run_thread_count_benchmark(deno_path): thread_count_map = {} thread_count_map["set_timeout"] = get_strace_summary([ - deno_path, "tests/004_set_timeout.ts", "--reload" + deno_path, "--reload", "tests/004_set_timeout.ts" ])["clone"]["calls"] + 1 thread_count_map["fetch_deps"] = get_strace_summary([ - deno_path, "tests/fetch_deps.ts", "--reload", "--allow-net" + deno_path, "--reload", "--allow-net", "tests/fetch_deps.ts" ])["clone"]["calls"] + 1 return thread_count_map @@ -147,10 +147,10 @@ def run_throughput(deno_exe): def run_syscall_count_benchmark(deno_path): syscall_count_map = {} syscall_count_map["hello"] = get_strace_summary( - [deno_path, "tests/002_hello.ts", "--reload"])["total"]["calls"] + [deno_path, "--reload", "tests/002_hello.ts"])["total"]["calls"] syscall_count_map["fetch_deps"] = get_strace_summary( - [deno_path, "tests/fetch_deps.ts", "--reload", - "--allow-net"])["total"]["calls"] + [deno_path, "--reload", "--allow-net", + "tests/fetch_deps.ts"])["total"]["calls"] return syscall_count_map diff --git a/tools/fmt_test.py b/tools/fmt_test.py index dd704485d..85b475015 100755 --- a/tools/fmt_test.py +++ b/tools/fmt_test.py @@ -19,7 +19,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/std/prettier/main.ts deno_dir = os.path.join(root_path, "js") - run([deno_exe, dst, "--fmt"], merge_env={"DENO_DIR": deno_dir}) + run([deno_exe, "fmt", dst], merge_env={"DENO_DIR": deno_dir}) with open(fixed_filename) as f: expected = f.read() with open(dst) as f: diff --git a/tools/permission_prompt_test.py b/tools/permission_prompt_test.py index 312af2cf2..6e8922640 100755 --- a/tools/permission_prompt_test.py +++ b/tools/permission_prompt_test.py @@ -69,14 +69,14 @@ class Prompt(object): self.deno_exe = deno_exe self.test_types = test_types - def run(self, args, bytes_input): + def run(self, flags, args, bytes_input): "Returns (return_code, stdout, stderr)." - cmd = [self.deno_exe, PERMISSIONS_PROMPT_TEST_TS] + args + cmd = [self.deno_exe] + flags + [PERMISSIONS_PROMPT_TEST_TS] + args return tty_capture(cmd, bytes_input) def warm_up(self): # ignore the ts compiling message - self.run('needsWrite', b'', ["--allow-write"]) + self.run(["--allow-write"], 'needsWrite', b'') def test(self): for test_type in self.test_types: @@ -99,14 +99,14 @@ class Prompt(object): def test_allow_flag(self, test_type): code, stdout, stderr = self.run( - ["needs" + test_type.capitalize(), "--allow-" + test_type], b'') + ["--allow-" + test_type], ["needs" + test_type.capitalize()], b'') assert code == 0 assert not PROMPT_PATTERN in stderr assert not FIRST_CHECK_FAILED_PATTERN in stdout assert not PERMISSION_DENIED_PATTERN in stderr def test_yes_yes(self, test_type): - code, stdout, stderr = self.run(["needs" + test_type.capitalize()], + code, stdout, stderr = self.run([], ["needs" + test_type.capitalize()], b'y\ny\n') assert code == 0 assert PROMPT_PATTERN in stderr @@ -114,7 +114,7 @@ class Prompt(object): assert not PERMISSION_DENIED_PATTERN in stderr def test_yes_no(self, test_type): - code, stdout, stderr = self.run(["needs" + test_type.capitalize()], + code, stdout, stderr = self.run([], ["needs" + test_type.capitalize()], b'y\nn\n') assert code == 1 assert PROMPT_PATTERN in stderr @@ -122,7 +122,7 @@ class Prompt(object): assert PERMISSION_DENIED_PATTERN in stderr def test_no_no(self, test_type): - code, stdout, stderr = self.run(["needs" + test_type.capitalize()], + code, stdout, stderr = self.run([], ["needs" + test_type.capitalize()], b'n\nn\n') assert code == 1 assert PROMPT_PATTERN in stderr @@ -130,7 +130,7 @@ class Prompt(object): assert PERMISSION_DENIED_PATTERN in stderr def test_no_yes(self, test_type): - code, stdout, stderr = self.run(["needs" + test_type.capitalize()], + code, stdout, stderr = self.run([], ["needs" + test_type.capitalize()], b'n\ny\n') assert code == 0 @@ -139,7 +139,7 @@ class Prompt(object): assert not PERMISSION_DENIED_PATTERN in stderr def test_allow(self, test_type): - code, stdout, stderr = self.run(["needs" + test_type.capitalize()], + code, stdout, stderr = self.run([], ["needs" + test_type.capitalize()], b'a\n') assert code == 0 assert PROMPT_PATTERN in stderr @@ -147,7 +147,7 @@ class Prompt(object): assert not PERMISSION_DENIED_PATTERN in stderr def test_deny(self, test_type): - code, stdout, stderr = self.run(["needs" + test_type.capitalize()], + code, stdout, stderr = self.run([], ["needs" + test_type.capitalize()], b'd\n') assert code == 1 assert PROMPT_PATTERN in stderr @@ -155,7 +155,7 @@ class Prompt(object): assert PERMISSION_DENIED_PATTERN in stderr def test_unrecognized_option(self, test_type): - code, stdout, stderr = self.run(["needs" + test_type.capitalize()], + code, stdout, stderr = self.run([], ["needs" + test_type.capitalize()], b'e\na\n') assert code == 0 assert PROMPT_PATTERN in stderr @@ -165,17 +165,16 @@ class Prompt(object): def test_no_prompt(self, test_type): code, stdout, stderr = self.run( - ["needs" + test_type.capitalize(), "--no-prompt"], b'') + ["--no-prompt"], ["needs" + test_type.capitalize()], b'') assert code == 1 assert not PROMPT_PATTERN in stderr assert FIRST_CHECK_FAILED_PATTERN in stdout assert PERMISSION_DENIED_PATTERN in stderr def test_no_prompt_allow(self, test_type): - code, stdout, stderr = self.run([ - "needs" + test_type.capitalize(), "--no-prompt", - "--allow-" + test_type - ], b'') + code, stdout, stderr = self.run( + ["--no-prompt", "--allow-" + test_type], + ["needs" + test_type.capitalize()], b'') assert code == 0 assert not PROMPT_PATTERN in stderr assert not FIRST_CHECK_FAILED_PATTERN in stdout diff --git a/tools/throughput_benchmark.py b/tools/throughput_benchmark.py index 9048d3582..712edfe43 100755 --- a/tools/throughput_benchmark.py +++ b/tools/throughput_benchmark.py @@ -19,7 +19,7 @@ ADDR = "127.0.0.1:4544" def cat(deno_exe, megs): size = megs * MB start = time.time() - cmd = deno_exe + " tests/cat.ts --allow-read /dev/zero | head -c %s " % size + cmd = deno_exe + " --allow-read tests/cat.ts /dev/zero | head -c %s " % size print cmd subprocess.check_output(cmd, shell=True) end = time.time() diff --git a/tools/unit_tests.py b/tools/unit_tests.py index 45b35b417..76ecefbde 100755 --- a/tools/unit_tests.py +++ b/tools/unit_tests.py @@ -32,7 +32,7 @@ def run_unit_test2(cmd): def run_unit_test(deno_exe, permStr, flags=None): if flags is None: flags = [] - cmd = [deno_exe, "js/unit_tests.ts", permStr] + flags + cmd = [deno_exe, "js/unit_tests.ts"] + flags + [permStr] run_unit_test2(cmd) |