Skip to content

Commit

Permalink
Bug 1505859 - Allow rusttests to run when requested without --enable-…
Browse files Browse the repository at this point in the history
…rust-tests. r=firefox-build-system-reviewers,ted

Differential Revision: https://phabricator.services.mozilla.com/D11514
  • Loading branch information
chmanchester committed Nov 10, 2018
1 parent 2ee46ca commit 389928a
Show file tree
Hide file tree
Showing 12 changed files with 13 additions and 23 deletions.
1 change: 0 additions & 1 deletion browser/config/mozconfigs/linux32/rusttests
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0

ac_add_options --enable-rust-tests
mk_add_options MOZ_MAKE_FLAGS=--output-sync=line

. "$topsrcdir/browser/config/mozconfigs/linux32/nightly"
Expand Down
1 change: 0 additions & 1 deletion browser/config/mozconfigs/linux32/rusttests-debug
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0

ac_add_options --enable-rust-tests
mk_add_options MOZ_MAKE_FLAGS=--output-sync=line

. "$topsrcdir/browser/config/mozconfigs/linux32/debug"
Expand Down
1 change: 0 additions & 1 deletion browser/config/mozconfigs/linux64/rusttests
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0

ac_add_options --enable-rust-tests
mk_add_options MOZ_MAKE_FLAGS=--output-sync=line

. "$topsrcdir/browser/config/mozconfigs/linux64/nightly"
Expand Down
1 change: 0 additions & 1 deletion browser/config/mozconfigs/linux64/rusttests-debug
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0

ac_add_options --enable-rust-tests
mk_add_options MOZ_MAKE_FLAGS=--output-sync=line

. "$topsrcdir/browser/config/mozconfigs/linux64/debug"
Expand Down
2 changes: 0 additions & 2 deletions browser/config/mozconfigs/win32/rusttests
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0

ac_add_options --enable-rust-tests

. "$topsrcdir/browser/config/mozconfigs/win32/nightly"
2 changes: 0 additions & 2 deletions browser/config/mozconfigs/win32/rusttests-debug
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0

ac_add_options --enable-rust-tests

. "$topsrcdir/browser/config/mozconfigs/win32/debug"
2 changes: 0 additions & 2 deletions browser/config/mozconfigs/win64/rusttests
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0

ac_add_options --enable-rust-tests

. "$topsrcdir/browser/config/mozconfigs/win64/nightly"
2 changes: 0 additions & 2 deletions browser/config/mozconfigs/win64/rusttests-debug
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ MOZ_AUTOMATION_BUILD_SYMBOLS=0
MOZ_AUTOMATION_PACKAGE_TESTS=0
MOZ_AUTOMATION_L10N_CHECK=0

ac_add_options --enable-rust-tests

. "$topsrcdir/browser/config/mozconfigs/win64/debug"
2 changes: 1 addition & 1 deletion build/moz.configure/rust.configure
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ rustdoc = check_prog('RUSTDOC', add_rustup_path('rustdoc'),
# This option is separate from --enable-tests because Rust tests are particularly
# expensive in terms of compile time (especially for code in libxul).
option('--enable-rust-tests',
help='Enable building of Rust tests, and build-time execution of them')
help='Enable building and running of Rust tests during `make check`')


@depends('--enable-rust-tests', rustdoc)
Expand Down
1 change: 0 additions & 1 deletion config/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -1074,7 +1074,6 @@ rust_test_flag := --no-fail-fast
force-cargo-test-run:
$(call RUN_CARGO,test $(cargo_target_flag) $(rust_test_flag) $(rust_test_options) $(rust_features_flag),$(rustflags_override) $(RUSTFLAGS),$(target_cargo_env_vars))

check:: force-cargo-test-run
endif

ifdef HOST_RUST_LIBRARY_FILE
Expand Down
6 changes: 5 additions & 1 deletion python/mozbuild/mozbuild/backend/recursivemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,11 @@ def _process_host_rust_program(self, obj, backend_file):
'HOST_RUST_CARGO_PROGRAMS')

def _process_rust_tests(self, obj, backend_file):
self._no_skip['check'].add(backend_file.relobjdir)
if obj.config.substs.get('MOZ_RUST_TESTS'):
# If --enable-rust-tests has been set, run these as a part of
# make check.
self._no_skip['check'].add(backend_file.relobjdir)
backend_file.write('check:: force-cargo-test-run\n')
build_target = self._build_target_for_obj(obj)
self._compile_graph[build_target]
self._process_non_default_target(obj, 'force-cargo-test-run',
Expand Down
15 changes: 7 additions & 8 deletions python/mozbuild/mozbuild/frontend/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1305,14 +1305,13 @@ def emit_from_context(self, context):
Manifest('components',
mozpath.basename(c)))

if self.config.substs.get('MOZ_RUST_TESTS', None):
rust_tests = context.get('RUST_TESTS', [])
if rust_tests:
# TODO: more sophisticated checking of the declared name vs.
# contents of the Cargo.toml file.
features = context.get('RUST_TEST_FEATURES', [])

yield RustTests(context, rust_tests, features)
rust_tests = context.get('RUST_TESTS', [])
if rust_tests:
# TODO: more sophisticated checking of the declared name vs.
# contents of the Cargo.toml file.
features = context.get('RUST_TEST_FEATURES', [])

yield RustTests(context, rust_tests, features)

for obj in self._process_test_manifests(context):
yield obj
Expand Down

0 comments on commit 389928a

Please sign in to comment.