about summary refs log tree commit diff
path: root/src/tools/compiletest
AgeCommit message (Collapse)AuthorLines
2017-11-22Rollup merge of #46052 - oli-obk:rendered_diagnostics_in_json, r=petrochenkovkennytm-4/+14
Include rendered diagnostic in json r? @petrochenkov
2017-11-20Address PR commentsOliver Schneider-1/+5
2017-11-20Include rendered diagnostic in jsonOliver Schneider-4/+10
2017-11-20Auto merge of #45905 - alexcrichton:add-wasm-target, r=aturonbors-4/+33
std: Add a new wasm32-unknown-unknown target This commit adds a new target to the compiler: wasm32-unknown-unknown. This target is a reimagining of what it looks like to generate WebAssembly code from Rust. Instead of using Emscripten which can bring with it a weighty runtime this instead is a target which uses only the LLVM backend for WebAssembly and a "custom linker" for now which will hopefully one day be direct calls to lld. Notable features of this target include: * There is zero runtime footprint. The target assumes nothing exists other than the wasm32 instruction set. * There is zero toolchain footprint beyond adding the target. No custom linker is needed, rustc contains everything. * Very small wasm modules can be generated directly from Rust code using this target. * Most of the standard library is stubbed out to return an error, but anything related to allocation works (aka `HashMap`, `Vec`, etc). * Naturally, any `#[no_std]` crate should be 100% compatible with this new target. This target is currently somewhat janky due to how linking works. The "linking" is currently unconditional whole program LTO (aka LLVM is being used as a linker). Naturally that means compiling programs is pretty slow! Eventually though this target should have a linker. This target is also intended to be quite experimental. I'm hoping that this can act as a catalyst for further experimentation in Rust with WebAssembly. Breaking changes are very likely to land to this target, so it's not recommended to rely on it in any critical capacity yet. We'll let you know when it's "production ready". ### Building yourself First you'll need to configure the build of LLVM and enable this target ``` $ ./configure --target=wasm32-unknown-unknown --set llvm.experimental-targets=WebAssembly ``` Next you'll want to remove any previously compiled LLVM as it needs to be rebuilt with WebAssembly support. You can do that with: ``` $ rm -rf build ``` And then you're good to go! A `./x.py build` should give you a rustc with the appropriate libstd target. ### Test support Currently testing-wise this target is looking pretty good but isn't complete. I've got almost the entire `run-pass` test suite working with this target (lots of tests ignored, but many passing as well). The `core` test suite is [still getting LLVM bugs fixed](https://reviews.llvm.org/D39866) to get that working and will take some time. Relatively simple programs all seem to work though! In general I've only tested this with a local fork that makes use of LLVM 5 rather than our current LLVM 4 on master. The LLVM 4 WebAssembly backend AFAIK isn't broken per se but is likely missing bug fixes available on LLVM 5. I'm hoping though that we can decouple the LLVM 5 upgrade and adding this wasm target! ### But the modules generated are huge! It's worth nothing that you may not immediately see the "smallest possible wasm module" for the input you feed to rustc. For various reasons it's very difficult to get rid of the final "bloat" in vanilla rustc (again, a real linker should fix all this). For now what you'll have to do is: cargo install --git https://github.com/alexcrichton/wasm-gc wasm-gc foo.wasm bar.wasm And then `bar.wasm` should be the smallest we can get it! --- In any case for now I'd love feedback on this, particularly on the various integration points if you've got better ideas of how to approach them!
2017-11-19std: Add a new wasm32-unknown-unknown targetAlex Crichton-4/+33
This commit adds a new target to the compiler: wasm32-unknown-unknown. This target is a reimagining of what it looks like to generate WebAssembly code from Rust. Instead of using Emscripten which can bring with it a weighty runtime this instead is a target which uses only the LLVM backend for WebAssembly and a "custom linker" for now which will hopefully one day be direct calls to lld. Notable features of this target include: * There is zero runtime footprint. The target assumes nothing exists other than the wasm32 instruction set. * There is zero toolchain footprint beyond adding the target. No custom linker is needed, rustc contains everything. * Very small wasm modules can be generated directly from Rust code using this target. * Most of the standard library is stubbed out to return an error, but anything related to allocation works (aka `HashMap`, `Vec`, etc). * Naturally, any `#[no_std]` crate should be 100% compatible with this new target. This target is currently somewhat janky due to how linking works. The "linking" is currently unconditional whole program LTO (aka LLVM is being used as a linker). Naturally that means compiling programs is pretty slow! Eventually though this target should have a linker. This target is also intended to be quite experimental. I'm hoping that this can act as a catalyst for further experimentation in Rust with WebAssembly. Breaking changes are very likely to land to this target, so it's not recommended to rely on it in any critical capacity yet. We'll let you know when it's "production ready". --- Currently testing-wise this target is looking pretty good but isn't complete. I've got almost the entire `run-pass` test suite working with this target (lots of tests ignored, but many passing as well). The `core` test suite is still getting LLVM bugs fixed to get that working and will take some time. Relatively simple programs all seem to work though! --- It's worth nothing that you may not immediately see the "smallest possible wasm module" for the input you feed to rustc. For various reasons it's very difficult to get rid of the final "bloat" in vanilla rustc (again, a real linker should fix all this). For now what you'll have to do is: cargo install --git https://github.com/alexcrichton/wasm-gc wasm-gc foo.wasm bar.wasm And then `bar.wasm` should be the smallest we can get it! --- In any case for now I'd love feedback on this, particularly on the various integration points if you've got better ideas of how to approach them!
2017-11-17Auto merge of #46004 - michaelwoerister:cached-mir-wip-3, r=nikomatsakisbors-0/+1
incr.comp.: Implement query result cache and use it to cache type checking tables. This is a spike implementation of caching more than LLVM IR and object files when doing incremental compilation. At the moment, only the `typeck_tables_of` query is cached but MIR and borrow-check will follow shortly. The feature is activated by running with `-Zincremental-queries` in addition to `-Zincremental`, it is not yet active by default. r? @nikomatsakis
2017-11-15Allow minimum system LLVM version in testsTom Tromey-0/+8
This adds a "min-system-llvm-version" directive, so that a test can indicate that it will either work with rust-llvm or with some minimal system LLVM. This makes it simpler to write a test that requires an LLVM patch that landed upstream and was then backported to rust-llvm.
2017-11-14incr.comp.: Cache TypeckTables and add -Zincremental-queries flag.Michael Woerister-1/+2
2017-11-13Rollup merge of #45917 - ollie27:compiletest_stamp, r=alexcrichtonkennytm-0/+5
compiletest: Fix a couple of test re-run issues * Re-run rustdoc tests if rustdoc or htmldocck.py was updated. * Put stamp files in the correct subdirectories to avoid clashes when the file names match but the subdirectory doesn't.
2017-11-10compiletest: Fix a couple of test re-run issuesOliver Middleton-0/+5
* Re-run rustdoc tests if rustdoc or htmldocck.py was updated. * Put stamp files in the correct subdirectories to avoid clashes when the file names match but the subdirectory doesn't.
2017-11-10Fix test case header parsing code in presence of multiple revisions.Michael Woerister-10/+11
The previous code would parse the TestProps, and then parse them again with a revision set, adding some elements (like aux_builds) a second time to the existing TestProps.
2017-11-10Rollup merge of #45783 - kennytm:compiler-test-fixes, r=alexcrichtonkennytm-7/+300
Miscellaneous changes for CI, Docker and compiletest. This PR contains 7 independent commits that improves interaction with CI, Docker and compiletest. 1. a4e5c91cb8 — Forces a newline every 100 dots when testing in quiet mode. Prevents spurious timeouts when abusing the CI to test Android jobs. 2. 1b5aaf22e8 — Use vault.centos.org for dist-powerpc64le-linux, see #45744. 3. 33400fbbcd — Modify `src/ci/docker/run.sh` so that the docker images can be run from Docker Toolbox for Windows on Windows 7. I haven't checked the behavior of the newer Docker for Windows on Windows 10. Also, "can run" does not mean all the test can pass successfully (the UDP tests failed last time I checked) 4. d517668a08 — Don't emit a real warning the linker segfault, which affects UI tests like https://github.com/rust-lang/rust/pull/45489#issuecomment-340134944. Log it instead. 5. 51e2247948 — During run-pass, trim the output if stdout/stderr exceeds 416 KB (top 160 KB + bottom 256 KB). This is an attempt to avoid spurious failures like https://github.com/rust-lang/rust/pull/45384#issuecomment-341755788 6. 9cfdabaf3c — Force `gem update --system` before deploy. This is an attempt to prevent spurious error #44159. 7. eee10cc482 — Tries to print the crash log on macOS on failure. This is an attempt to debug #45230.
2017-11-08Auto merge of #45867 - michaelwoerister:check-ich-stability, r=nikomatsakisbors-0/+1
incr.comp.: Verify stability of incr. comp. hashes and clean up various other things. The main contribution of this PR is that it adds the `-Z incremental-verify-ich` functionality. Normally, when the red-green tracking system determines that a certain query result has not changed, it does not re-compute the incr. comp. hash (ICH) for that query result because that hash is already known. `-Z incremental-verify-ich` tells the compiler to re-hash the query result and compare the new hash against the cached hash. This is a rather thorough way of - testing hashing implementation stability, - finding missing `[input]` annotations on `DepNodes`, and - finding missing read-edges, since both a missed read and a missing `[input]` annotation can lead to something being marked as green instead of red and thus will have a different hash than it should have. Case in point, implementing this verification logic and activating it for all `src/test/incremental` tests has revealed several such oversights, all of which are fixed in this PR. r? @nikomatsakis
2017-11-08incr.comp.: Always verify incr. comp. hashes when running incremental tests.Michael Woerister-0/+1
2017-11-06Auto merge of #45737 - oli-obk:json, r=petrochenkovbors-1/+2
Pretty print json in ui tests I found the json output in one line to not be useful for reviewing r? @petrochenkov
2017-11-06Abbreviate some stdout/stderr output in compiletest.kennytm-7/+300
This is intended to prevent the spurious OOM error from run-pass/rustc-rust-log.rs, by skipping the output in the middle when the size is over 416 KB, so that the log output will not be overwhelmed.
2017-11-05Auto merge of #45748 - petrochenkov:short, r=alexcrichtonbors-1/+15
Shorten paths to auxiliary files created by tests I'm hitting issues with long file paths to object files created by the test suite, similar to https://github.com/rust-lang/rust/issues/45103#issuecomment-335622075. If we look at the object file path in https://github.com/rust-lang/rust/issues/45103 we can see that the patch contains of few components: ``` specialization-cross-crate-defaults.stage2-x86_64-pc-windows-gnu.run-pass.libaux\specialization_cross_crate_defaults.specialization_cross_crate_defaults0.rust-cgu.o ``` => 1. specialization-cross-crate-defaults // test name, required 2. stage2 // stage disambiguator, required 3. x86_64-pc-windows-gnu // target disambiguator, required 4. run-pass // mode disambiguator, rarely required 5. libaux // suffix, can be shortened 6. specialization_cross_crate_defaults // required, there may be several libraries in the directory 7. specialization_cross_crate_defaults0 // codegen unit name, can be shortened? 8. rust-cgu // suffix, can be shortened? 9. o // object file extension This patch addresses items `4`, `5` and `8`. `libaux` is shortened to `aux`, `rust-cgu` is shortened to `rcgu`, mode disambiguator is omitted unless it's necessary (for pretty-printing and debuginfo tests, see https://github.com/rust-lang/rust/pull/24537/commits/38d26d811a44ba93637c84ce77a58af88c47f0ac) I haven't touched names of codegen units though (`specialization_cross_crate_defaults0`). Is it useful for them to have descriptive names including the crate name, as opposed to just `0` or `cgu0` or something?
2017-11-03Shorten paths to auxiliary files created by testsVadim Petrochenkov-1/+15
2017-11-03Pretty print json in ui testsOliver Schneider-1/+2
2017-11-02improve compiletest output for errors from mir-opt testsMikhail Modin-3/+16
2017-10-31runtest: fix mir directory and delete outdated MIR filesNiko Matsakis-5/+4
2017-10-25Compiletest should parse suggestions from the spansOliver Schneider-9/+10
2017-10-21Auto merge of #45391 - malbarbo:x32-1, r=alexcrichtonbors-1/+1
Update libc and some fixes for x86_64-unknown-linux-gnux32
2017-10-20Fix some tests for linux gnux32Marco A L Barbosa-1/+1
2017-10-19Auto merge of #45080 - clippered:issue-44986/fix-windows-ui-path, r=estebankbors-1/+8
Issue 44986/fix windows ui path #44968
2017-10-15Don't use target's linker when linking build scriptsVadim Petrochenkov-0/+3
2017-10-15rustbuild: Support specifying archiver and linker explicitlyVadim Petrochenkov-1/+17
2017-10-15Rollup merge of #45258 - hdhoang:master, r=alexcrichtonkennytm-2/+2
compiletest/runtest: format ErrorKind with Display The strings are nouns for the most part, so we give ErrorKind::Help a more sensible string. This reduces quote hiccups in failure output. unexpected "error": '...' ↓ unexpected error: '...'
2017-10-14Auto merge of #45162 - chrisvittal:mir-testing, r=nikomatsakisbors-32/+94
Modify MIR testing to require consecutive lines MIR testing now requires that lines be consecutive. To achive this, instead of collecting the expected mir as a string, it is now wrapped in an `ExpectedLine` enum, that is either `Elision` or `Text(T)` where `T: AsRef<str>`. `Text` lines must be matched in order, unless separated by `Elision` lines. Elision occurs lazily, that is, an Elision will skip as few lines as possible. To add a new elision marker. Put a comment containing only "..." and whitespace in any MIR testing block. Like so: ``` // fn write_42(_1: *mut i32) -> bool { // ... // bb0: { // Validate(Acquire, [_1: *mut i32]); // Validate(Release, [_1: *mut i32]); // ... // return; // } // } ``` Right now, all input before the line right after `// START` is elided, and all input after the line right before `// END` is also not tested. Many tests need to be updated. That will follow in the next commit. cc #45153 r? @nikomatsakis
2017-10-13Auto merge of #45063 - michaelwoerister:bring-back-incremental-info, ↵bors-1/+0
r=nikomatsakis incr.comp.: Bring back output of -Zincremental-info. This got kind lost during the transition to red/green. I also switched back from `eprintln!()` to `println!()` since the former never actually produced any output. I suspect this has to do with `libterm` somehow monopolizing `stderr`. r? @nikomatsakis
2017-10-13compiletest/runtest: format ErrorKind with DisplayHoàng Đức Hiếu-2/+2
The strings are nouns for the most part, so we give ErrorKind::Help a more sensible string. This reduces quote hiccups in failure output. unexpected "error": '...' ↓ unexpected error: '...'
2017-10-11Fix #44968 Windows path in UI testsclippered-1/+8
2017-10-09Modify MIR testing to require continuous linesChristopher Vittal-32/+94
Mir testing now requires that lines be continuous. To achive this, instead of collecting the expected mir as a string, it is now wrapped in an `ExpectedLine` enum, that is either `Elision` or `Text(T)` where `T: AsRef<str>`. `Text` lines must be matched in order, unless separated by `Elision` lines. Matches occur greedily, that is, an Elision will skip as few lines as possible. To add a new elision marker. Put a comment containing only "..." and whitespace in any MIR testing block. Like so: ``` // fn write_42(_1: *mut i32) -> bool { // ... // bb0: { // Validate(Acquire, [_1: *mut i32]); // Validate(Release, [_1: *mut i32]); // ... // return; // } // } ``` Right now, all input before the line right after `// START` is elided, and all input after the line right before `// END` is also not tested. Many tests need to be updated. That will follow in the next commit. cc #45153
2017-10-09New rebase for the issue #45022k0pernicus-29/+47
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
2017-10-06incr.comp.: Bring back output of -Zincremental-info.Michael Woerister-1/+0
2017-09-16fix test name being printed twice for ui testsRalf Jung-2/+0
2017-09-16compiletest: print the correct basename of the src dirRalf Jung-1/+1
2017-08-28compiletest: Change Config comments to doc commentsThomas Jespersen-39/+39
2017-08-27Additional libc cleanupTatsuyuki Ishi-0/+1
2017-08-23capture `adb shell` stdoutAndy Russell-0/+2
2017-08-22remove needless cloneAndy Russell-1/+1
2017-08-16remove procsrv moduleAndy Russell-51/+28
2017-08-16remove `extra_args` argumentAndy Russell-48/+38
2017-08-16return `Command` from make_compile_argsAndy Russell-68/+45
2017-08-16make `compose_and_run_compiler` take `Command`Andy Russell-52/+40
2017-08-16remove `working_dir` argumentAndy Russell-40/+20
2017-08-16let `compose_and_run` take a `Command`Andy Russell-68/+55
2017-08-16replace procsrv functions with `Command`Andy Russell-182/+70
2017-08-15use field init shorthand EVERYWHEREZack M. Davis-28/+28
Like #43008 (f668999), but _much more aggressive_.
2017-08-09rustc: Rearchitect lints to be emitted more eagerlyAlex Crichton-3/+15
In preparation for incremental compilation this commit refactors the lint handling infrastructure in the compiler to be more "eager" and overall more incremental-friendly. Many passes of the compiler can emit lints at various points but before this commit all lints were buffered in a table to be emitted at the very end of compilation. This commit changes these lints to be emitted immediately during compilation using pre-calculated lint level-related data structures. Linting today is split into two phases, one set of "early" lints run on the `syntax::ast` and a "late" set of lints run on the HIR. This commit moves the "early" lints to running as late as possible in compilation, just before HIR lowering. This notably means that we're catching resolve-related lints just before HIR lowering. The early linting remains a pass very similar to how it was before, maintaining context of the current lint level as it walks the tree. Post-HIR, however, linting is structured as a method on the `TyCtxt` which transitively executes a query to calculate lint levels. Each request to lint on a `TyCtxt` will query the entire crate's 'lint level data structure' and then go from there about whether the lint should be emitted or not. The query depends on the entire HIR crate but should be very quick to calculate (just a quick walk of the HIR) and the red-green system should notice that the lint level data structure rarely changes, and should hopefully preserve incrementality. Overall this resulted in a pretty big change to the test suite now that lints are emitted much earlier in compilation (on-demand vs only at the end). This in turn necessitated the addition of many `#![allow(warnings)]` directives throughout the compile-fail test suite and a number of updates to the UI test suite.