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

View file

@ -93,8 +93,13 @@ test.book:
ifeq ($(clean),yes) ifeq ($(clean),yes)
cargo clean cargo clean
endif endif
$(eval target := $(strip $(shell cargo -vV | sed -n 's/host: //p')))
cargo build 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. # Run Rust tests of project crates.

View file

@ -45,10 +45,11 @@ The output will be in the `_rendered/` directory.
### Testing ### 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 ```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 make test.book
``` ```