Skip to content

Add color diffs to htmldocck.py #78750

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jyn514 opened this issue Nov 4, 2020 · 1 comment · Fixed by #78752
Closed

Add color diffs to htmldocck.py #78750

jyn514 opened this issue Nov 4, 2020 · 1 comment · Fixed by #78752
Labels
A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust A-testsuite Area: The testsuite used to check the correctness of rustc T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Nov 4, 2020

Currently, test failures look like this:

---- [rustdoc] rustdoc/where.rs stdout ----

error: htmldocck failed!
status: exit code: 1
command: "/usr/bin/python" "/home/joshua/rustc/src/etc/htmldocck.py" "/home/joshua/rustc/build/x86_64-unknown-linux-gnu/test/rustdoc/where" "/home/joshua/rustc/src/test/rustdoc/where.rs"
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
7: @has check failed
	`XPATH PATTERN` did not match
	// @has foo/trait.Bravo.html '//pre' "pub trait Bravo<B> where B: MyTrait"

Encountered 1 errors

This tells you what test went wrong, but not where. Why didn't the pattern match? No idea.

Instead, htmldocck could tell you exactly what went wrong:

diff

I hacked this together with some scripts, I'll see about turning it into something maintainable. Giant thank you to @Nemo157 for the help!

Originally posted by @jyn514 in #77820 (comment)

@jyn514 jyn514 added A-testsuite Area: The testsuite used to check the correctness of rustc T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust labels Nov 4, 2020
@jyn514
Copy link
Member Author

jyn514 commented Nov 4, 2020

So I don't lose it, these are the hacky scripts:

./x.py test src/test/rustdoc 2>&1 | grep '^    \[rustdoc\] ' | awk '{print $2}' | xargs printf "src/test/%s\n" | xargs -n1 diff-toolchain nightly stage1 >differences.log

where diff-toolchain is

#!/bin/sh

set -eu

if ! [ $# = 3 ]; then
	echo "usage: $0 <before> <after> <file>"
	exit 1
fi

before=$1
after=$2
file="$3"

rustdoc +$before "$file"
tidy-rustdoc doc doc-$before

rustdoc +$after "$file"
tidy-rustdoc doc doc-$after

diff -ur doc-$before doc-$after | delta

and tidy-rustdoc is Nemo157/dotfiles@0a3f39e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new or seasoned contributors to Rust A-testsuite Area: The testsuite used to check the correctness of rustc T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant