Closed Bug 1393454 Opened 7 years ago Closed 7 years ago

Rust code expects test code to be there, breaks --disable-tests

Categories

(Core :: XPCOM, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: tjr, Assigned: tjr)

References

(Blocks 1 open bug)

Details

(Whiteboard: [tor])

Attachments

(1 file)

Compiling with --disable-tests yields the following:

> 51:37.42 ../i686-pc-windows-gnu/release/gkrust_gtest.lib(gkrust_gtest-6cee6ae35964b000.0.o): In function `ZN14nsstring_gtest13nonfatal_failE':
> 51:37.42 /home/worker/workspace/build/src/xpcom/rust/nsstring/gtest/test.rs:16: undefined reference to `GTest_ExpectFailure'
> 51:37.42 ../i686-pc-windows-gnu/release/gkrust_gtest.lib(gkrust_gtest-6cee6ae35964b000.0.o): In function `ZN14nsstring_gtest18Rust_AssignFromCppE':
> 51:37.42 /home/worker/workspace/build/src/xpcom/rust/nsstring/gtest/test.rs:60: undefined reference to `Cpp_AssignFromCpp'
> 51:37.42 ../i686-pc-windows-gnu/release/gkrust_gtest.lib(gkrust_gtest-6cee6ae35964b000.0.o): In function `ZN14nsstring_gtest23Rust_FixedAssignFromCppE':
> 51:37.42 /home/worker/workspace/build/src/xpcom/rust/nsstring/gtest/test.rs:75: undefined reference to `Cpp_AssignFromCpp'
> 51:37.42 ../i686-pc-windows-gnu/release/gkrust_gtest.lib(gkrust_gtest-6cee6ae35964b000.0.o): In function `ZN14nsstring_gtest22Rust_AutoAssignFromCppE':
> 51:37.42 /home/worker/workspace/build/src/xpcom/rust/nsstring/gtest/test.rs:88: undefined reference to `Cpp_AssignFromCpp'

This is because those functions are defined in a test file.
Attachment #8900827 - Flags: review?(ted)
Comment on attachment 8900827 [details]
Bug 1393454 Do not compile rust gtest crate if --disable-tests is set

https://reviewboard.mozilla.org/r/172270/#review178720

::: commit-message-e408d:1
(Diff revision 2)
> +Bug 1393454 Do not compile rust tests if --disable-tests is set

nit: this should probably say "Do not compile rust gtest crate", since those are the specific Rust tests in question.

::: moz.configure:275
(Diff revision 2)
>  # on Desktop platforms with the exception of Windows PGO, where linking
>  # xul-gtest.dll takes too long.
>  @depends('MOZ_PGO', build_project, target, 'MOZ_AUTOMATION', '--disable-gtest-in-build',
> -         when='--enable-compile-environment')
> -def build_gtest(pgo, build_project, target, automation, enabled):
> +         enable_tests, when='--enable-compile-environment')
> +def build_gtest(pgo, build_project, target, automation, enabled, enable_tests):
> +    if not enable_tests:

You could combine these two conditionals into a single one. (It's not a big deal, though.)

::: toolkit/toolkit.mozbuild:11
(Diff revision 2)
>  DIRS += [
> -    '/toolkit/library/gtest/rust',
>      '/toolkit/library/rust',
>  ]
>  
> +if CONFIG['ENABLE_TESTS']:

Moving this down below does change the ordering, but I *think* that ought to be fine in practice.
Attachment #8900827 - Flags: review?(ted) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/08122b5e49f8
Do not compile rust gtest crate if --disable-tests is set r=ted
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/08122b5e49f8
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: