Repository: rust-lang/mdBook (language: rust)

Issue:
'mdbook test' fails in GitLab CI/CD
### Question

Hi.
I use a GitLab CI/CD pipeline to automatically build and deploy an mdbook.
All works fine, except `mdbook test`.
`mdbook test` works however on developer machine.
What am I missing?
```...
$ wget -q https://github.com/rust-lang/mdBook/releases/download/v0.4.44/mdbook-v0.4.44-x86_64-unknown-linux-gnu.tar.gz
$ tar -xzf mdbook-v0.4.44-x86_64-unknown-linux-gnu.tar.gz
$ ./mdbook build
$ ./mdbook test
2025-02-02 05:37:05 [INFO] (mdbook::book): Testing chapter 'Chapter 1': "chapter_1.md"
2025-02-02 05:37:05 [ERROR] (mdbook::utils): Error: No such file or directory (os error 2)
```

### Version

```text
mdbook v0.4.44
```


Discussion / hints:
Can you show what content you are trying to test? 
It's the basic/empty book after saying `mdbook init test`.
When I run the test (same repo) on my development ubuntu machine, all goes fine.
```
$ pwd
/builds/geohei/test
$ ls -l
total 16816
-rw-rw-rw- 1 root root     6150 Jan 31 15:37 README.md
-rw-rw-rw- 1 root root       98 Jan 31 15:37 book.toml
-rwxr-xr-x 1 1001  128 12368792 Jan 28 18:17 mdbook
-rw-r--r-- 1 root root  4829715 Jan 28 18:17 mdbook-v0.4.44-x86_64-unknown-linux-gnu.tar.gz
drwxrwxrwx 2 root root     4096 Jan 31 15:37 src
$ ./mdbook build
2025-02-02 05:25:08 [INFO] (mdbook::book): Book building has started
2025-02-02 05:25:08 [INFO] (mdbook::book): Running the html backend
$ ls -l src
total 8
-rw-rw-rw- 1 root root 41 Jan 31 15:37 SUMMARY.md
-rw-rw-rw- 1 root root 12 Jan 31 15:37 chapter_1.md
$ cat src/SUMMARY.md
# Summary
- [Chapter 1](./chapter_1.md)
$ ./mdbook test
2025-02-02 05:25:08 [INFO] (mdbook::book): Testing chapter 'Chapter 1': "chapter_1.md"
2025-02-02 05:25:08 [ERROR] (mdbook::utils): Error: No such file or directory (os error 2)
```

Fix patch:
diff --git a/src/book/mod.rs b/src/book/mod.rs
index b33ec6f00c..c5d20130ee 100644
--- a/src/book/mod.rs
+++ b/src/book/mod.rs
@@ -356,7 +356,9 @@ impl MDBook {
                 }
 
                 debug!("running {:?}", cmd);
-                let output = cmd.output()?;
+                let output = cmd
+                    .output()
+                    .with_context(|| "failed to execute `rustdoc`")?;
 
                 if !output.status.success() {
                     failed = true;


Test patch: