Skip to content
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

debuginfo-gdb test failures #39838

Closed
amboar opened this issue Feb 15, 2017 · 4 comments
Closed

debuginfo-gdb test failures #39838

amboar opened this issue Feb 15, 2017 · 4 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc

Comments

@amboar
Copy link

amboar commented Feb 15, 2017

Recently I started looking at issues with the Rust test suite on powerpc64le as part of an effort to package Rust for Debian on POWER. I'm using 81bd267 as the basis for my testing, which contains the resolution for #39522, but I still see a large number of failures. I'm testing on Ubuntu Yakkety (16.10), both on powerpc64le and x86_64.

I made a couple of comments on #39522, but I have created a new issue to track my problem as I don't want to hijack a closed issue.

On Ubuntu Yakkety with a clean build of rust at 81bd267, invoking ./x.py test src/test/debuginfo/ gives me the output gdb-ubuntu-rust-debuginfo.txt, which has the summary test result: FAILED. 54 passed; 40 failed; 13 ignored; 0 measured.

Yakkety's gdb reports:

$ /usr/bin/gdb --version
GNU gdb (Ubuntu 7.11.90.20161005-0ubuntu1) 7.11.90.20161005-git

Given the issues with different gdb versions as outlined in #39522, I figured I'd try building gdb from the tip of binutils-gdb master, which at the time was commit 10ddfe62f8979cfe380b07c4f827e72681cc612a:

$ /usr/local/bin/gdb --version
GNU gdb (GDB) 7.12.50.20170213-git

This was built with ./configure --with-python=python3, as is done for Ubuntu (though with many more configure options in Ubuntu's case).

Using my own gdb build I get the output gdb-master-rust-debuginfo.txt and a result summary of test result: FAILED. 53 passed; 51 failed; 3 ignored; 0 measured. Presumably the tests ignored by the patch for #39522 with gdb 7.11.90 are now functional as we have 10 less tests ignored.

However, the plot thickened before I realised that Ubuntu built gdb with Python support, as building a gdb with ./configure && make gave me a binary that passed many more debuginfo tests. After jumping through several hoops I found I could simulate a lack of Python support in gdb by breaking a part of the Rust source tree with mv -f src/etc/debugger_pretty_printers_common.py{,.disabled} && touch src/etc/debugger_pretty_printers_common.py. With this configuration, for both the stock Ubuntu gdb and my custom build, I now get the following logs:

gdb-ubuntu-rust-debuginfo-no-pp.txt

test result: FAILED. 90 passed; 4 failed; 13 ignored; 0 measured

gdb-master-rust-debuginfo-no-pp.txt:

test result: FAILED. 98 passed; 6 failed; 3 ignored; 0 measured

This means one of two things

  1. The gdbr-check annotations in the tests are out of sync with the pretty printer scripts, and the tests are expecting the wrong output. If this is the case, I have a commit at amboar/rust@67bffe3 which makes the expectations match the output. This commit was mechanically generated and the script used is included in the commit message.
  2. Alternatively, gdb is loading the pretty printer scripts when it shouldn't be, and this is negatively affecting the test results.

Miscellaneous testing gotchas:

  1. Rust caches the test results and won't re-run tests that succeeded previous: need to rm -rf ./build/x86_64-unknown-linux-gnu/test/debuginfo/*
  2. Changing the gdb invoked by the test suite: Use sed -ri '/CFG_GDB/s|/usr/bin/gdb|/usr/local/bin/gdb|' config.mk, and switch the search and replace patterns around as necessary
  3. Build gdb with Python support
@michaelwoerister michaelwoerister added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc labels Feb 15, 2017
@michaelwoerister
Copy link
Member

Thanks for the detailed investigation and report!

amboar added a commit to amboar/rust that referenced this issue Mar 8, 2017
This was a largely automated process, driven by the hack of a shell
script below.  The process to generate the patch was to repeatedly run
the script until the changes reached a fixed-point.

```bash

set -euo pipefail

O=$(mktemp)
./x.py test src/test/debuginfo 2>&1 | tee $O || true

awk '
function escape_pattern(pat,   safe) {
  safe = pat
  gsub(/[][^$.*?+{}\\()|]/, "\\\\&", safe)
  return safe
}

BEGIN { p = 0; n = 0; }

/---- \[debuginfo-gdb\]/ {
	if (p == 1) {
		printf("%s|%s|%s\n", src, error, expected);
	}
	src = $3;
	p = 1;
	n = 0;
	name = "";
}

n == 1 && $0 ~ name {
	expected = $0;
	n = 0;
}

/error: line not found in debugger output/ {
	error = substr($0,43);
	split(error, pieces);
	name = escape_pattern(pieces[1]);
	print "Found " name " in: " $0 > "/dev/stderr"
	n = 1;
}

END { printf("%s|%s|%s\n", src, error, expected); }
' $O |
while read l; do
	SRC="$(echo "$l" | cut -d'|' -f1 | sed 's/debuginfo-gdb/debuginfo/')"
	ERR="$(echo "$l" | cut -d'|' -f2)"
	V="$(echo "$ERR" | cut -d' ' -f1 | sed 's/\$/\\$/g')"
	EX="$(echo "$l" | cut -d'|' -f3)"
	if echo "$EX" | grep '^\$' > /dev/null; then
		echo $SRC
		sed -ri '/\/\/ gdbr-check:'"$V"' /s|(// gdbr-check:).*|\1'"$EX"'|' src/test/$SRC
	else
		# this is a bit questionable
		EX="$(echo "$l" | cut -d'|' -f2)"
		sed -ri '/\/\/ gdbr-check:'"$V"' /s|(// gdbr-check:).*|\1'"$EX"'|' src/test/$SRC
		echo $SRC: Failed to patch with: $l
	fi
done

echo $O
```

Fixes: rust-lang#39838
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
@nodakai
Copy link
Contributor

nodakai commented May 12, 2017

Does the fix #41877 work for you?

@amboar
Copy link
Author

amboar commented May 12, 2017

@nodakai I'll test as soon as I get an opportunity. Thanks for the prompt!

@amboar
Copy link
Author

amboar commented Jun 20, 2017

@nodakai testing against 554c685 I no-longer see the failures in either release or debug builds:

test result: ok. 105 passed; 0 failed; 3 ignored; 0 measured; 0 filtered out

Closing as a consequence!

@amboar amboar closed this as completed Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-testsuite Area: The testsuite used to check the correctness of rustc
Projects
None yet
Development

No branches or pull requests

3 participants