]> git.lizzy.rs Git - rust.git/blob - tests/run-make/rustdoc-verify-output-files/Makefile
Rollup merge of #107048 - DebugSteven:newer-x-check-cargo, r=albertlarsan68
[rust.git] / tests / run-make / rustdoc-verify-output-files / Makefile
1 include ../../run-make-fulldeps/tools.mk
2
3 OUTPUT_DIR := "$(TMPDIR)/rustdoc"
4 TMP_OUTPUT_DIR := "$(TMPDIR)/tmp-rustdoc"
5
6 all:
7         # Generate html docs
8         $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR)
9
10         # Copy first output for to check if it's exactly same after second compilation
11         cp -R $(OUTPUT_DIR) $(TMP_OUTPUT_DIR)
12
13         # Generate html docs once again on same output
14         $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR)
15
16         # Check if everything exactly same
17         $(DIFF) -r -q $(OUTPUT_DIR) $(TMP_OUTPUT_DIR)
18
19         # Generate json doc on the same output
20         $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) -Z unstable-options --output-format json
21
22         # Check if expected json file is generated
23         [ -e $(OUTPUT_DIR)/foobar.json ]
24
25         # TODO
26         # We should re-generate json doc once again and compare the diff with previously
27         # generated one. Because layout of json docs changes in each compilation, we can't
28         # do that currently.
29         #
30         # See https://github.com/rust-lang/rust/issues/103785#issuecomment-1307425590 for details.
31
32         # remove generated json doc
33         rm $(OUTPUT_DIR)/foobar.json
34
35         # Check if json doc compilation broke any of the html files generated previously
36         $(DIFF) -r -q $(OUTPUT_DIR) $(TMP_OUTPUT_DIR)