Skip to content

Commit

Permalink
Auto merge of #62723 - Mark-Simulacrum:rollup-vjdzlam, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Rollup of 6 pull requests

Successful merges:

 - #62666 (Cancel unemitted diagnostics during error recovery)
 - #62683 (Chapter for `param_attrs`)
 - #62693 (ci: Remove Travis/AppVeyor configuration)
 - #62702 (normalize use of backticks in compiler messages for libsyntax_ext)
 - #62703 (normalize use of backticks in compiler messages for libsyntax/parse)
 - #62722 (ci: Bump time limit of tools builder on PRs)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jul 16, 2019
2 parents d36b7f6 + 51ca50e commit 96234d5
Show file tree
Hide file tree
Showing 31 changed files with 63 additions and 257 deletions.
1 change: 1 addition & 0 deletions .azure-pipelines/pr.yml
Expand Up @@ -21,6 +21,7 @@ jobs:
IMAGE: mingw-check

- job: LinuxTools
timeoutInMinutes: 600
pool:
vmImage: ubuntu-16.04
steps:
Expand Down
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

9 changes: 0 additions & 9 deletions appveyor.yml

This file was deleted.

5 changes: 0 additions & 5 deletions src/bootstrap/check.rs
Expand Up @@ -50,7 +50,6 @@ impl Step for Std {
let mut cargo = builder.cargo(compiler, Mode::Std, target, cargo_subcommand(builder.kind));
std_cargo(builder, &compiler, target, &mut cargo);

let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage));
builder.info(&format!("Checking std artifacts ({} -> {})", &compiler.host, target));
run_cargo(builder,
&mut cargo,
Expand Down Expand Up @@ -99,7 +98,6 @@ impl Step for Rustc {
cargo_subcommand(builder.kind));
rustc_cargo(builder, &mut cargo);

let _folder = builder.fold_output(|| format!("stage{}-rustc", compiler.stage));
builder.info(&format!("Checking compiler artifacts ({} -> {})", &compiler.host, target));
run_cargo(builder,
&mut cargo,
Expand Down Expand Up @@ -153,7 +151,6 @@ impl Step for CodegenBackend {

// We won't build LLVM if it's not available, as it shouldn't affect `check`.

let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
run_cargo(builder,
&mut cargo,
args(builder.kind),
Expand Down Expand Up @@ -190,7 +187,6 @@ impl Step for Test {
let mut cargo = builder.cargo(compiler, Mode::Test, target, cargo_subcommand(builder.kind));
test_cargo(builder, &compiler, target, &mut cargo);

let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage));
builder.info(&format!("Checking test artifacts ({} -> {})", &compiler.host, target));
run_cargo(builder,
&mut cargo,
Expand Down Expand Up @@ -239,7 +235,6 @@ impl Step for Rustdoc {
SourceType::InTree,
&[]);

let _folder = builder.fold_output(|| format!("stage{}-rustdoc", compiler.stage));
println!("Checking rustdoc artifacts ({} -> {})", &compiler.host, target);
run_cargo(builder,
&mut cargo,
Expand Down
4 changes: 0 additions & 4 deletions src/bootstrap/compile.rs
Expand Up @@ -95,7 +95,6 @@ impl Step for Std {
let mut cargo = builder.cargo(compiler, Mode::Std, target, "build");
std_cargo(builder, &compiler, target, &mut cargo);

let _folder = builder.fold_output(|| format!("stage{}-std", compiler.stage));
builder.info(&format!("Building stage{} std artifacts ({} -> {})", compiler.stage,
&compiler.host, target));
run_cargo(builder,
Expand Down Expand Up @@ -422,7 +421,6 @@ impl Step for Test {
let mut cargo = builder.cargo(compiler, Mode::Test, target, "build");
test_cargo(builder, &compiler, target, &mut cargo);

let _folder = builder.fold_output(|| format!("stage{}-test", compiler.stage));
builder.info(&format!("Building stage{} test artifacts ({} -> {})", compiler.stage,
&compiler.host, target));
run_cargo(builder,
Expand Down Expand Up @@ -555,7 +553,6 @@ impl Step for Rustc {
let mut cargo = builder.cargo(compiler, Mode::Rustc, target, "build");
rustc_cargo(builder, &mut cargo);

let _folder = builder.fold_output(|| format!("stage{}-rustc", compiler.stage));
builder.info(&format!("Building stage{} compiler artifacts ({} -> {})",
compiler.stage, &compiler.host, target));
run_cargo(builder,
Expand Down Expand Up @@ -710,7 +707,6 @@ impl Step for CodegenBackend {

let tmp_stamp = out_dir.join(".tmp.stamp");

let _folder = builder.fold_output(|| format!("stage{}-rustc_codegen_llvm", compiler.stage));
let files = run_cargo(builder,
cargo.arg("--features").arg(features),
vec![],
Expand Down
15 changes: 1 addition & 14 deletions src/bootstrap/lib.rs
Expand Up @@ -128,7 +128,7 @@ use build_helper::{
};
use filetime::FileTime;

use crate::util::{exe, libdir, OutputFolder, CiEnv};
use crate::util::{exe, libdir, CiEnv};

mod cc_detect;
mod channel;
Expand Down Expand Up @@ -1092,19 +1092,6 @@ impl Build {
}
}

/// Fold the output of the commands after this method into a group. The fold
/// ends when the returned object is dropped. Folding can only be used in
/// the Travis CI environment.
pub fn fold_output<D, F>(&self, name: F) -> Option<OutputFolder>
where D: Into<String>, F: FnOnce() -> D
{
if !self.config.dry_run && self.ci_env == CiEnv::Travis {
Some(OutputFolder::new(name().into()))
} else {
None
}
}

/// Updates the actual toolstate of a tool.
///
/// The toolstates are saved to the file specified by the key
Expand Down
3 changes: 0 additions & 3 deletions src/bootstrap/native.rs
Expand Up @@ -104,7 +104,6 @@ impl Step for Llvm {
}
}

let _folder = builder.fold_output(|| "llvm");
let descriptor = if emscripten { "Emscripten " } else { "" };
builder.info(&format!("Building {}LLVM for {}", descriptor, target));
let _time = util::timeit(&builder);
Expand Down Expand Up @@ -493,7 +492,6 @@ impl Step for Lld {
return out_dir
}

let _folder = builder.fold_output(|| "lld");
builder.info(&format!("Building LLD for {}", target));
let _time = util::timeit(&builder);
t!(fs::create_dir_all(&out_dir));
Expand Down Expand Up @@ -560,7 +558,6 @@ impl Step for TestHelpers {
return
}

let _folder = builder.fold_output(|| "build_test_helpers");
builder.info("Building test helpers");
t!(fs::create_dir_all(&dst));
let mut cfg = cc::Build::new();
Expand Down
15 changes: 0 additions & 15 deletions src/bootstrap/test.rs
Expand Up @@ -713,7 +713,6 @@ impl Step for Tidy {
cmd.arg("--verbose");
}

let _folder = builder.fold_output(|| "tidy");
builder.info("tidy check");
try_run(builder, &mut cmd);
}
Expand Down Expand Up @@ -1310,7 +1309,6 @@ impl Step for Compiletest {

builder.ci_env.force_coloring_in_ci(&mut cmd);

let _folder = builder.fold_output(|| format!("test_{}", suite));
builder.info(&format!(
"Check compiletest suite={} mode={} ({} -> {})",
suite, mode, &compiler.host, target
Expand All @@ -1320,7 +1318,6 @@ impl Step for Compiletest {

if let Some(compare_mode) = compare_mode {
cmd.arg("--compare-mode").arg(compare_mode);
let _folder = builder.fold_output(|| format!("test_{}_{}", suite, compare_mode));
builder.info(&format!(
"Check compiletest suite={} mode={} compare_mode={} ({} -> {})",
suite, mode, compare_mode, &compiler.host, target
Expand Down Expand Up @@ -1364,7 +1361,6 @@ impl Step for DocTest {
// tests for all files that end in `*.md`
let mut stack = vec![builder.src.join(self.path)];
let _time = util::timeit(&builder);
let _folder = builder.fold_output(|| format!("test_{}", self.name));

let mut files = Vec::new();
while let Some(p) = stack.pop() {
Expand Down Expand Up @@ -1495,7 +1491,6 @@ impl Step for ErrorIndex {
.env("CFG_BUILD", &builder.config.build)
.env("RUSTC_ERROR_METADATA_DST", builder.extended_error_dir());

let _folder = builder.fold_output(|| "test_error_index");
builder.info(&format!("Testing error-index stage{}", compiler.stage));
let _time = util::timeit(&builder);
builder.run(&mut tool);
Expand Down Expand Up @@ -1819,14 +1814,6 @@ impl Step for Crate {
);
}

let _folder = builder.fold_output(|| {
format!(
"{}_stage{}-{}",
test_kind.subcommand(),
compiler.stage,
krate
)
});
builder.info(&format!(
"{} {} stage{} ({} -> {})",
test_kind, krate, compiler.stage, &compiler.host, target
Expand Down Expand Up @@ -1894,8 +1881,6 @@ impl Step for CrateRustdoc {
cargo.arg("--quiet");
}

let _folder = builder
.fold_output(|| format!("{}_stage{}-rustdoc", test_kind.subcommand(), compiler.stage));
builder.info(&format!(
"{} rustdoc stage{} ({} -> {})",
test_kind, compiler.stage, &compiler.host, target
Expand Down
2 changes: 0 additions & 2 deletions src/bootstrap/tool.rs
Expand Up @@ -74,7 +74,6 @@ impl Step for ToolBuild {
&self.extra_features,
);

let _folder = builder.fold_output(|| format!("stage{}-{}", compiler.stage, tool));
builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target));
let mut duplicates = Vec::new();
let is_expected = compile::stream_cargo(builder, &mut cargo, vec![], &mut |msg| {
Expand Down Expand Up @@ -509,7 +508,6 @@ impl Step for Rustdoc {
&[],
);

let _folder = builder.fold_output(|| format!("stage{}-rustdoc", target_compiler.stage));
builder.info(&format!("Building rustdoc for stage{} ({})",
target_compiler.stage, target_compiler.host));
builder.run(&mut cargo);
Expand Down
76 changes: 3 additions & 73 deletions src/bootstrap/util.rs
Expand Up @@ -6,10 +6,10 @@
use std::env;
use std::str;
use std::fs;
use std::io::{self, Write};
use std::io;
use std::path::{Path, PathBuf};
use std::process::Command;
use std::time::{SystemTime, Instant};
use std::time::Instant;

use build_helper::t;

Expand Down Expand Up @@ -254,90 +254,20 @@ pub fn symlink_dir(config: &Config, src: &Path, dest: &Path) -> io::Result<()> {
}
}

/// An RAII structure that indicates all output until this instance is dropped
/// is part of the same group.
///
/// On Travis CI, these output will be folded by default, together with the
/// elapsed time in this block. This reduces noise from unnecessary logs,
/// allowing developers to quickly identify the error.
///
/// Travis CI supports folding by printing `travis_fold:start:<name>` and
/// `travis_fold:end:<name>` around the block. Time elapsed is recognized
/// similarly with `travis_time:[start|end]:<name>`. These are undocumented, but
/// can easily be deduced from source code of the [Travis build commands].
///
/// [Travis build commands]:
/// https://github.com/travis-ci/travis-build/blob/f603c0089/lib/travis/build/templates/header.sh
pub struct OutputFolder {
name: String,
start_time: SystemTime, // we need SystemTime to get the UNIX timestamp.
}

impl OutputFolder {
/// Creates a new output folder with the given group name.
pub fn new(name: String) -> OutputFolder {
// "\r" moves the cursor to the beginning of the line, and "\x1b[0K" is
// the ANSI escape code to clear from the cursor to end of line.
// Travis seems to have trouble when _not_ using "\r\x1b[0K", that will
// randomly put lines to the top of the webpage.
print!("travis_fold:start:{0}\r\x1b[0Ktravis_time:start:{0}\r\x1b[0K", name);
OutputFolder {
name,
start_time: SystemTime::now(),
}
}
}

impl Drop for OutputFolder {
fn drop(&mut self) {
use std::time::*;
use std::u64;

fn to_nanos(duration: Result<Duration, SystemTimeError>) -> u64 {
match duration {
Ok(d) => d.as_secs() * 1_000_000_000 + d.subsec_nanos() as u64,
Err(_) => u64::MAX,
}
}

let end_time = SystemTime::now();
let duration = end_time.duration_since(self.start_time);
let start = self.start_time.duration_since(UNIX_EPOCH);
let finish = end_time.duration_since(UNIX_EPOCH);
println!(
"travis_fold:end:{0}\r\x1b[0K\n\
travis_time:end:{0}:start={1},finish={2},duration={3}\r\x1b[0K",
self.name,
to_nanos(start),
to_nanos(finish),
to_nanos(duration)
);
io::stdout().flush().unwrap();
}
}

/// The CI environment rustbuild is running in. This mainly affects how the logs
/// are printed.
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum CiEnv {
/// Not a CI environment.
None,
/// The Travis CI environment, for Linux (including Docker) and macOS builds.
Travis,
/// The AppVeyor environment, for Windows builds.
AppVeyor,
/// The Azure Pipelines environment, for Linux (including Docker), Windows, and macOS builds.
AzurePipelines,
}

impl CiEnv {
/// Obtains the current CI environment.
pub fn current() -> CiEnv {
if env::var("TRAVIS").ok().map_or(false, |e| &*e == "true") {
CiEnv::Travis
} else if env::var("APPVEYOR").ok().map_or(false, |e| &*e == "True") {
CiEnv::AppVeyor
} else if env::var("TF_BUILD").ok().map_or(false, |e| &*e == "True") {
if env::var("TF_BUILD").ok().map_or(false, |e| &*e == "True") {
CiEnv::AzurePipelines
} else {
CiEnv::None
Expand Down
2 changes: 1 addition & 1 deletion src/ci/docker/README.md
Expand Up @@ -20,7 +20,7 @@ Images will output artifacts in an `obj` dir at the root of a repository.

- Each directory, excluding `scripts` and `disabled`, corresponds to a docker image
- `scripts` contains files shared by docker images
- `disabled` contains images that are not built on travis
- `disabled` contains images that are not built on CI

## Docker Toolbox on Windows

Expand Down
9 changes: 0 additions & 9 deletions src/ci/docker/run.sh
Expand Up @@ -17,9 +17,6 @@ dist=$objdir/build/dist

source "$ci_dir/shared.sh"

travis_fold start build_docker
travis_time_start

if [ -f "$docker_dir/$image/Dockerfile" ]; then
if [ "$CI" != "" ]; then
hash_key=/tmp/.docker-hash-key.txt
Expand Down Expand Up @@ -94,7 +91,6 @@ elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
echo Cannot run disabled images on CI!
exit 1
fi
# retry messes with the pipe from tar to docker. Not needed on non-travis
# Transform changes the context of disabled Dockerfiles to match the enabled ones
tar --transform 's#^./disabled/#./#' -C $docker_dir -c . | docker \
build \
Expand All @@ -107,9 +103,6 @@ else
exit 1
fi

travis_fold end build_docker
travis_time_finish

mkdir -p $HOME/.cargo
mkdir -p $objdir/tmp
mkdir -p $objdir/cores
Expand Down Expand Up @@ -144,8 +137,6 @@ exec docker \
--env DEPLOY_ALT \
--env LOCAL_USER_ID=`id -u` \
--env CI \
--env TRAVIS \
--env TRAVIS_BRANCH \
--env TF_BUILD \
--env BUILD_SOURCEBRANCHNAME \
--env TOOLSTATE_REPO_ACCESS_TOKEN \
Expand Down

0 comments on commit 96234d5

Please sign in to comment.