Patch coretests separately from the standard library source
This commit is contained in:
parent
f79601fbb0
commit
a45a81a6a2
@ -6,6 +6,7 @@ use std::process::Command;
|
||||
use super::build_sysroot::{BUILD_SYSROOT, ORIG_BUILD_SYSROOT, SYSROOT_RUSTC_VERSION, SYSROOT_SRC};
|
||||
use super::path::{Dirs, RelPath};
|
||||
use super::rustc_info::{get_default_sysroot, get_rustc_version};
|
||||
use super::tests::LIBCORE_TESTS_SRC;
|
||||
use super::utils::{copy_dir_recursively, git_command, retry_spawn_and_wait, spawn_and_wait};
|
||||
|
||||
pub(crate) fn prepare(dirs: &Dirs) {
|
||||
@ -13,8 +14,10 @@ pub(crate) fn prepare(dirs: &Dirs) {
|
||||
|
||||
spawn_and_wait(super::build_backend::CG_CLIF.fetch("cargo", "rustc", dirs));
|
||||
|
||||
prepare_sysroot(dirs);
|
||||
prepare_stdlib(dirs);
|
||||
spawn_and_wait(super::build_sysroot::STANDARD_LIBRARY.fetch("cargo", "rustc", dirs));
|
||||
|
||||
prepare_coretests(dirs);
|
||||
spawn_and_wait(super::tests::LIBCORE_TESTS.fetch("cargo", "rustc", dirs));
|
||||
|
||||
super::tests::RAND_REPO.fetch(dirs);
|
||||
@ -25,11 +28,11 @@ pub(crate) fn prepare(dirs: &Dirs) {
|
||||
spawn_and_wait(super::tests::PORTABLE_SIMD.fetch("cargo", "rustc", dirs));
|
||||
}
|
||||
|
||||
fn prepare_sysroot(dirs: &Dirs) {
|
||||
fn prepare_stdlib(dirs: &Dirs) {
|
||||
let sysroot_src_orig = get_default_sysroot(Path::new("rustc")).join("lib/rustlib/src/rust");
|
||||
assert!(sysroot_src_orig.exists());
|
||||
|
||||
eprintln!("[COPY] sysroot src");
|
||||
eprintln!("[COPY] stdlib src");
|
||||
|
||||
// FIXME ensure builds error out or update the copy if any of the files copied here change
|
||||
BUILD_SYSROOT.ensure_fresh(dirs);
|
||||
@ -47,7 +50,25 @@ fn prepare_sysroot(dirs: &Dirs) {
|
||||
eprintln!("[GIT] init");
|
||||
init_git_repo(&SYSROOT_SRC.to_path(dirs));
|
||||
|
||||
apply_patches(dirs, "sysroot", &SYSROOT_SRC.to_path(dirs));
|
||||
apply_patches(dirs, "stdlib", &SYSROOT_SRC.to_path(dirs));
|
||||
}
|
||||
|
||||
fn prepare_coretests(dirs: &Dirs) {
|
||||
let sysroot_src_orig = get_default_sysroot(Path::new("rustc")).join("lib/rustlib/src/rust");
|
||||
assert!(sysroot_src_orig.exists());
|
||||
|
||||
eprintln!("[COPY] coretests src");
|
||||
|
||||
fs::create_dir_all(LIBCORE_TESTS_SRC.to_path(dirs)).unwrap();
|
||||
copy_dir_recursively(
|
||||
&sysroot_src_orig.join("library/core/tests"),
|
||||
&LIBCORE_TESTS_SRC.to_path(dirs),
|
||||
);
|
||||
|
||||
eprintln!("[GIT] init");
|
||||
init_git_repo(&LIBCORE_TESTS_SRC.to_path(dirs));
|
||||
|
||||
apply_patches(dirs, "coretests", &LIBCORE_TESTS_SRC.to_path(dirs));
|
||||
}
|
||||
|
||||
pub(crate) struct GitRepo {
|
||||
|
@ -1,4 +1,4 @@
|
||||
use super::build_sysroot::{self, SYSROOT_SRC};
|
||||
use super::build_sysroot;
|
||||
use super::config;
|
||||
use super::path::{Dirs, RelPath};
|
||||
use super::prepare::GitRepo;
|
||||
@ -114,8 +114,9 @@ pub(crate) static PORTABLE_SIMD_REPO: GitRepo = GitRepo::github(
|
||||
pub(crate) static PORTABLE_SIMD: CargoProject =
|
||||
CargoProject::new(&PORTABLE_SIMD_REPO.source_dir(), "portable_simd");
|
||||
|
||||
pub(crate) static LIBCORE_TESTS: CargoProject =
|
||||
CargoProject::new(&SYSROOT_SRC.join("library/core/tests"), "core_tests");
|
||||
pub(crate) static LIBCORE_TESTS_SRC: RelPath = RelPath::DOWNLOAD.join("coretests_src");
|
||||
|
||||
pub(crate) static LIBCORE_TESTS: CargoProject = CargoProject::new(&LIBCORE_TESTS_SRC, "core_tests");
|
||||
|
||||
const EXTENDED_SYSROOT_SUITE: &[TestCase] = &[
|
||||
TestCase::custom("test.rust-random/rand", &|runner| {
|
||||
|
@ -13,14 +13,14 @@ Subject: [PATCH] [core] Disable not compiling tests
|
||||
6 files changed, 16 insertions(+), 1 deletion(-)
|
||||
create mode 100644 library/core/tests/Cargo.toml
|
||||
|
||||
diff --git a/library/core/tests/Cargo.toml b/library/core/tests/Cargo.toml
|
||||
diff --git a/Cargo.toml b/Cargo.toml
|
||||
new file mode 100644
|
||||
index 0000000..46fd999
|
||||
--- /dev/null
|
||||
+++ b/library/core/tests/Cargo.toml
|
||||
+++ b/Cargo.toml
|
||||
@@ -0,0 +1,12 @@
|
||||
+[package]
|
||||
+name = "core"
|
||||
+name = "coretests"
|
||||
+version = "0.0.0"
|
||||
+edition = "2021"
|
||||
+
|
||||
@ -31,10 +31,10 @@ index 0000000..46fd999
|
||||
+[dependencies]
|
||||
+rand = { version = "0.8.5", default-features = false }
|
||||
+rand_xorshift = { version = "0.3.0", default-features = false }
|
||||
diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs
|
||||
diff --git a/lib.rs b/lib.rs
|
||||
index 42a26ae..5ac1042 100644
|
||||
--- a/library/core/tests/lib.rs
|
||||
+++ b/library/core/tests/lib.rs
|
||||
--- a/lib.rs
|
||||
+++ b/lib.rs
|
||||
@@ -1,3 +1,4 @@
|
||||
+#![cfg(test)]
|
||||
#![feature(alloc_layout_extra)]
|
@ -10,10 +10,10 @@ Subject: [PATCH] [core] Ignore failing tests
|
||||
library/core/tests/time.rs | 1 +
|
||||
4 files changed, 18 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/library/core/tests/array.rs b/library/core/tests/array.rs
|
||||
diff --git a/array.rs b/array.rs
|
||||
index 4bc44e9..8e3c7a4 100644
|
||||
--- a/library/core/tests/array.rs
|
||||
+++ b/library/core/tests/array.rs
|
||||
--- a/array.rs
|
||||
+++ b/array.rs
|
||||
@@ -242,6 +242,7 @@ fn iterator_drops() {
|
||||
assert_eq!(i.get(), 5);
|
||||
}
|
||||
@ -46,10 +46,10 @@ index 4bc44e9..8e3c7a4 100644
|
||||
|
||||
#[test]
|
||||
fn cell_allows_array_cycle() {
|
||||
diff --git a/library/core/tests/atomic.rs b/library/core/tests/atomic.rs
|
||||
diff --git a/atomic.rs b/atomic.rs
|
||||
index 13b12db..96fe4b9 100644
|
||||
--- a/library/core/tests/atomic.rs
|
||||
+++ b/library/core/tests/atomic.rs
|
||||
--- a/atomic.rs
|
||||
+++ b/atomic.rs
|
||||
@@ -185,6 +185,7 @@ fn ptr_bitops() {
|
||||
}
|
||||
|
30
patches/0027-coretests-128bit-atomic-operations.patch
Normal file
30
patches/0027-coretests-128bit-atomic-operations.patch
Normal file
@ -0,0 +1,30 @@
|
||||
From ad7ffe71baba46865f2e65266ab025920dfdc20b Mon Sep 17 00:00:00 2001
|
||||
From: bjorn3 <bjorn3@users.noreply.github.com>
|
||||
Date: Thu, 18 Feb 2021 18:45:28 +0100
|
||||
Subject: [PATCH] Disable 128bit atomic operations
|
||||
|
||||
Cranelift doesn't support them yet
|
||||
---
|
||||
library/core/src/panic/unwind_safe.rs | 6 -----
|
||||
library/core/src/sync/atomic.rs | 38 ---------------------------
|
||||
library/core/tests/atomic.rs | 4 ---
|
||||
4 files changed, 4 insertions(+), 50 deletions(-)
|
||||
|
||||
diff --git a/atomic.rs b/atomic.rs
|
||||
index b735957..ea728b6 100644
|
||||
--- a/atomic.rs
|
||||
+++ b/atomic.rs
|
||||
@@ -185,10 +185,6 @@ fn atomic_alignment() {
|
||||
assert_eq!(align_of::<AtomicU64>(), size_of::<AtomicU64>());
|
||||
#[cfg(target_has_atomic = "64")]
|
||||
assert_eq!(align_of::<AtomicI64>(), size_of::<AtomicI64>());
|
||||
- #[cfg(target_has_atomic = "128")]
|
||||
- assert_eq!(align_of::<AtomicU128>(), size_of::<AtomicU128>());
|
||||
- #[cfg(target_has_atomic = "128")]
|
||||
- assert_eq!(align_of::<AtomicI128>(), size_of::<AtomicI128>());
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
assert_eq!(align_of::<AtomicUsize>(), size_of::<AtomicUsize>());
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
--
|
||||
2.26.2.7.g19db9cfb68
|
||||
|
@ -85,21 +85,6 @@ index d9de37e..8293fce 100644
|
||||
|
||||
macro_rules! atomic_int_ptr_sized {
|
||||
( $($target_pointer_width:literal $align:literal)* ) => { $(
|
||||
diff --git a/library/core/tests/atomic.rs b/library/core/tests/atomic.rs
|
||||
index b735957..ea728b6 100644
|
||||
--- a/library/core/tests/atomic.rs
|
||||
+++ b/library/core/tests/atomic.rs
|
||||
@@ -185,10 +185,6 @@ fn atomic_alignment() {
|
||||
assert_eq!(align_of::<AtomicU64>(), size_of::<AtomicU64>());
|
||||
#[cfg(target_has_atomic = "64")]
|
||||
assert_eq!(align_of::<AtomicI64>(), size_of::<AtomicI64>());
|
||||
- #[cfg(target_has_atomic = "128")]
|
||||
- assert_eq!(align_of::<AtomicU128>(), size_of::<AtomicU128>());
|
||||
- #[cfg(target_has_atomic = "128")]
|
||||
- assert_eq!(align_of::<AtomicI128>(), size_of::<AtomicI128>());
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
assert_eq!(align_of::<AtomicUsize>(), size_of::<AtomicUsize>());
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
--
|
||||
2.26.2.7.g19db9cfb68
|
||||
|
@ -7,10 +7,10 @@ Subject: [PATCH] Disable long running tests
|
||||
library/core/tests/slice.rs | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/library/core/tests/slice.rs b/library/core/tests/slice.rs
|
||||
diff --git a/slice.rs b/slice.rs
|
||||
index 8402833..84592e0 100644
|
||||
--- a/library/core/tests/slice.rs
|
||||
+++ b/library/core/tests/slice.rs
|
||||
--- a/slice.rs
|
||||
+++ b/slice.rs
|
||||
@@ -1809,6 +1809,7 @@ fn sort_unstable() {
|
||||
assert!(v == [0xDEADBEEF]);
|
||||
}
|
@ -10,7 +10,7 @@ git fetch
|
||||
git checkout -- .
|
||||
git checkout "$(rustc -V | cut -d' ' -f3 | tr -d '(')"
|
||||
|
||||
git -c user.name=Dummy -c user.email=dummy@example.com am ../patches/*-sysroot-*.patch
|
||||
git -c user.name=Dummy -c user.email=dummy@example.com am ../patches/*-stdlib-*.patch
|
||||
|
||||
git apply - <<EOF
|
||||
diff --git a/library/alloc/Cargo.toml b/library/alloc/Cargo.toml
|
||||
|
Loading…
x
Reference in New Issue
Block a user