[tor-bugs] #25386 [Core Tor/Tor]: Link Rust Tests to C Dependencies in Tor (allow integration testing from Rust to C)

Tor Bug Tracker & Wiki blackhole at torproject.org
Wed Aug 8 18:04:35 UTC 2018


#25386: Link Rust Tests to C Dependencies in Tor (allow integration testing from
Rust to C)
-------------------------------------------------+-------------------------
 Reporter:  Hello71                              |          Owner:  nickm
     Type:  defect                               |         Status:
                                                 |  accepted
 Priority:  High                                 |      Milestone:  Tor:
                                                 |  unspecified
Component:  Core Tor/Tor                         |        Version:  Tor:
                                                 |  0.3.3.1-alpha
 Severity:  Normal                               |     Resolution:
 Keywords:  rust, tor-test, 033-backport,        |  Actual Points:
  review-group-34, 034-triage-20180328,          |
  034-included-20180401, 035-removed-20180711    |
Parent ID:                                       |         Points:  3
 Reviewer:  isis                                 |        Sponsor:
                                                 |  SponsorQ
-------------------------------------------------+-------------------------

Comment (by Hello71):

 Replying to [comment:74 teor]:
 > Replying to [comment:73 isis]:
 > > Replying to [comment:71 nickm]:
 > > > > Can we make it optional?
 > > >
 > > > Sure -- but someone will need to come up with a mechanism that works
 and doesn't cause too much pain.
 > >
 > > So 1.27 is now the stable rust, and it [https://github.com/rust-
 lang/rust/pull/49956/commits/1a0d7a8207907e2459db8df72a8f604cdcc8285f does
 include] the `-C` option for rustdoc.
 > >
 > > I'm not exactly understanding which part is supposed to be optional?
 Is it:
 > >
 > > 1. Passing the same flags as we pass to `RUSTFLAGS` to the `rustdoc
 -C` should be optional?
 >
 > Yes, we need to be able to:
 > * pass -C when rustdoc supports it (should we do an autoconf test?)
 > * not pass -C when rustdoc doesn't support it
 >
 > I don't know if we need to be able to:
 > * disable -C even if rustdoc supports it - do we need to check that we
 can compile without -C?
 >
 > > 2. Or, compiling tests which expect to use C code should be optional?
 (If so, see #26398.)
 >
 > Yes, we need to be able to:
 > * disable rustdoc tests which use C code when rustdoc doesn't support -C
 >
 > I don't know if we need to be able to:
 > * disable all rust tests that use C code - do we need to make tests
 faster, or check we can compile rust-only?
 >
 > > 3. Or something else?

 The most accurate method to do this seems to be:

 1. rename "test-c-from-rust" to "use-c-from-doctests".
 2. replace ",no_run" with "\n#![cfg(feature = "use-c-from-doctests")]".
 3. delete "#[cfg(feature = "test-c-from-rust")]" everywhere. (this is
 supposed to be fixed already)
 4. add a configure test to check if rustdoc supports -C. Probably this
 involves calling `rustdoc -C help` and checking the exit status. if so,
 tell the test script to add `-C linker=x` to RUSTDOCFLAGS as well as
 RUSTFLAGS (which it does already), and add `--features use-c-from-
 doctests` to the `cargo test` command line. otherwise, do neither.

 This might cause the doctests to all fail. If so, or if this sounds like
 too much work (which I think), I say scrap it and just use `cargo test
 --lib` if rustdoc doesn't take -C. I think that sounds like a reasonable
 interim solution, since rustdoc will take -C everywhere soon enough.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/25386#comment:77>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list