Run tests after "cargo build" on travis (#2854)

This commit is contained in:
Ryan Dahl 2019-09-04 17:16:46 -04:00 committed by GitHub
parent 82588ec09c
commit 9d62d77cfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 86 additions and 25 deletions

View file

@ -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")