Fix mdBook tests on Windows (rust-lang/rust#99466)

This commit is contained in:
tyranron 2022-11-02 16:32:50 +01:00
parent e7cfa20254
commit e3a72edf70
No known key found for this signature in database
GPG key ID: 762E144FB230A4F0
3 changed files with 12 additions and 9 deletions

View file

@ -263,9 +263,7 @@ jobs:
os:
- ubuntu
- macOS
# TODO: Re-enable once rust-lang/rust#99466 is fixed:
# https://github.com/rust-lang/rust/issues/99466
#- windows
- windows
toolchain:
- stable
- beta
@ -277,8 +275,7 @@ jobs:
with:
toolchain: ${{ matrix.toolchain }}
- run: rustup default ${{ matrix.toolchain }}
- run: cargo install mdbook
- uses: peaceiris/actions-mdbook@v1
- run: make test.book

View file

@ -93,8 +93,13 @@ test.book:
ifeq ($(clean),yes)
cargo clean
endif
$(eval target := $(strip $(shell cargo -vV | sed -n 's/host: //p')))
cargo build
mdbook test book -L target/debug/deps
mdbook test book -L target/debug/deps $(strip \
$(if $(call eq,$(findstring windows,$(target)),),,\
$(shell cargo metadata -q \
| jq -r '.packages[] | select(.name == "windows_$(word 1,$(subst -, ,$(target)))_$(word 4,$(subst -, ,$(target)))") | .manifest_path' \
| sed -e "s/^/-L '/" -e 's/Cargo.toml/lib/' -e "s/$$/'/" )))
# Run Rust tests of project crates.

View file

@ -45,10 +45,11 @@ The output will be in the `_rendered/` directory.
### Testing
To run the tests validating all code examples in the book, run:
To run the tests validating all code examples in the book, run (from project root dir):
```bash
mdbook test -L ../target/debug/deps
cargo build
mdbook test -L target/debug/deps
# or via shortcut from project root dir:
# or via shortcut:
make test.book
```