Skip to content
New issue

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

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

Already on GitHub? # to your account

Debugger pretty printer files are take into account in test execution time-stamping #45051

Merged
merged 1 commit into from
Oct 10, 2017

Conversation

k0pernicus
Copy link
Contributor

This PR is proposed to solve the issue #45022.

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nikomatsakis (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@k0pernicus k0pernicus changed the title [WiP] Test execution time-stamping should take into account debugger pretty printers [WiP] Debugger pretty printer files are take into account in test execution time-stamping Oct 5, 2017
));
}
// Relevant pretty printer files
let pretty_printer_files = [
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this part, I don't know if the more relevant way to do is to "crawl" the rust_src_path, and to check if file which contains in the name "pretty_print". Using this solution, if a member creates a new pretty printer file, this file will be automatically checked in up_to_date...
The cons of this automated solution is that we must respect title rules for the pretty printing files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The explicit list is fine for now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But could you please add lldb_batchmode.py and lldb_rust_formatters.py as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem!

@michaelwoerister
Copy link
Member

Looks good to me. You can test it as follows:

  • Run ./x.py clean to bring everything into a predictable state.
  • Run ./x.py test --stage 1 src/test/debuginfo. Most tests should be marked as ok (some are always ignored).
  • Run ./x.py test --stage 1 src/test/debuginfo again. Now all tests should be ignored.
  • Modify one of the python scripts in question.
  • Run ./x.py test --stage 1 src/test/debuginfo again. Now most tests should be ok again.

@k0pernicus
Copy link
Contributor Author

@michaelwoerister Thanks - I will make those tests after work

@shepmaster shepmaster added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 6, 2017
@k0pernicus
Copy link
Contributor Author

k0pernicus commented Oct 6, 2017

I just runned the tests, and 98/108 tests failed...

As an example, I have:

test [debuginfo-lldb] debuginfo/associated-types.rs ... FAILED
test [debuginfo-lldb] debuginfo/basic-types-globals-metadata.rs ... FAILED
test [debuginfo-lldb] debuginfo/basic-types-globals.rs ... FAILED
test [debuginfo-lldb] debuginfo/basic-types-metadata.rs ... FAILED
test [debuginfo-lldb] debuginfo/basic-types-mut-globals.rs ... FAILED
test [debuginfo-lldb] debuginfo/basic-types.rs ... FAILED
test [debuginfo-lldb] debuginfo/borrowed-basic.rs ... FAILED
test [debuginfo-lldb] debuginfo/borrowed-c-style-enum.rs ... FAILED
test [debuginfo-lldb] debuginfo/borrowed-enum.rs ... FAILED
test [debuginfo-lldb] debuginfo/borrowed-struct.rs ... FAILED
test [debuginfo-lldb] debuginfo/borrowed-tuple.rs ... FAILED
test [debuginfo-lldb] debuginfo/borrowed-unique-basic.rs ... FAILED
test [debuginfo-lldb] debuginfo/box.rs ... FAILED
test [debuginfo-lldb] debuginfo/boxed-struct.rs ... FAILED
...

This is an example of the stacktrace:

thread '[debuginfo-lldb] debuginfo/self-in-generic-default-method.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:2617:8

---- [debuginfo-lldb] debuginfo/shadowed-argument.rs stdout ----
	NOTE: compiletest thinks it is using LLDB version 900

error: Error while running LLDB
status: exit code: 1
command: "/usr/bin/python" "/Users/k0pernicus/Code/rust/src/etc/lldb_batchmode.py" "/Users/k0pernicus/Code/rust/build/x86_64-apple-darwin/test/debuginfo/shadowed-argument.stage1-x86_64-apple-darwin" "/Users/k0pernicus/Code/rust/build/x86_64-apple-darwin/test/debuginfo/shadowed-argument.debugger.script"
stdout:
------------------------------------------
LLDB batch-mode script
----------------------
Debugger commands script is '/Users/k0pernicus/Code/rust/build/x86_64-apple-darwin/test/debuginfo/shadowed-argument.debugger.script'.
Target executable is '/Users/k0pernicus/Code/rust/build/x86_64-apple-darwin/test/debuginfo/shadowed-argument.stage1-x86_64-apple-darwin'.
Current working directory is '/Users/k0pernicus/Code/rust'
Creating a target for '/Users/k0pernicus/Code/rust/build/x86_64-apple-darwin/test/debuginfo/shadowed-argument.stage1-x86_64-apple-darwin'
settings set auto-confirm true

------------------------------------------
stderr:
------------------------------------------
Traceback (most recent call last):
  File "/Users/k0pernicus/Code/rust/src/etc/lldb_batchmode.py", line 211, in <module>
    execute_command(command_interpreter, command)
  File "/Users/k0pernicus/Code/rust/src/etc/lldb_batchmode.py", line 84, in execute_command
    print(normalize_whitespace(res.GetOutput()), end='\n')
  File "/Users/k0pernicus/Code/rust/src/etc/lldb_batchmode.py", line 48, in normalize_whitespace
    return re.sub("\s+", " ", s)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 155, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or buffer

Finally, this is the end of the tests:

failures:
    [debuginfo-lldb] debuginfo/associated-types.rs
    [debuginfo-lldb] debuginfo/basic-types-globals-metadata.rs
    [debuginfo-lldb] debuginfo/basic-types-globals.rs
    [debuginfo-lldb] debuginfo/basic-types-metadata.rs
    [debuginfo-lldb] debuginfo/basic-types-mut-globals.rs
    [debuginfo-lldb] debuginfo/basic-types.rs
    [debuginfo-lldb] debuginfo/borrowed-basic.rs
    [debuginfo-lldb] debuginfo/borrowed-c-style-enum.rs
    [debuginfo-lldb] debuginfo/borrowed-enum.rs
    [debuginfo-lldb] debuginfo/borrowed-struct.rs
    [debuginfo-lldb] debuginfo/borrowed-tuple.rs
    [debuginfo-lldb] debuginfo/borrowed-unique-basic.rs
    [debuginfo-lldb] debuginfo/box.rs
    [debuginfo-lldb] debuginfo/boxed-struct.rs
    [debuginfo-lldb] debuginfo/by-value-non-immediate-argument.rs
    [debuginfo-lldb] debuginfo/by-value-self-argument-in-trait-impl.rs
    [debuginfo-lldb] debuginfo/c-style-enum-in-composite.rs
    [debuginfo-lldb] debuginfo/c-style-enum.rs
    [debuginfo-lldb] debuginfo/closure-in-generic-function.rs
    [debuginfo-lldb] debuginfo/constant-debug-locs.rs
    [debuginfo-lldb] debuginfo/constant-in-match-pattern.rs
    [debuginfo-lldb] debuginfo/cross-crate-spans.rs
    [debuginfo-lldb] debuginfo/cross-crate-type-uniquing.rs
    [debuginfo-lldb] debuginfo/destructured-fn-argument.rs
    [debuginfo-lldb] debuginfo/destructured-for-loop-variable.rs
    [debuginfo-lldb] debuginfo/destructured-local.rs
    [debuginfo-lldb] debuginfo/drop-locations.rs
    [debuginfo-lldb] debuginfo/evec-in-struct.rs
    [debuginfo-lldb] debuginfo/extern-c-fn.rs
    [debuginfo-lldb] debuginfo/function-arg-initialization.rs
    [debuginfo-lldb] debuginfo/function-arguments.rs
    [debuginfo-lldb] debuginfo/function-prologue-stepping-regular.rs
    [debuginfo-lldb] debuginfo/generic-function.rs
    [debuginfo-lldb] debuginfo/generic-functions-nested.rs
    [debuginfo-lldb] debuginfo/generic-method-on-generic-struct.rs
    [debuginfo-lldb] debuginfo/generic-static-method-on-struct-and-enum.rs
    [debuginfo-lldb] debuginfo/generic-struct-style-enum.rs
    [debuginfo-lldb] debuginfo/generic-struct.rs
    [debuginfo-lldb] debuginfo/generic-tuple-style-enum.rs
    [debuginfo-lldb] debuginfo/include_string.rs
    [debuginfo-lldb] debuginfo/issue-13213.rs
    [debuginfo-lldb] debuginfo/issue-14411.rs
    [debuginfo-lldb] debuginfo/issue-22656.rs
    [debuginfo-lldb] debuginfo/issue-7712.rs
    [debuginfo-lldb] debuginfo/lexical-scope-in-for-loop.rs
    [debuginfo-lldb] debuginfo/lexical-scope-in-if.rs
    [debuginfo-lldb] debuginfo/lexical-scope-in-match.rs
    [debuginfo-lldb] debuginfo/lexical-scope-in-parameterless-closure.rs
    [debuginfo-lldb] debuginfo/lexical-scope-in-stack-closure.rs
    [debuginfo-lldb] debuginfo/lexical-scope-in-unconditional-loop.rs
    [debuginfo-lldb] debuginfo/lexical-scope-in-unique-closure.rs
    [debuginfo-lldb] debuginfo/lexical-scope-in-while.rs
    [debuginfo-lldb] debuginfo/lexical-scope-with-macro.rs
    [debuginfo-lldb] debuginfo/lexical-scopes-in-block-expression.rs
    [debuginfo-lldb] debuginfo/macro-stepping.rs
    [debuginfo-lldb] debuginfo/method-on-enum.rs
    [debuginfo-lldb] debuginfo/method-on-generic-struct.rs
    [debuginfo-lldb] debuginfo/method-on-struct.rs
    [debuginfo-lldb] debuginfo/method-on-trait.rs
    [debuginfo-lldb] debuginfo/method-on-tuple-struct.rs
    [debuginfo-lldb] debuginfo/multi-byte-chars.rs
    [debuginfo-lldb] debuginfo/multi-cgu.rs
    [debuginfo-lldb] debuginfo/multiple-functions-equal-var-names.rs
    [debuginfo-lldb] debuginfo/multiple-functions.rs
    [debuginfo-lldb] debuginfo/name-shadowing-and-scope-nesting.rs
    [debuginfo-lldb] debuginfo/option-like-enum.rs
    [debuginfo-lldb] debuginfo/packed-struct-with-destructor.rs
    [debuginfo-lldb] debuginfo/packed-struct.rs
    [debuginfo-lldb] debuginfo/pretty-huge-vec.rs
    [debuginfo-lldb] debuginfo/pretty-std.rs
    [debuginfo-lldb] debuginfo/pretty-uninitialized-vec.rs
    [debuginfo-lldb] debuginfo/self-in-default-method.rs
    [debuginfo-lldb] debuginfo/self-in-generic-default-method.rs
    [debuginfo-lldb] debuginfo/shadowed-argument.rs
    [debuginfo-lldb] debuginfo/shadowed-variable.rs
    [debuginfo-lldb] debuginfo/simple-lexical-scope.rs
    [debuginfo-lldb] debuginfo/simple-struct.rs
    [debuginfo-lldb] debuginfo/simple-tuple.rs
    [debuginfo-lldb] debuginfo/static-method-on-struct-and-enum.rs
    [debuginfo-lldb] debuginfo/struct-in-enum.rs
    [debuginfo-lldb] debuginfo/struct-in-struct.rs
    [debuginfo-lldb] debuginfo/struct-namespace.rs
    [debuginfo-lldb] debuginfo/struct-style-enum.rs
    [debuginfo-lldb] debuginfo/struct-with-destructor.rs
    [debuginfo-lldb] debuginfo/trait-pointers.rs
    [debuginfo-lldb] debuginfo/tuple-in-struct.rs
    [debuginfo-lldb] debuginfo/tuple-in-tuple.rs
    [debuginfo-lldb] debuginfo/tuple-struct.rs
    [debuginfo-lldb] debuginfo/tuple-style-enum.rs
    [debuginfo-lldb] debuginfo/union-smoke.rs
    [debuginfo-lldb] debuginfo/unique-enum.rs
    [debuginfo-lldb] debuginfo/unreachable-locals.rs
    [debuginfo-lldb] debuginfo/unsized.rs
    [debuginfo-lldb] debuginfo/var-captured-in-nested-closure.rs
    [debuginfo-lldb] debuginfo/var-captured-in-sendable-closure.rs
    [debuginfo-lldb] debuginfo/var-captured-in-stack-closure.rs
    [debuginfo-lldb] debuginfo/vec-slices.rs
    [debuginfo-lldb] debuginfo/vec.rs

test result: FAILED. 0 passed; 98 failed; 10 ignored; 0 measured; 0 filtered out

Maybe something wrong with my configuration, no?

@nikomatsakis
Copy link
Contributor

r? @michaelwoerister

@k0pernicus
Copy link
Contributor Author

k0pernicus commented Oct 6, 2017

The error is coming from this line of code: res.GetOutput(), which returns None
For what is worth...

>>> lldb -v
lldb-900.0.45
  Swift-4.0

Update: the issue has been identified: issue #45086 - PR #45091
I will launch the tests using the solution in #45091

@k0pernicus
Copy link
Contributor Author

k0pernicus commented Oct 7, 2017

@michaelwoerister The tests to verify the PR are ok.

This is a simple trace:

# First batch
...
test result: ok. 98 passed; 0 failed; 10 ignored; 0 measured; 0 filtered out
# Second batch
...
test result: ok. 0 passed; 0 failed; 108 ignored; 0 measured; 0 filtered out
# After modifying a simple line of code in 'gdb_rust_pretty_printing.py'
...
test result: ok. 98 passed; 0 failed; 10 ignored; 0 measured; 0 filtered out

@k0pernicus k0pernicus changed the title [WiP] Debugger pretty printer files are take into account in test execution time-stamping Debugger pretty printer files are take into account in test execution time-stamping Oct 8, 2017
@michaelwoerister
Copy link
Member

@k0pernicus Looks great now, thank you!

Would you mind squashing the commits into one? Then this should be good to go.

@k0pernicus
Copy link
Contributor Author

@michaelwoerister I made a rebase of my seven commits here: f331433

@michaelwoerister
Copy link
Member

@k0pernicus GitHub still shows the other commits too, not just the squashed one.

Following the workflow described at https://github.com/servo/servo/wiki/Beginner%27s-guide-to-rebasing-and-squashing should give you the desired results (which is just a single commit on top of the current upstream/master).

Add pretty printer files into test execution time-stamping

Move find_rust_src_path() as a method for Config

Move find_rust_src_path() as a method for Config

Call find_rust_src_path() from Config

Move find_rust_src_path() from common.rs to header.rs

Add pretty printer files as relevant files to get up_to_date information

Remove dead code

Add two pretty printer files to keep a close watch on

Move find_rust_src_path() as a method for Config

Move find_rust_src_path() as a method for Config

Call find_rust_src_path() from Config

Move find_rust_src_path() from common.rs to header.rs

Remove dead code

Add two pretty printer files to keep a close watch on
@k0pernicus
Copy link
Contributor Author

@michaelwoerister Sorry for that - I forgot the -p option when pushing the changes.
It's ok now.

@michaelwoerister
Copy link
Member

Yes, that looks better! Thank you :)

@michaelwoerister
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 9, 2017

📌 Commit 53a6485 has been approved by michaelwoerister

kennytm added a commit to kennytm/rust that referenced this pull request Oct 9, 2017
Debugger pretty printer files are take into account in test execution time-stamping

This PR is proposed to solve the issue rust-lang#45022.
bors added a commit that referenced this pull request Oct 10, 2017
Rollup of 9 pull requests

- Successful merges: #44962, #45051, #45091, #45106, #45117, #45118, #45120, #45125, #45136
- Failed merges:
@bors bors merged commit 53a6485 into rust-lang:master Oct 10, 2017
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants