beta test

This commit is contained in:
Josh Stone 2019-01-09 17:11:56 -08:00
parent 4f5c2bcd74
commit d201a25c94
3 changed files with 104 additions and 133 deletions

View File

@ -1,118 +0,0 @@
From f107514aef0b25b0d959941df1e45b18a478151b Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 30 Nov 2018 15:33:40 -0800
Subject: [PATCH] Deal with EINTR in net timeout tests
We've seen sporadic QE failures in the timeout tests on this assertion:
assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
So there's an error, but not either of the expected kinds. Adding a
format to show the kind revealed `ErrorKind::Interrupted` (`EINTR`).
For the cases that were using `read`, we can just use `read_exact` to
keep trying after interruption. For those using `recv_from`, we have to
manually loop until we get a non-interrupted result.
---
src/libstd/net/tcp.rs | 10 ++++++----
src/libstd/net/udp.rs | 20 ++++++++++++++++----
src/libstd/sys/unix/ext/net.rs | 10 ++++++----
3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
index ad212a547579..be797803233a 100644
--- a/src/libstd/net/tcp.rs
+++ b/src/libstd/net/tcp.rs
@@ -1548,8 +1548,9 @@ mod tests {
let mut buf = [0; 10];
let start = Instant::now();
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
assert!(start.elapsed() > Duration::from_millis(400));
drop(listener);
}
@@ -1570,8 +1571,9 @@ mod tests {
assert_eq!(b"hello world", &buf[..]);
let start = Instant::now();
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
assert!(start.elapsed() > Duration::from_millis(400));
drop(listener);
}
diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs
index 0ebe3284b4f0..fc68abae05a0 100644
--- a/src/libstd/net/udp.rs
+++ b/src/libstd/net/udp.rs
@@ -1030,8 +1030,14 @@ mod tests {
let mut buf = [0; 10];
let start = Instant::now();
- let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ loop {
+ let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
+ if kind != ErrorKind::Interrupted {
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
+ break;
+ }
+ }
assert!(start.elapsed() > Duration::from_millis(400));
}
@@ -1049,8 +1055,14 @@ mod tests {
assert_eq!(b"hello world", &buf[..]);
let start = Instant::now();
- let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ loop {
+ let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
+ if kind != ErrorKind::Interrupted {
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
+ break;
+ }
+ }
assert!(start.elapsed() > Duration::from_millis(400));
}
diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs
index 55f43ccd7db4..737437c76b7c 100644
--- a/src/libstd/sys/unix/ext/net.rs
+++ b/src/libstd/sys/unix/ext/net.rs
@@ -1654,8 +1654,9 @@ mod test {
or_panic!(stream.set_read_timeout(Some(Duration::from_millis(1000))));
let mut buf = [0; 10];
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == io::ErrorKind::WouldBlock || kind == io::ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
}
#[test]
@@ -1675,8 +1676,9 @@ mod test {
or_panic!(stream.read(&mut buf));
assert_eq!(b"hello world", &buf[..]);
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == io::ErrorKind::WouldBlock || kind == io::ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
}
// Ensure the `set_read_timeout` and `set_write_timeout` calls return errors
--
2.19.1

View File

@ -0,0 +1,90 @@
From 72cd8aedc2901d6a6b598eadc001cc39040ae487 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Wed, 12 Dec 2018 16:51:31 -0800
Subject: [PATCH] Try to get the target triple from rustc itself
The prior method was trying to pick the triple out of the sysroot path.
A FIXME comment already notes that this doesn't work with custom
toolchains in rustup. It also fails with distro-installed toolchains,
where the sysroot may simply be `/usr`.
The output of `rustc -Vv` is a more reliable source, as it contains a
line like `host: x86_64-unknown-linux-gnu`. This should be enough to
identify the triple for any `rustc`, but just in case, the path-based
code is kept as a fallback.
---
src/loader.rs | 41 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 38 insertions(+), 3 deletions(-)
diff --git a/src/loader.rs b/src/loader.rs
index 645c95139164..fe92bef1c596 100644
--- a/src/loader.rs
+++ b/src/loader.rs
@@ -108,9 +108,33 @@ impl AnalysisLoader for CargoAnalysisLoader {
}
}
+fn extract_target_triple(sys_root_path: &Path) -> String {
+ // First try to get the triple from the rustc version output,
+ // otherwise fall back on the rustup-style toolchain path.
+ extract_rustc_host_triple()
+ .unwrap_or_else(|| extract_rustup_target_triple(sys_root_path))
+}
+
+fn extract_rustc_host_triple() -> Option<String> {
+ let rustc = env::var("RUSTC").unwrap_or(String::from("rustc"));
+ let verbose_version = Command::new(rustc)
+ .arg("--verbose")
+ .arg("--version")
+ .output()
+ .ok()
+ .and_then(|out| String::from_utf8(out.stdout).ok())?;
+
+ // Extracts the triple from a line like `host: x86_64-unknown-linux-gnu`
+ verbose_version
+ .lines()
+ .find(|line| line.starts_with("host: "))
+ .and_then(|host| host.split_whitespace().nth(1))
+ .map(String::from)
+}
+
// FIXME: This can fail when using a custom toolchain in rustup (often linked to
// `/$rust_repo/build/$target/stage2`)
-fn extract_target_triple(sys_root_path: &Path) -> String {
+fn extract_rustup_target_triple(sys_root_path: &Path) -> String {
// Extracts nightly-x86_64-pc-windows-msvc from
// $HOME/.rustup/toolchains/nightly-x86_64-pc-windows-msvc
let toolchain = sys_root_path
@@ -169,7 +193,7 @@ mod tests {
r#"C:\Users\user\.rustup\toolchains\nightly-x86_64-pc-windows-msvc"#,
);
assert_eq!(
- extract_target_triple(path),
+ extract_rustup_target_triple(path),
String::from("x86_64-pc-windows-msvc")
);
}
@@ -180,8 +204,19 @@ mod tests {
"/home/user/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu",
);
assert_eq!(
- extract_target_triple(path),
+ extract_rustup_target_triple(path),
String::from("x86_64-unknown-linux-gnu")
);
}
+
+ #[test]
+ fn target_triple() {
+ let sys_root_path = sys_root_path();
+ let target_triple = extract_target_triple(&sys_root_path);
+ let target_path = sys_root_path
+ .join("lib")
+ .join("rustlib")
+ .join(&target_triple);
+ assert!(target_path.is_dir(), "{:?} is not a directory!", target_path);
+ }
}
--
2.19.2

View File

@ -9,10 +9,10 @@
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
# or nightly wants some beta-YYYY-MM-DD
# Note that cargo matches the program version here, not its crate version.
%global bootstrap_rust 1.30.0
%global bootstrap_cargo 1.30.0
%global bootstrap_rust 1.31.1
%global bootstrap_cargo 1.31.0
%global bootstrap_channel %{bootstrap_rust}
%global bootstrap_date 2018-10-25
%global bootstrap_date 2018-12-20
# Only the specified arches will use bootstrap binaries.
#global bootstrap_arches %%{rust_arches}
@ -55,15 +55,15 @@
# Some sub-packages are versioned independently of the rust compiler and runtime itself.
# Also beware that if any of these are not changed in a version bump, then the release
# number should still increase, not be reset to 1!
%global rustc_version 1.31.1
%global cargo_version 1.31.0
%global rustc_version 1.32.0
%global cargo_version 1.32.0
%global rustfmt_version 1.0.0
%global rls_version 1.31.7
%global clippy_version 0.0.212
Name: rust
Version: %{rustc_version}
Release: 9%{?dist}
Release: 0.1.beta.12%{?dist}
Summary: The Rust Programming Language
License: (ASL 2.0 or MIT) and (BSD and MIT)
# ^ written as: (rust itself) and (bundled libraries)
@ -77,8 +77,8 @@ ExclusiveArch: %{rust_arches}
%endif
Source0: https://static.rust-lang.org/dist/%{rustc_package}.tar.xz
# https://github.com/rust-lang/rust/pull/56394
Patch1: 0001-Deal-with-EINTR-in-net-timeout-tests.patch
# https://github.com/rust-dev-tools/rls-analysis/pull/160
Patch1: 0001-Try-to-get-the-target-triple-from-rustc-itself.patch
# Get the Rust triple for any arch.
%{lua: function rust_triple(arch)
@ -345,7 +345,6 @@ A tool for formatting Rust code according to style guidelines.
%package -n rls
Summary: Rust Language Server for IDE integration
Version: %{rls_version}
Provides: rls = %{rls_version}
%if %with bundled_libgit2
Provides: bundled(libgit2) = 0.27
%endif
@ -370,7 +369,6 @@ reformatting, and code completion, and enables renaming and refactorings.
%package -n clippy
Summary: Lints to catch common mistakes and improve your Rust code
Version: %{clippy_version}
Provides: clippy = %{clippy_version}
Requires: cargo
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs
Requires: %{name}%{?_isa} = %{rustc_version}-%{release}
@ -414,15 +412,14 @@ test -f '%{local_rust_root}/bin/rustc'
%setup -q -n %{rustc_package}
pushd vendor/rls-analysis
%patch1 -p1
popd
%if "%{python}" == "python3"
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
%endif
# We're disabling jemalloc, but rust-src still wants it.
# rm -rf src/jemalloc/
%if %without bundled_llvm
rm -rf src/llvm/
%endif
@ -455,7 +452,7 @@ sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
# The configure macro will modify some autoconf-related files, which upsets
# cargo when it tries to verify checksums in those files. If we just truncate
# that file list, cargo won't have anything to complain about.
find src/vendor -name .cargo-checksum.json \
find vendor -name .cargo-checksum.json \
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
@ -501,7 +498,6 @@ export LIBSSH2_SYS_USE_PKG_CONFIG=1
%{!?with_bundled_llvm: --llvm-root=%{llvm_root} \
%{!?llvm_has_filecheck: --disable-codegen-tests} \
%{!?with_llvm_static: --enable-llvm-link-shared } } \
--disable-jemalloc \
--disable-rpath \
%{enable_debuginfo} \
--enable-extended \
@ -699,6 +695,9 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py*
%changelog
* Wed Jan 09 2019 Josh Stone <jistone@redhat.com> - 1.32.0-0.1.beta.12
- beta test
* Mon Jan 07 2019 Josh Stone <jistone@redhat.com> - 1.31.1-9
- Update to 1.31.1 for RLS fixes.