diff options
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/test.py | 3 | ||||
-rwxr-xr-x | tools/unit_tests.py | 26 |
2 files changed, 28 insertions, 1 deletions
diff --git a/tools/test.py b/tools/test.py index 12582f83f..6e5cb548b 100755 --- a/tools/test.py +++ b/tools/test.py @@ -5,6 +5,7 @@ import os import sys from check_output_test import check_output_test from util import executable_suffix, run, build_path +from unit_tests import unit_tests from util_test import util_test import subprocess import http_server @@ -41,7 +42,7 @@ def main(argv): deno_exe = os.path.join(build_dir, "deno" + executable_suffix) check_exists(deno_exe) - run([deno_exe, "js/unit_tests.ts", "--allow-write"]) + unit_tests(deno_exe) check_exists(deno_exe) check_output_test(deno_exe) diff --git a/tools/unit_tests.py b/tools/unit_tests.py new file mode 100755 index 000000000..a2cfa33b6 --- /dev/null +++ b/tools/unit_tests.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +from util import run +import sys + + +# We want to test many ops in deno which have different behavior depending on +# the permissions set. These tests can specify which permissions they expect, +# which appends a special string like "permW1N0" to the end of the test name. +# Here we run several copies of deno with different permissions, filtering the +# tests by the special string. permW0N0 means allow-write but not allow-net. +# See js/test_util.ts for more details. +def unit_tests(deno_exe): + run([deno_exe, "js/unit_tests.ts", "permW0N0"]) + run([deno_exe, "js/unit_tests.ts", "permW1N0", "--allow-write"]) + run([deno_exe, "js/unit_tests.ts", "permW0N1", "--allow-net"]) + run([ + deno_exe, "js/unit_tests.ts", "permW1N1", "--allow-write", + "--allow-net" + ]) + + +if __name__ == '__main__': + if len(sys.argv) < 2: + print "Usage ./tools/unit_tests.py out/debug/deno" + sys.exit(1) + unit_tests(sys.argv[1]) |