2018-08-23 19:47:43 -04:00
|
|
|
#!/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):
|
2018-09-04 19:18:31 -04:00
|
|
|
run([deno_exe, "--reload", "js/unit_tests.ts", "permW0N0E0"])
|
|
|
|
run([
|
|
|
|
deno_exe, "--reload", "js/unit_tests.ts", "permW1N0E0", "--allow-write"
|
|
|
|
])
|
|
|
|
run([
|
|
|
|
deno_exe, "--reload", "js/unit_tests.ts", "permW0N1E0", "--allow-net"
|
|
|
|
])
|
|
|
|
run([
|
|
|
|
deno_exe, "--reload", "js/unit_tests.ts", "permW0N0E1", "--allow-env"
|
|
|
|
])
|
2018-08-23 19:47:43 -04:00
|
|
|
run([
|
2018-09-02 01:59:16 -04:00
|
|
|
deno_exe,
|
2018-09-04 19:18:31 -04:00
|
|
|
"--reload",
|
2018-09-02 01:59:16 -04:00
|
|
|
"js/unit_tests.ts",
|
|
|
|
"permW1N1E1",
|
|
|
|
"--allow-write",
|
2018-08-31 07:51:12 -04:00
|
|
|
"--allow-net",
|
|
|
|
"--allow-env",
|
2018-08-23 19:47:43 -04:00
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
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])
|