diff options
Diffstat (limited to 'tools/target_test.py')
-rw-r--r-- | tools/target_test.py | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/tools/target_test.py b/tools/target_test.py index da1bd5537..8ccabba53 100644 --- a/tools/target_test.py +++ b/tools/target_test.py @@ -5,6 +5,15 @@ from test_util import DenoTestCase, run_tests from util import executable_suffix, tests_path, run, run_output +# In the ninja/gn we build and test individually libdeno_test, cli_test, +# deno_core_test, deno_core_http_bench_test. When building with cargo, however +# we just run "cargo test". +# This is hacky but is only temporarily here until the ninja/gn build is +# removed. +def is_cargo_test(): + return "CARGO_TEST" in os.environ + + class TestTarget(DenoTestCase): @staticmethod def check_exists(filename): @@ -22,17 +31,29 @@ class TestTarget(DenoTestCase): self.check_exists(bin_file) run([bin_file], quiet=True) + def test_cargo_test(self): + if is_cargo_test(): + cargo_test = ["cargo", "test", "--all", "--locked"] + if os.environ["DENO_BUILD_MODE"] == "release": + run(cargo_test + ["--release"]) + else: + run(cargo_test) + def test_libdeno(self): - self._test("libdeno_test") + if not is_cargo_test(): + self._test("libdeno_test") def test_cli(self): - self._test("cli_test") + if not is_cargo_test(): + self._test("cli_test") def test_core(self): - self._test("deno_core_test") + if not is_cargo_test(): + self._test("deno_core_test") def test_core_http_benchmark(self): - self._test("deno_core_http_bench_test") + if not is_cargo_test(): + self._test("deno_core_http_bench_test") def test_no_color(self): t = os.path.join(tests_path, "no_color.js") |