m4b/scroll

tests fail in README.md on published crates

kentfredric opened this issue · 6 comments

cargo test for scroll 0.10.1
     Running target/debug/deps/readme-1392794e1e0e15a9

running 1 test

running 4 tests
test README.md - _::Scroll___cast_some_magic::Overview (line 37) ... FAILED
test README.md - _API (line 150) ... FAILED
test README.md - _API (line 128) ... FAILED
test README.md - Advanced_Uses (line 178) ... FAILED

failures:

---- README.md - _::Scroll___cast_some_magic::Overview (line 37) stdout ----
error[E0433]: failed to resolve: maybe a missing crate `scroll`?
  --> README.md:68:9
   |
32 |     use scroll::ctx::*;
   |         ^^^^^^ maybe a missing crate `scroll`?

error[E0432]: unresolved import `scroll`
 --> README.md:38:5
  |
2 | use scroll::{ctx, Pread, LE};
  |     ^^^^^^ maybe a missing crate `scroll`?

error: extern location for scroll does not exist: /home/kent/.cpanm/work/1573729597.27629/scroll-0.10.1/target/debug/libscroll.rlib

error[E0463]: can't find crate for `scroll`
 --> README.md:40:26
  |
4 | fn parse() -> Result<(), scroll::Error> {
  |                          ^^^^^^ can't find crate

error: aborting due to 4 previous errors

Some errors have detailed explanations: E0432, E0433, E0463.
For more information about an error, try `rustc --explain E0432`.
Couldn't compile the test.
---- README.md - _API (line 150) stdout ----
error[E0432]: unresolved import `scroll`
 --> README.md:151:5
  |
2 | use scroll::{IOwrite, LE, BE};
  |     ^^^^^^ maybe a missing crate `scroll`?

error: extern location for scroll does not exist: /home/kent/.cpanm/work/1573729597.27629/scroll-0.10.1/target/debug/libscroll.rlib

error[E0463]: can't find crate for `scroll`
 --> README.md:154:29
  |
5 | fn write_io() -> Result<(), scroll::Error> {
  |                             ^^^^^^ can't find crate

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0432, E0463.
For more information about an error, try `rustc --explain E0432`.
Couldn't compile the test.
---- README.md - _API (line 128) stdout ----
error[E0432]: unresolved import `scroll`
 --> README.md:130:5
  |
3 | use scroll::IOread;
  |     ^^^^^^ maybe a missing crate `scroll`?

error: extern location for scroll does not exist: /home/kent/.cpanm/work/1573729597.27629/scroll-0.10.1/target/debug/libscroll.rlib

error[E0463]: can't find crate for `scroll`
 --> README.md:132:29
  |
5 | fn parse_io() -> Result<(), scroll::Error> {
  |                             ^^^^^^ can't find crate

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0432, E0463.
For more information about an error, try `rustc --explain E0432`.
Couldn't compile the test.
---- README.md - Advanced_Uses (line 178) stdout ----
error[E0432]: unresolved import `scroll`
 --> README.md:179:5
  |
2 | use scroll::{ctx, Pread, BE, Endian};
  |     ^^^^^^ maybe a missing crate `scroll`?

error: extern location for scroll does not exist: /home/kent/.cpanm/work/1573729597.27629/scroll-0.10.1/target/debug/libscroll.rlib

error[E0463]: can't find crate for `scroll`
  --> README.md:188:16
   |
11 |   type Error = scroll::Error;
   |                ^^^^^^ can't find crate

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0432, E0463.
For more information about an error, try `rustc --explain E0432`.
Couldn't compile the test.

failures:
    README.md - Advanced_Uses (line 178)
    README.md - _::Scroll___cast_some_magic::Overview (line 37)
    README.md - _API (line 128)
    README.md - _API (line 150)

test result: FAILED. 0 passed; 4 failed; 0 ignored; 0 measured; 0 filtered out

test readme_test ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
cargo test for scroll 0.9.2
     Running target/debug/deps/readme-0aa9dd19900c77c6

running 1 test

running 5 tests
test README.md - _::Scroll___cast_some_magic::Deriving_ (line 86) ... FAILED
test README.md - _API (line 130) ... FAILED
test README.md - Advanced_Uses (line 184) ... FAILED
test README.md - _::Scroll___cast_some_magic::Overview (line 37) ... FAILED
test README.md - _API (line 154) ... FAILED

failures:

---- README.md - _::Scroll___cast_some_magic::Deriving_ (line 86) stdout ----
error: extern location for scroll does not exist: /home/kent/.cpanm/work/1573729474.26594/scroll-0.9.2/target/debug/libscroll.rlib

error[E0463]: can't find crate for `scroll`
 --> README.md:88:1
  |
3 | extern crate scroll;
  | ^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
Couldn't compile the test.
---- README.md - _API (line 130) stdout ----
error: extern location for scroll does not exist: /home/kent/.cpanm/work/1573729474.26594/scroll-0.9.2/target/debug/libscroll.rlib

error[E0463]: can't find crate for `scroll`
 --> README.md:131:1
  |
2 | extern crate scroll;
  | ^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
Couldn't compile the test.
---- README.md - Advanced_Uses (line 184) stdout ----
error: extern location for scroll does not exist: /home/kent/.cpanm/work/1573729474.26594/scroll-0.9.2/target/debug/libscroll.rlib

error[E0463]: can't find crate for `scroll`
 --> README.md:185:1
  |
2 | extern crate scroll;
  | ^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
Couldn't compile the test.
---- README.md - _::Scroll___cast_some_magic::Overview (line 37) stdout ----
error: extern location for scroll does not exist: /home/kent/.cpanm/work/1573729474.26594/scroll-0.9.2/target/debug/libscroll.rlib

error[E0463]: can't find crate for `scroll`
 --> README.md:38:1
  |
2 | extern crate scroll;
  | ^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
Couldn't compile the test.
---- README.md - _API (line 154) stdout ----
error: extern location for scroll does not exist: /home/kent/.cpanm/work/1573729474.26594/scroll-0.9.2/target/debug/libscroll.rlib

error[E0463]: can't find crate for `scroll`
 --> README.md:155:1
  |
2 | extern crate scroll;
  | ^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0463`.
Couldn't compile the test.

failures:
    README.md - Advanced_Uses (line 184)
    README.md - _::Scroll___cast_some_magic::Deriving_ (line 86)
    README.md - _::Scroll___cast_some_magic::Overview (line 37)
    README.md - _API (line 130)
    README.md - _API (line 154)

test result: FAILED. 0 passed; 5 failed; 0 ignored; 0 measured; 0 filtered out

test readme_test ... FAILED

failures:

---- readme_test stdout ----
Running `"rustdoc" "--verbose" "--test" "-L" "/home/kent/.cpanm/work/1573729474.26594/scroll-0.9.2/target/debug" "-L" "/home/kent/.cpanm/work/1573729474.26594/scroll-0.9.2/target/debug/deps" "--extern" "scroll=/home/kent/.cpanm/work/1573729474.26594/scroll-0.9.2/target/debug/libscroll.rlib" "README.md"`
thread 'readme_test' panicked at 'Failed to run rustdoc tests on README.md!', tests/readme.rs:27:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.


failures:
    readme_test

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

error: test failed, to rerun pass '--test readme'
m4b commented

Hmm; I thought I disabled the readme tests...

m4b commented

@kentfredric would you be interested in fixing or taking a look ?

It looks like you've made it so that when the weird "invoke rustdoc directly" stuff fails, the test itself doesn't fail on 0.10.1.

Which is kinda pointless really, if you're gonna ignore the result of a test, why bother running it?

Ideally you want some sort of mechanism in place so that cargo test --test doc automatically traverses README.md somehow, not having a hand coded test that invokes rustdoc.

m4b commented

Yes I disabled the readme test. I dunno what it does, @luser wrote it iirc.

Any PR fixing it or doing something better would be great !

luser commented

It was a bit of a hack to make it so we actually ran the examples in README.md. There isn't any standard way to accomplish this currently. If the external docs feature were stabilized then it'd be straightforward to just include README.md as external documentation in which case all of the code examples would get run by way of rustdoc.

m4b commented

Ok thanks to @luser i believe this is now fixed and from what I understand, once 1.40 lands we can add the new rustdoc macro to include the readme and it won’t affect minimum version for downstream crates!