Commit graph

25 commits

Author SHA1 Message Date
Joshua Nelson 5a7149683f Fix tests 2021-04-17 12:13:30 -04:00
Joshua Nelson 236fe8767d Use the library name to decide whether the override should be allowed from the top-level.
If there's no library, give a hard error unless features are
unconditionally allowed with RUSTC_BOOTSTRAP=1.
2021-04-17 11:36:55 -04:00
Joshua Nelson 6d6f466351 Use the crate name instead of the package name
This doesn't work because it uses the name of the build script, which is
always build_script_build. I'm not sure what to change it to - the name
of the library crate could be different than the name of the package,
and there could be multiple different crates being compiled in the same
package.
2021-04-17 10:58:40 -04:00
Joshua Nelson 04fa2f2a3b Don't give a hard error on RUSTC_BOOTSTRAP=crate_name 2021-04-17 10:50:38 -04:00
Joshua Nelson 09677c83c2 Be less unix-centric in error messages
Co-authored-by: Eric Huss <eric@huss.org>
2021-02-24 15:50:09 -05:00
Joshua Nelson eba5419946 Update comment in build_script_env 2021-02-24 15:11:34 -05:00
Joshua Nelson e56417c8c8 Suggest RUSTC_BOOTSTRAP=crate instead of RUSTC_BOOTSTRAP=1
This was the whole point of https://github.com/rust-lang/rust/pull/77802.

- Pass `pkg.name()` to `parse()`. This can't pass the `Package` directly
  because `PackageInner` is an `Rc` and therefore not thread-safe. Note
  that `pkg_name` was previously a *description* of the package, not the
  name passed with `--crate-name`.
2021-02-24 14:43:00 -05:00
Joshua Nelson 418129daea Downgrade error to a warning when RUSTC_BOOTSTRAP is set or this is the nightly channel 2021-02-24 14:43:00 -05:00
Joshua Nelson 6c422a2c0a Restrict RUSTC_BOOTSTRAP in build.rs 2021-02-24 14:43:00 -05:00
Eric Huss 6f8c7d5a87 Normalize raw string indentation. 2020-09-26 17:59:58 -07:00
Eric Huss 4ae79d2ffd Use fs helpers instead of File functions. 2020-04-17 07:56:16 -07:00
Eric Huss 83571aee56 Minor testsuite organization. 2019-11-24 18:42:45 -08:00
Alex Crichton 9115b2c326 Extract support directory to its own crate
Extract out all our test support code to its own standalone crate so it
can be shared between multiple test suites if necessary.
2019-09-16 11:47:09 -07:00
Jethro Beekman 0e0d968825 Update #[test] attribute on all tests in the testsuite
sed -i 's/^#\[test\]/#[cargo_test]/' $(rg -l '^#\[test\]')

Manual fixes:
* proc_macro::proc_macro_doctest
2019-06-07 12:41:26 -07:00
Alex Crichton fecb724643 Format with cargo fmt 2018-12-08 03:19:47 -08:00
Dale Wijnand 04ddd4d0fc
Upgrade to Rust 2018 2018-12-06 20:18:35 +01:00
Dale Wijnand 85984a8700
Migrate from tests fom assert_that/execs to .run() 2018-08-28 15:08:12 +02:00
Dale Wijnand 16aeb0cd4f
Default test support's Execs to exit code 0 2018-08-03 07:44:42 +01:00
Dale Wijnand ca7d9ee292
Declare one-line files on one line, in test projects 2018-07-25 09:58:50 +01:00
Dale Wijnand 081e7930d2
Drop now unnecessary basic manifests 2018-07-24 16:33:55 +01:00
Dale Wijnand 43b42d6f4c
Reorganise the testsuite crate module hierarchy
* Collapse the nested cargotest::support module into the cargotest
  module (merge the mod.rs's)
* Rename the cargotest module to support
* Nest the top-level hamcrest module into support
2018-07-22 08:46:44 +01:00
Dale Wijnand 7fe2fbc8a3
Remove the argument from the project test support function
By rewriting the tests, with rerast (https://github.com/google/rerast),
to use the newly introduced "at" method.

First I added the following temporary function to cargotest::support:

    pub fn project_foo() -> ProjectBuilder {
        project("foo")
    }

Then I defined the following rewrite.rs:

    use cargotest::support::{ project, project_foo };

    fn rule1(a: &'static str) {
        replace!(project("foo") => project_foo());
        replace!(project(a) => project_foo().at(a));
    }

Then I ran rerast:

    cargo +nightly rerast --rules_file=rewrite.rs --force --targets tests --file tests/testsuite/main.rs

Finally I searched and replaced the references to project_foo with
argument-less project (a little awkardly on macOS with a git clean).

    find tests -type f -exec sed -i -e 's/project_foo/project/g' {} +
    git clean -d tests
2018-07-20 13:31:50 +01:00
Aleksey Kladov b0c181d91c Prettify rustfmted single-line strings 2018-03-14 17:48:44 -07:00
Alex Crichton 1e6828485e cargo fmt 2018-03-14 17:48:23 -07:00
André Rocha c2ff988c9f Reorganize integration tests as one crate with many modules. Issue #4867. 2018-02-21 13:33:51 -05:00
Renamed from tests/build-script-env.rs (Browse further)