Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
deno
提交
9d62d77c
D
deno
项目概览
张重言
/
deno
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
deno
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
9d62d77c
编写于
9月 04, 2019
作者:
R
Ryan Dahl
提交者:
GitHub
9月 04, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Run tests after "cargo build" on travis (#2854)
上级
82588ec0
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
86 addition
and
25 deletion
+86
-25
.travis.yml
.travis.yml
+2
-2
cli/BUILD.gn
cli/BUILD.gn
+4
-1
cli/compilers/ts.rs
cli/compilers/ts.rs
+17
-8
cli/file_fetcher.rs
cli/file_fetcher.rs
+12
-4
cli/worker.rs
cli/worker.rs
+26
-6
tools/target_test.py
tools/target_test.py
+25
-4
未找到文件。
.travis.yml
浏览文件 @
9d62d77c
...
@@ -9,7 +9,6 @@ env:
...
@@ -9,7 +9,6 @@ env:
-
CARGO_HOME=$TRAVIS_BUILD_DIR/third_party/rust_crates/
-
CARGO_HOME=$TRAVIS_BUILD_DIR/third_party/rust_crates/
-
RUSTUP_HOME=$HOME/.rustup/
-
RUSTUP_HOME=$HOME/.rustup/
-
RUST_BACKTRACE=full
-
RUST_BACKTRACE=full
-
CARGO_TARGET_DIR=$HOME/target
-
PATH=$TRAVIS_BUILD_DIR/third_party/llvm-build/Release+Asserts/bin:$CARGO_HOME/bin:$PATH
-
PATH=$TRAVIS_BUILD_DIR/third_party/llvm-build/Release+Asserts/bin:$CARGO_HOME/bin:$PATH
-
PYTHONPATH=third_party/python_packages
-
PYTHONPATH=third_party/python_packages
-
RUSTC_WRAPPER=sccache
-
RUSTC_WRAPPER=sccache
...
@@ -117,8 +116,9 @@ jobs:
...
@@ -117,8 +116,9 @@ jobs:
script
:
script
:
-
./tools/lint.py
-
./tools/lint.py
-
./tools/test_format.py
-
./tools/test_format.py
-
cargo build -
vv -
-release --locked
-
cargo build --release --locked
-
cargo clippy --all-targets --release --locked -- -D clippy::all
-
cargo clippy --all-targets --release --locked -- -D clippy::all
-
DENO_BUILD_MODE=release CARGO_TEST=1 ./tools/test.py
# LSAN: We are in the process of getting a completely clean LSAN build,
# LSAN: We are in the process of getting a completely clean LSAN build,
# but it will take some work. So for now we just run a subset of the
# but it will take some work. So for now we just run a subset of the
...
...
cli/BUILD.gn
浏览文件 @
9d62d77c
...
@@ -96,5 +96,8 @@ rust_test("cli_test") {
...
@@ -96,5 +96,8 @@ rust_test("cli_test") {
inputs = [
inputs = [
"Cargo.toml",
"Cargo.toml",
]
]
env = [ "CARGO_PKG_VERSION=${deno_cargo_info.version}" ]
env = [
"CARGO_PKG_VERSION=${deno_cargo_info.version}",
"CARGO_MANIFEST_DIR=" + rebase_path("."),
]
}
}
cli/compilers/ts.rs
浏览文件 @
9d62d77c
...
@@ -405,7 +405,7 @@ impl TsCompiler {
...
@@ -405,7 +405,7 @@ impl TsCompiler {
.get_compiled_module
(
&
source_file_
.url
)
.get_compiled_module
(
&
source_file_
.url
)
.map_err
(|
e
|
{
.map_err
(|
e
|
{
// TODO: this situation shouldn't happen
// TODO: this situation shouldn't happen
panic!
(
"Expected to find compiled file: {}
"
,
e
)
panic!
(
"Expected to find compiled file: {}
{}"
,
e
,
source_file_
.url
)
})
})
})
})
.and_then
(
move
|
compiled_module
|
{
.and_then
(
move
|
compiled_module
|
{
...
@@ -658,18 +658,23 @@ mod tests {
...
@@ -658,18 +658,23 @@ mod tests {
#[test]
#[test]
fn
test_compile_sync
()
{
fn
test_compile_sync
()
{
tokio_util
::
init
(||
{
tokio_util
::
init
(||
{
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.unwrap
()
.join
(
"tests/002_hello.ts"
)
.to_owned
();
let
specifier
=
let
specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
"./tests/002_hello.ts"
)
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
p
.to_str
()
.unwrap
()
)
.unwrap
();
let
out
=
SourceFile
{
let
out
=
SourceFile
{
url
:
specifier
.as_url
()
.clone
(),
url
:
specifier
.as_url
()
.clone
(),
filename
:
PathBuf
::
from
(
"/tests/002_hello.ts"
),
filename
:
PathBuf
::
from
(
p
.to_str
()
.unwrap
()
.to_string
()
),
media_type
:
msg
::
MediaType
::
TypeScript
,
media_type
:
msg
::
MediaType
::
TypeScript
,
source_code
:
include_bytes!
(
"../../tests/002_hello.ts"
)
.to_vec
(),
source_code
:
include_bytes!
(
"../../tests/002_hello.ts"
)
.to_vec
(),
};
};
let
mock_state
=
ThreadSafeState
::
mock
(
vec!
[
let
mock_state
=
ThreadSafeState
::
mock
(
vec!
[
String
::
from
(
"
./
deno"
),
String
::
from
(
"deno"
),
String
::
from
(
"hello.js"
),
String
::
from
(
"hello.js"
),
]);
]);
let
compiled
=
mock_state
let
compiled
=
mock_state
...
@@ -685,15 +690,19 @@ mod tests {
...
@@ -685,15 +690,19 @@ mod tests {
#[test]
#[test]
fn
test_bundle_async
()
{
fn
test_bundle_async
()
{
let
specifier
=
"./tests/002_hello.ts"
;
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.unwrap
()
.join
(
"tests/002_hello.ts"
)
.to_owned
();
use
deno
::
ModuleSpecifier
;
use
deno
::
ModuleSpecifier
;
let
module_name
=
ModuleSpecifier
::
resolve_url_or_path
(
specifier
)
let
module_name
=
ModuleSpecifier
::
resolve_url_or_path
(
p
.to_str
()
.unwrap
()
)
.unwrap
()
.unwrap
()
.to_string
();
.to_string
();
let
state
=
ThreadSafeState
::
mock
(
vec!
[
let
state
=
ThreadSafeState
::
mock
(
vec!
[
String
::
from
(
"
./
deno"
),
String
::
from
(
"deno"
),
String
::
from
(
"./tests/002_hello.ts"
),
p
.to_string_lossy
()
.into
(
),
String
::
from
(
"$deno$/bundle.js"
),
String
::
from
(
"$deno$/bundle.js"
),
]);
]);
let
out
=
state
.ts_compiler
.bundle_async
(
let
out
=
state
.ts_compiler
.bundle_async
(
...
...
cli/file_fetcher.rs
浏览文件 @
9d62d77c
...
@@ -1262,9 +1262,13 @@ mod tests {
...
@@ -1262,9 +1262,13 @@ mod tests {
let
r
=
fetcher
.fetch_source_file
(
&
specifier
);
let
r
=
fetcher
.fetch_source_file
(
&
specifier
);
assert
!
(
r
.is_err
());
assert
!
(
r
.is_err
());
// Assuming cwd is the deno repo root.
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.unwrap
()
.join
(
"js/main.ts"
)
.to_owned
();
let
specifier
=
let
specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
"js/main.ts"
)
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
p
.to_str
()
.unwrap
()
)
.unwrap
();
let
r
=
fetcher
.fetch_source_file
(
&
specifier
);
let
r
=
fetcher
.fetch_source_file
(
&
specifier
);
assert
!
(
r
.is_ok
());
assert
!
(
r
.is_ok
());
})
})
...
@@ -1282,9 +1286,13 @@ mod tests {
...
@@ -1282,9 +1286,13 @@ mod tests {
let
r
=
fetcher
.fetch_source_file
(
&
specifier
);
let
r
=
fetcher
.fetch_source_file
(
&
specifier
);
assert
!
(
r
.is_err
());
assert
!
(
r
.is_err
());
// Assuming cwd is the deno repo root.
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.unwrap
()
.join
(
"js/main.ts"
)
.to_owned
();
let
specifier
=
let
specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
"js/main.ts"
)
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
p
.to_str
()
.unwrap
()
)
.unwrap
();
let
r
=
fetcher
.fetch_source_file
(
&
specifier
);
let
r
=
fetcher
.fetch_source_file
(
&
specifier
);
assert
!
(
r
.is_ok
());
assert
!
(
r
.is_ok
());
})
})
...
...
cli/worker.rs
浏览文件 @
9d62d77c
...
@@ -133,8 +133,13 @@ mod tests {
...
@@ -133,8 +133,13 @@ mod tests {
#[test]
#[test]
fn
execute_mod_esm_imports_a
()
{
fn
execute_mod_esm_imports_a
()
{
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.unwrap
()
.join
(
"tests/esm_imports_a.js"
)
.to_owned
();
let
module_specifier
=
let
module_specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
"tests/esm_imports_a.js"
)
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
&
p
.to_string_lossy
()
)
.unwrap
();
let
argv
=
vec!
[
String
::
from
(
"./deno"
),
module_specifier
.to_string
()];
let
argv
=
vec!
[
String
::
from
(
"./deno"
),
module_specifier
.to_string
()];
let
state
=
ThreadSafeState
::
new
(
let
state
=
ThreadSafeState
::
new
(
flags
::
DenoFlags
::
default
(),
flags
::
DenoFlags
::
default
(),
...
@@ -162,9 +167,14 @@ mod tests {
...
@@ -162,9 +167,14 @@ mod tests {
#[test]
#[test]
fn
execute_mod_circular
()
{
fn
execute_mod_circular
()
{
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.unwrap
()
.join
(
"tests/circular1.ts"
)
.to_owned
();
let
module_specifier
=
let
module_specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
"tests/circular1.js"
)
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
&
p
.to_string_lossy
()
)
.unwrap
();
let
argv
=
vec!
[
String
::
from
(
"
./
deno"
),
module_specifier
.to_string
()];
let
argv
=
vec!
[
String
::
from
(
"deno"
),
module_specifier
.to_string
()];
let
state
=
ThreadSafeState
::
new
(
let
state
=
ThreadSafeState
::
new
(
flags
::
DenoFlags
::
default
(),
flags
::
DenoFlags
::
default
(),
argv
,
argv
,
...
@@ -184,15 +194,20 @@ mod tests {
...
@@ -184,15 +194,20 @@ mod tests {
}));
}));
let
metrics
=
&
state_
.metrics
;
let
metrics
=
&
state_
.metrics
;
assert_eq!
(
metrics
.resolve_count
.load
(
Ordering
::
SeqCst
),
2
);
// TODO
assert_eq!(metrics.resolve_count.load(Ordering::SeqCst), 2);
// Check that we didn't start the compiler.
// Check that we didn't start the compiler.
assert_eq!
(
metrics
.compiler_starts
.load
(
Ordering
::
SeqCst
),
0
);
assert_eq!
(
metrics
.compiler_starts
.load
(
Ordering
::
SeqCst
),
0
);
}
}
#[test]
#[test]
fn
execute_006_url_imports
()
{
fn
execute_006_url_imports
()
{
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.unwrap
()
.join
(
"tests/006_url_imports.ts"
)
.to_owned
();
let
module_specifier
=
let
module_specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
"tests/006_url_imports.ts"
)
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
&
p
.to_string_lossy
()
)
.unwrap
();
let
argv
=
vec!
[
String
::
from
(
"deno"
),
module_specifier
.to_string
()];
let
argv
=
vec!
[
String
::
from
(
"deno"
),
module_specifier
.to_string
()];
let
mut
flags
=
flags
::
DenoFlags
::
default
();
let
mut
flags
=
flags
::
DenoFlags
::
default
();
flags
.reload
=
true
;
flags
.reload
=
true
;
...
@@ -335,8 +350,13 @@ mod tests {
...
@@ -335,8 +350,13 @@ mod tests {
// This assumes cwd is project root (an assumption made throughout the
// This assumes cwd is project root (an assumption made throughout the
// tests).
// tests).
let
mut
worker
=
create_test_worker
();
let
mut
worker
=
create_test_worker
();
let
p
=
std
::
path
::
PathBuf
::
from
(
env!
(
"CARGO_MANIFEST_DIR"
))
.parent
()
.unwrap
()
.join
(
"tests/002_hello.ts"
)
.to_owned
();
let
module_specifier
=
let
module_specifier
=
ModuleSpecifier
::
resolve_url_or_path
(
"./tests/002_hello.ts"
)
.unwrap
();
ModuleSpecifier
::
resolve_url_or_path
(
&
p
.to_string_lossy
()
)
.unwrap
();
let
result
=
worker
.execute_mod_async
(
&
module_specifier
,
false
)
.wait
();
let
result
=
worker
.execute_mod_async
(
&
module_specifier
,
false
)
.wait
();
assert
!
(
result
.is_ok
());
assert
!
(
result
.is_ok
());
})
})
...
...
tools/target_test.py
浏览文件 @
9d62d77c
...
@@ -5,6 +5,15 @@ from test_util import DenoTestCase, run_tests
...
@@ -5,6 +5,15 @@ from test_util import DenoTestCase, run_tests
from
util
import
executable_suffix
,
tests_path
,
run
,
run_output
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
):
class
TestTarget
(
DenoTestCase
):
@
staticmethod
@
staticmethod
def
check_exists
(
filename
):
def
check_exists
(
filename
):
...
@@ -22,17 +31,29 @@ class TestTarget(DenoTestCase):
...
@@ -22,17 +31,29 @@ class TestTarget(DenoTestCase):
self
.
check_exists
(
bin_file
)
self
.
check_exists
(
bin_file
)
run
([
bin_file
],
quiet
=
True
)
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
):
def
test_libdeno
(
self
):
self
.
_test
(
"libdeno_test"
)
if
not
is_cargo_test
():
self
.
_test
(
"libdeno_test"
)
def
test_cli
(
self
):
def
test_cli
(
self
):
self
.
_test
(
"cli_test"
)
if
not
is_cargo_test
():
self
.
_test
(
"cli_test"
)
def
test_core
(
self
):
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
):
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
):
def
test_no_color
(
self
):
t
=
os
.
path
.
join
(
tests_path
,
"no_color.js"
)
t
=
os
.
path
.
join
(
tests_path
,
"no_color.js"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录