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

Validate error patterns and error annotation in ui tests when present #65759

Merged
merged 8 commits into from
Nov 3, 2019

Conversation

tmiasko
Copy link
Contributor

@tmiasko tmiasko commented Oct 24, 2019

Previously, when compilation succeeded, neither error patterns nor error
annotation would be validated. Additionally, when compilation failed,
only error patterns would be validated if both error patterns and error
annotation were present.

Now both error patterns and error annotation are validated when present,
regardless of compilation status. Furthermore, for test that should run,
the error patterns are matched against executable output, which is what
some of tests already expect to happen, and when #65506 is merged even
more ui tests will.

Fixes #56277

@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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 24, 2019
@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-llvm-6.0 of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-10-24T10:14:34.1508301Z ##[command]git remote add origin https://github.com/rust-lang/rust
2019-10-24T10:14:34.1714162Z ##[command]git config gc.auto 0
2019-10-24T10:14:34.1799969Z ##[command]git config --get-all http.https://github.com/rust-lang/rust.extraheader
2019-10-24T10:14:34.1865605Z ##[command]git config --get-all http.proxy
2019-10-24T10:14:34.2007056Z ##[command]git -c http.extraheader="AUTHORIZATION: basic ***" fetch --force --tags --prune --progress --no-recurse-submodules --depth=2 origin +refs/heads/*:refs/remotes/origin/* +refs/pull/65759/merge:refs/remotes/pull/65759/merge
---
2019-10-24T11:15:27.7610069Z .................................................................................................... 1600/9241
2019-10-24T11:15:33.0941228Z .................................................................................................... 1700/9241
2019-10-24T11:15:45.2442199Z .....................................................i...............i.............................. 1800/9241
2019-10-24T11:15:52.8202404Z .................................................................................................... 1900/9241
2019-10-24T11:16:06.5061096Z ...........................................iiiii.................................................... 2000/9241
2019-10-24T11:16:16.5075536Z .................................................................................................... 2200/9241
2019-10-24T11:16:18.8708227Z .................................................................................................... 2300/9241
2019-10-24T11:16:22.7135150Z .................................................................................................... 2400/9241
2019-10-24T11:16:44.8919515Z .................................................................................................... 2500/9241
---
2019-10-24T11:19:32.1833010Z ...............................................i...............i.................................... 4800/9241
2019-10-24T11:19:40.9436480Z .................................................................................................... 4900/9241
2019-10-24T11:19:49.1880050Z .................................................................................................... 5000/9241
2019-10-24T11:19:55.6908218Z .................................................................................................... 5100/9241
2019-10-24T11:20:05.2175158Z ...............................................ii.ii................................................ 5200/9241
2019-10-24T11:20:14.6198095Z .................................................................................................... 5400/9241
2019-10-24T11:20:23.7765368Z .................................................................................................... 5500/9241
2019-10-24T11:20:30.8559203Z ..............i..................................................................................... 5600/9241
2019-10-24T11:20:36.2993491Z .................................................................................................... 5700/9241
2019-10-24T11:20:36.2993491Z .................................................................................................... 5700/9241
2019-10-24T11:20:47.9270213Z .................................................................................................... 5800/9241
2019-10-24T11:20:59.2568730Z ...........ii...i..ii...........i................................................................... 5900/9241
2019-10-24T11:21:19.9692710Z .................................................................................................... 6100/9241
2019-10-24T11:21:26.1216468Z .................................................................................................... 6200/9241
2019-10-24T11:21:26.1216468Z .................................................................................................... 6200/9241
2019-10-24T11:21:39.3324862Z .................................i..ii.............................................................. 6300/9241
2019-10-24T11:21:59.4659398Z ...................................................................................................i 6500/9241
2019-10-24T11:22:01.6050647Z .................................................................................................... 6600/9241
2019-10-24T11:22:03.8299623Z ..........................................................................i......................... 6700/9241
2019-10-24T11:22:06.5286979Z .................................................................................................... 6800/9241
---
2019-10-24T11:26:27.8725589Z  finished in 5.515
2019-10-24T11:26:27.8907834Z Check compiletest suite=codegen mode=codegen (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-24T11:26:28.0490774Z 
2019-10-24T11:26:28.0491817Z running 153 tests
2019-10-24T11:26:31.0424192Z i....iii......iii..iiii...i.............................i..i..................i....i...........ii.i. 100/153
2019-10-24T11:26:32.9075430Z i..iiii..............i.........iii.i.........ii......
2019-10-24T11:26:32.9076215Z 
2019-10-24T11:26:32.9076299Z  finished in 5.016
2019-10-24T11:26:32.9286769Z Check compiletest suite=codegen-units mode=codegen-units (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-24T11:26:33.0866774Z 
---
2019-10-24T11:26:35.0588318Z  finished in 2.130
2019-10-24T11:26:35.0764738Z Check compiletest suite=assembly mode=assembly (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-24T11:26:35.2305712Z 
2019-10-24T11:26:35.2306661Z running 9 tests
2019-10-24T11:26:35.2308062Z iiiiiiiii
2019-10-24T11:26:35.2308862Z 
2019-10-24T11:26:35.2312860Z  finished in 0.154
2019-10-24T11:26:35.2515477Z Check compiletest suite=incremental mode=incremental (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-24T11:26:35.4294679Z 
---
2019-10-24T11:26:52.9642446Z  finished in 17.712
2019-10-24T11:26:52.9825151Z Check compiletest suite=debuginfo mode=debuginfo-gdb+lldb (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-24T11:26:53.1450774Z 
2019-10-24T11:26:53.1451110Z running 123 tests
2019-10-24T11:27:16.1769787Z .iiiii...i.....i..i...i..i.i.i..i.ii..i.i.....i..i....ii..........iiii..........i...ii...i.......ii. 100/123
2019-10-24T11:27:20.6121695Z i.i.i......iii.i.....ii
2019-10-24T11:27:20.6124291Z 
2019-10-24T11:27:20.6124725Z  finished in 27.629
2019-10-24T11:27:20.6133438Z Uplifting stage1 rustc (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu)
2019-10-24T11:27:20.6133832Z Copying stage2 rustc from stage1 (x86_64-unknown-linux-gnu -> x86_64-unknown-linux-gnu / x86_64-unknown-linux-gnu)
---
2019-10-24T11:28:21.0971193Z failures:
2019-10-24T11:28:21.0971220Z 
2019-10-24T11:28:21.0971465Z ---- [ui] ui-fulldeps/lint-group-plugin.rs stdout ----
2019-10-24T11:28:21.0971493Z 
2019-10-24T11:28:21.0971993Z error: /checkout/src/test/ui-fulldeps/lint-group-plugin.rs:6: unexpected warning: '6:1: 6:35: use of deprecated attribute `plugin`: compiler plugins are deprecated. See ***/pull/64675 [deprecated]'
2019-10-24T11:28:21.0972086Z error: 1 unexpected errors found, 0 expected errors not found
2019-10-24T11:28:21.0972139Z status: exit code: 0
2019-10-24T11:28:21.0972139Z status: exit code: 0
2019-10-24T11:28:21.0973436Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui-fulldeps/lint-group-plugin.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/lint-group-plugin/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/lint-group-plugin/auxiliary"
2019-10-24T11:28:21.0973566Z unexpected errors (from JSON output): [
2019-10-24T11:28:21.0973677Z         line_num: 6,
2019-10-24T11:28:21.0973720Z         kind: Some(
2019-10-24T11:28:21.0973762Z             Warning,
2019-10-24T11:28:21.0973803Z         ),
2019-10-24T11:28:21.0973803Z         ),
2019-10-24T11:28:21.0974468Z         msg: "6:1: 6:35: use of deprecated attribute `plugin`: compiler plugins are deprecated. See ***/pull/64675 [deprecated]",
2019-10-24T11:28:21.0974620Z ]
2019-10-24T11:28:21.0974648Z 
2019-10-24T11:28:21.0975010Z thread '[ui] ui-fulldeps/lint-group-plugin.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:1520:13
2019-10-24T11:28:21.0975089Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-24T11:28:21.0975089Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-10-24T11:28:21.0975123Z 
2019-10-24T11:28:21.0975350Z ---- [ui] ui-fulldeps/lint-plugin.rs stdout ----
2019-10-24T11:28:21.0975383Z 
2019-10-24T11:28:21.0975825Z error: /checkout/src/test/ui-fulldeps/lint-plugin.rs:5: unexpected warning: '5:1: 5:29: use of deprecated attribute `plugin`: compiler plugins are deprecated. See ***/pull/64675 [deprecated]'
2019-10-24T11:28:21.0975936Z error: 1 unexpected errors found, 0 expected errors not found
2019-10-24T11:28:21.0975984Z status: exit code: 0
2019-10-24T11:28:21.0975984Z status: exit code: 0
2019-10-24T11:28:21.0979028Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui-fulldeps/lint-plugin.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/lint-plugin/a" "-Crpath" "-O" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps/lint-plugin/auxiliary"
2019-10-24T11:28:21.0979323Z unexpected errors (from JSON output): [
2019-10-24T11:28:21.0979412Z         line_num: 5,
2019-10-24T11:28:21.0979444Z         kind: Some(
2019-10-24T11:28:21.0979476Z             Warning,
2019-10-24T11:28:21.0979507Z         ),
2019-10-24T11:28:21.0979507Z         ),
2019-10-24T11:28:21.0979874Z         msg: "5:1: 5:29: use of deprecated attribute `plugin`: compiler plugins are deprecated. See ***/pull/64675 [deprecated]",
2019-10-24T11:28:21.0979972Z ]
2019-10-24T11:28:21.0979999Z 
2019-10-24T11:28:21.0980231Z thread '[ui] ui-fulldeps/lint-plugin.rs' panicked at 'explicit panic', src/tools/compiletest/src/runtest.rs:1520:13
2019-10-24T11:28:21.0980260Z 
---
2019-10-24T11:28:21.0982484Z 
2019-10-24T11:28:21.0983445Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-10-24T11:28:21.0983576Z 
2019-10-24T11:28:21.0983604Z 
2019-10-24T11:28:21.0985548Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui-fulldeps" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui-fulldeps" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/usr/lib/llvm-6.0/bin/FileCheck" "--host-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -O -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--quiet" "--llvm-version" "6.0.0\n" "--system-llvm" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always"
2019-10-24T11:28:21.0985859Z 
2019-10-24T11:28:21.0985890Z 
2019-10-24T11:28:21.0985935Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-10-24T11:28:21.0986003Z Build completed unsuccessfully in 1:07:08
2019-10-24T11:28:21.0986003Z Build completed unsuccessfully in 1:07:08
2019-10-24T11:28:21.1033686Z == clock drift check ==
2019-10-24T11:28:21.1055571Z   local time: Thu Oct 24 11:28:21 UTC 2019
2019-10-24T11:28:21.3970840Z   network time: Thu, 24 Oct 2019 11:28:21 GMT
2019-10-24T11:28:21.3973167Z == end clock drift check ==
2019-10-24T11:28:22.0368835Z 
2019-10-24T11:28:22.0483846Z ##[error]Bash exited with code '1'.
2019-10-24T11:28:22.0570563Z ##[section]Starting: Checkout
2019-10-24T11:28:22.0573153Z ==============================================================================
2019-10-24T11:28:22.0573214Z Task         : Get sources
2019-10-24T11:28:22.0573428Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@petrochenkov petrochenkov self-assigned this Oct 24, 2019
@petrochenkov
Copy link
Contributor

Thanks a lot.
This PR fixes the issue #56277.

There's a similar (but opposite) issue (#55596) about //~ ERROR annotations not being required in UI tests with errors, perhaps you can look into it as well?

@@ -3137,21 +3137,24 @@ impl<'test> TestCx<'test> {
self.fatal_proc_rec("test run succeeded!", &proc_res);
}
}
if !self.props.error_patterns.is_empty() {
// "// error-pattern" comments
self.check_error_patterns(&proc_res.stderr, &proc_res);
Copy link
Contributor

Choose a reason for hiding this comment

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

It's a bit weird that this is checked in two places - first in should_run and then in !should_run below.
I think, we should run check_expected_errors and check_error_patterns together under the same conditions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, could you try to remove the !explicit && self.config.compare_mode.is_none() condition as well?
I'm not sure what will happen, but perhaps we can check annotations in those modes 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.

After fixing the first bug, i.e., no validation being performed when
compilation succeeds, some test cases started to fail because they expected
error patterns to be matched against program output.

To address that issue, in the should_run case the error patterns are matched
against the program output, and otherwise the errors patterns are matched
against compiler output as before. This is why they are checked in two places.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The explicit tests are those that use --error-format flag. They are
generally incompatible with error annotations, since there is only json error
parser. I also got two failures after removing this check, on missing-type.rs
and unused_parens_remove_json_suggestion.rs.

I am not familiar with compare mode, so I would rather not touch
self.config.compare_mode.is_none() condition either.

Copy link
Contributor

Choose a reason for hiding this comment

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

some test cases started to fail because they expected
error patterns to be matched against program output.

I see.
I'm pretty sure that was a misuse of the // error-pattern annotation.
We have a separate annotation for checking the runtime output - // check-run-results.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, right now there are only handful of test in ui that use error-pattern
for matching executable results, so they could be presumably migrated to use
check-run-results.

At the same time, the changes are party motivated as help with #65506 which
moves run-fails tests to ui. For those tests such use of error-pattern is quite
typical.

Which is why I think we should allow for such use of error-pattern, at least
until all those tests are migrated if check-run-results is preferred variant.

Copy link
Contributor

Choose a reason for hiding this comment

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

@tmiasko
Could you make an issue for migrating run-fail tests to // check-run-results and restoring the compile-time meaning of // error-pattern in them?

@petrochenkov
Copy link
Contributor

r? @petrochenkov

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 24, 2019
// "// error-pattern" comments
self.check_error_patterns(&proc_res.stderr, &proc_res);
}
if !expected_errors.is_empty() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like the removal of this condition should fix #55596.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fallout from making annotations for errors and warnings mandatory is
quite substantial, so I would rather not fix that issue in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Oct 26, 2019

📌 Commit 07283544bf5423940cf89108a0858f0eabf3896f has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 26, 2019
@bors
Copy link
Contributor

bors commented Oct 28, 2019

☔ The latest upstream changes (presumably #65885) made this pull request unmergeable. Please resolve the merge conflicts.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 28, 2019
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Oct 28, 2019

📌 Commit 88bfc2f has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 28, 2019
Centril added a commit to Centril/rust that referenced this pull request Oct 29, 2019
Validate error patterns and error annotation in ui tests when present

Previously, when compilation succeeded, neither error patterns nor error
annotation would be validated. Additionally, when compilation failed,
only error patterns would be validated if both error patterns and error
annotation were present.

Now both error patterns and error annotation are validated when present,
regardless of compilation status. Furthermore, for test that should run,
the error patterns are matched against executable output, which is what
some of tests already expect to happen, and when rust-lang#65506 is merged even
more ui tests will.

Fixes rust-lang#56277
@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 2, 2019
@bors
Copy link
Contributor

bors commented Nov 3, 2019

⌛ Testing commit 17e7cbdbdb9601b5717fdf5bc51180f4ef78dbbf with merge 8bfc5668b6f2524abfeb9f1a66ad6b0ba05c5432...

@rust-highfive
Copy link
Collaborator

The job x86_64-gnu-nopt of your PR failed (pretty log, raw log). Through arcane magic we have determined that the following fragments from the build log may contain information about the problem.

Click to expand the log.
2019-11-03T05:17:03.8943252Z ---- [ui (nll)] ui/continue-after-missing-main.rs stdout ----
2019-11-03T05:17:03.8943361Z diff of stderr:
2019-11-03T05:17:03.8943403Z 
2019-11-03T05:17:03.8943476Z 3    |
2019-11-03T05:17:03.8943530Z 4 LL | / #![allow(dead_code)]
2019-11-03T05:17:03.8943609Z 5 LL | |
2019-11-03T05:17:03.8943851Z - LL | | // error-pattern:`main` function not found in crate
2019-11-03T05:17:03.8944070Z - LL | |
2019-11-03T05:17:03.8944279Z + LL | | struct Tableau<'a, MP> {
2019-11-03T05:17:03.8944479Z + LL | |     provider: &'a MP,
2019-11-03T05:17:03.8944610Z 9 LL | |
2019-11-03T05:17:03.8944679Z 10 LL | | }
2019-11-03T05:17:03.8944743Z 
2019-11-03T05:17:03.8944773Z 
2019-11-03T05:17:03.8944773Z 
2019-11-03T05:17:03.8944861Z The actual stderr differed from the expected stderr.
2019-11-03T05:17:03.8945197Z Actual stderr saved to /checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/continue-after-missing-main.nll/continue-after-missing-main.nll.stderr
2019-11-03T05:17:03.8945495Z To update references, rerun the tests and pass the `--bless` flag
2019-11-03T05:17:03.8945776Z To only update this specific test, also pass `--test-args continue-after-missing-main.rs`
2019-11-03T05:17:03.8945903Z error: 1 errors occurred comparing output.
2019-11-03T05:17:03.8945966Z status: exit code: 1
2019-11-03T05:17:03.8945966Z status: exit code: 1
2019-11-03T05:17:03.8946771Z command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/continue-after-missing-main.rs" "-Zthreads=1" "--target=x86_64-unknown-linux-gnu" "--error-format" "json" "-Zui-testing" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/continue-after-missing-main.nll" "-Zborrowck=mir" "-Crpath" "-Cdebuginfo=0" "-Zunstable-options" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/continue-after-missing-main.nll/auxiliary" "-A" "unused"
2019-11-03T05:17:03.8947256Z ------------------------------------------
2019-11-03T05:17:03.8947320Z 
2019-11-03T05:17:03.8947545Z ------------------------------------------
2019-11-03T05:17:03.8947628Z stderr:
2019-11-03T05:17:03.8947628Z stderr:
2019-11-03T05:17:03.8947847Z ------------------------------------------
2019-11-03T05:17:03.8947945Z error[E0601]: `main` function not found in crate `continue_after_missing_main`
2019-11-03T05:17:03.8948297Z    |
2019-11-03T05:17:03.8948297Z    |
2019-11-03T05:17:03.8948383Z LL | / #![allow(dead_code)] //~ ERROR `main` function not found in crate
2019-11-03T05:17:03.8948455Z LL | |
2019-11-03T05:17:03.8949566Z LL | | struct Tableau<'a, MP> {
2019-11-03T05:17:03.8949893Z LL | |     provider: &'a MP,
2019-11-03T05:17:03.8951045Z ...  |
2019-11-03T05:17:03.8951119Z LL | |     //~^ ERROR lifetime mismatch
2019-11-03T05:17:03.8951213Z LL | | }
2019-11-03T05:17:03.8951648Z    | |_^ consider adding a `main` function to `/checkout/src/test/ui/continue-after-missing-main.rs`
2019-11-03T05:17:03.8951792Z error: aborting due to previous error
2019-11-03T05:17:03.8951859Z 
2019-11-03T05:17:03.8952141Z For more information about this error, try `rustc --explain E0601`.
2019-11-03T05:17:03.8952220Z 
---
2019-11-03T05:17:03.8977419Z thread 'main' panicked at 'Some tests failed', src/tools/compiletest/src/main.rs:537:22
2019-11-03T05:17:03.8977801Z note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
2019-11-03T05:17:03.8995595Z 
2019-11-03T05:17:03.9000940Z 
2019-11-03T05:17:03.9003361Z command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0-tools-bin/compiletest" "--compile-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib" "--run-lib-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/x86_64-unknown-linux-gnu/lib" "--rustc-path" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "--src-base" "/checkout/src/test/ui" "--build-base" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--stage-id" "stage2-x86_64-unknown-linux-gnu" "--mode" "ui" "--target" "x86_64-unknown-linux-gnu" "--host" "x86_64-unknown-linux-gnu" "--llvm-filecheck" "/checkout/obj/build/x86_64-unknown-linux-gnu/llvm/build/bin/FileCheck" "--host-rustcflags" "-Crpath -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--target-rustcflags" "-Crpath -Cdebuginfo=0 -Zunstable-options  -Lnative=/checkout/obj/build/x86_64-unknown-linux-gnu/native/rust-test-helpers" "--docck-python" "/usr/bin/python2.7" "--lldb-python" "/usr/bin/python2.7" "--gdb" "/usr/bin/gdb" "--llvm-version" "9.0.0-rust-1.40.0-dev\n" "--cc" "" "--cxx" "" "--cflags" "" "--llvm-components" "" "--llvm-cxxflags" "" "--adb-path" "adb" "--adb-test-dir" "/data/tmp/work" "--android-cross-path" "" "--color" "always" "--compare-mode" "nll"
2019-11-03T05:17:03.9003961Z 
2019-11-03T05:17:03.9003995Z 
2019-11-03T05:17:03.9006741Z failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test
2019-11-03T05:17:03.9007362Z Build completed unsuccessfully in 1:45:06
2019-11-03T05:17:03.9007362Z Build completed unsuccessfully in 1:45:06
2019-11-03T05:17:03.9061430Z == clock drift check ==
2019-11-03T05:17:03.9076086Z   local time: Sun Nov  3 05:17:03 UTC 2019
2019-11-03T05:17:04.1912082Z   network time: Sun, 03 Nov 2019 05:17:04 GMT
2019-11-03T05:17:04.1912453Z == end clock drift check ==
2019-11-03T05:17:05.5441498Z 
2019-11-03T05:17:05.5531574Z ##[error]Bash exited with code '1'.
2019-11-03T05:17:05.5577019Z ##[section]Starting: Checkout
2019-11-03T05:17:05.5579579Z ==============================================================================
2019-11-03T05:17:05.5579680Z Task         : Get sources
2019-11-03T05:17:05.5579787Z Description  : Get sources from a repository. Supports Git, TfsVC, and SVN repositories.

I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact @TimNN. (Feature Requests)

@bors
Copy link
Contributor

bors commented Nov 3, 2019

💔 Test failed - checks-azure

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 3, 2019
@petrochenkov
Copy link
Contributor

NLL versions of tests can be run by adding --compare-mode nll to the x.py command line.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 3, 2019
When both error patterns and error annotations are present in an ui
test, only error patterns are validated against the output.

Replace the error pattern with an error annotation to avoid silently
ignoring the other error annotation.
Since 8ec9d72, in the case of a local
macro expansion, the errors are now matched to macro definition
location. Update test cases accordingly.
Previously, when compilation succeeded, neither error patterns nor error
annotation would be validated. Additionally, when compilation failed,
only error patterns would be validated if both error patterns and error
annotation were present.

Now both error patterns and error annotation are validated when present,
regardless of compilation status. Furthermore, for test that should run,
the error patterns are matched against executable output, which is what
some of tests already expect to happen, and when rust-lang#65506 is merged even
more ui tests will.
The concrete type that will be too big is target dependent. Avoid
matching it in error annotation to make test work correctly across
different targets.
@tmiasko
Copy link
Contributor Author

tmiasko commented Nov 3, 2019

Amended the commit changing continue-after-missing-main.rs to additionally update nll compare output.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Nov 3, 2019

📌 Commit cfa2a26 has been approved by petrochenkov

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 3, 2019
@bors
Copy link
Contributor

bors commented Nov 3, 2019

⌛ Testing commit cfa2a26 with merge b43a682...

bors added a commit that referenced this pull request Nov 3, 2019
Validate error patterns and error annotation in ui tests when present

Previously, when compilation succeeded, neither error patterns nor error
annotation would be validated. Additionally, when compilation failed,
only error patterns would be validated if both error patterns and error
annotation were present.

Now both error patterns and error annotation are validated when present,
regardless of compilation status. Furthermore, for test that should run,
the error patterns are matched against executable output, which is what
some of tests already expect to happen, and when #65506 is merged even
more ui tests will.

Fixes #56277
@bors
Copy link
Contributor

bors commented Nov 3, 2019

☀️ Test successful - checks-azure
Approved by: petrochenkov
Pushing b43a682 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 3, 2019
@bors bors merged commit cfa2a26 into rust-lang:master Nov 3, 2019
@tmiasko tmiasko deleted the ui branch November 4, 2019 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compiletest: //~ ERROR annotations are ignored in compile-pass tests
5 participants