Skip to content

Commit

Permalink
Merge all tests of libstd into a single crate
Browse files Browse the repository at this point in the history
This enables more parallelization in test execution and reduces total
time spent linking.
  • Loading branch information
bjorn3 committed Feb 15, 2024
1 parent 4644851 commit f19b6cb
Show file tree
Hide file tree
Showing 34 changed files with 61 additions and 104 deletions.
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,6 @@ todo = ["c-gull/todo"]

# Enable `unimplemented!()` stubs for deprecated functions.
deprecated-and-unimplemented = ["c-gull/deprecated-and-unimplemented"]

[patch.crates-io]
origin = { path = "./origin" }
50 changes: 50 additions & 0 deletions tests/stdtests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#![feature(cfg_target_has_atomic)]
#![feature(const_ip)]
#![feature(const_ipv4)]
#![feature(const_ipv6)]
#![feature(core_io_borrowed_buf)]
#![feature(duration_constants)]
#![feature(io_error_uncategorized)]
#![feature(ip)]
#![feature(lazy_cell)]
#![feature(maybe_uninit_uninit_array)]
#![feature(once_cell_try)]
#![feature(read_buf)]
#![feature(tcp_linger)]
#![feature(try_blocks)]

extern crate eyra;

mod stdtests {
mod common;
mod net;
mod sys_common;

mod env;
mod fs;
mod integration_create_dir_all_bare;
mod integration_env;
mod integration_thread;
mod kernel_copy;
mod lazy;
mod net_addr;
mod net_ip;
mod net_tcp;
mod net_udp;
mod panic;
mod process;
mod process_common;
mod process_unix;
mod sync_barrier;
mod sync_condvar;
mod sync_lazy_lock;
mod sync_mpsc;
mod sync_mpsc_sync;
mod sync_mutex;
mod sync_once;
mod sync_once_lock;
mod sync_rwlock;
mod thread;
mod thread_local;
mod time;
}
File renamed without changes.
2 changes: 0 additions & 2 deletions tests/env.rs → tests/stdtests/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/env/tests.rs at revision
//! 497ee321af3b8496eaccd7af7b437f18bab81abf.
extern crate eyra;

use std::env::*;

use std::path::Path;
Expand Down
11 changes: 1 addition & 10 deletions tests/fs.rs → tests/stdtests/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,9 @@
//! library/std/src/fs/tests.rs at revision
//! defa2456246a8272ceace9c1cdccdf2e4c36175e.
#![feature(io_error_uncategorized)]
#![feature(read_buf)]
#![feature(maybe_uninit_uninit_array)]
#![feature(core_io_borrowed_buf)]

extern crate eyra;

mod sys_common;

use std::io::prelude::*;

use super::sys_common::io::test::{tmpdir, TempDir};
use std::env;
use std::fs::{self, File, OpenOptions};
use std::io::{BorrowedBuf, ErrorKind, SeekFrom};
Expand All @@ -22,7 +14,6 @@ use std::str;
use std::sync::Arc;
use std::thread;
use std::time::{Duration, Instant};
use sys_common::io::test::{tmpdir, TempDir};

use rand::{rngs::StdRng, RngCore, SeedableRng};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@
//! Note that this test changes the current directory so
//! should not be in the same process as other tests.
extern crate eyra;

use std::env;
use std::fs;
use std::path::{Path, PathBuf};

mod common;
use super::common;

// On some platforms, setting the current directory will prevent deleting it.
// So this helper ensures the current directory is reset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
//! library/std/tests/env.rs at revision
//! 9b18b4440a8d8b052ef454dba9fdb95be99485e7.
extern crate eyra;

use std::env::*;
use std::ffi::{OsStr, OsString};

use rand::distributions::{Alphanumeric, DistString};

mod common;
use common::test_rng;
use super::common::test_rng;

#[track_caller]
fn make_rand_name() -> OsString {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/tests/thread.rs at revision
//! 9b18b4440a8d8b052ef454dba9fdb95be99485e7.
extern crate eyra;

use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
Expand Down
8 changes: 1 addition & 7 deletions tests/kernel_copy.rs → tests/stdtests/kernel_copy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@
//! library/std/src/sys/unix/kernel_copy/tests.rs at revision
//! 5c0d76dbe1669c96f1959d7b0b1d4de7e9a47c43.
#![feature(try_blocks)]

extern crate eyra;

mod sys_common;

use super::sys_common::io::test::tmpdir;
use std::fs::OpenOptions;
#[cfg(feature = "bench")]
use std::io;
Expand All @@ -16,7 +11,6 @@ use std::io::SeekFrom;
use std::io::{BufRead, Read, Seek, Write};
#[cfg(feature = "bench")]
use std::os::unix::io::AsRawFd;
use sys_common::io::test::tmpdir;

#[test]
fn copy_specialization() -> Result<()> {
Expand Down
5 changes: 0 additions & 5 deletions tests/lazy.rs → tests/stdtests/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@
//! library/std/src/lazy/tests.rs at revision
//! 497ee321af3b8496eaccd7af7b437f18bab81abf.
#![feature(once_cell_try)]
#![feature(lazy_cell)]

extern crate eyra;

use std::{
cell::LazyCell,
panic,
Expand Down
File renamed without changes.
File renamed without changes.
6 changes: 1 addition & 5 deletions tests/net-addr.rs → tests/stdtests/net_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
//! library/std/src/net/addr/tests.rs at revision
//! 497ee321af3b8496eaccd7af7b437f18bab81abf.
extern crate eyra;

mod net;

use crate::net::test::{sa4, sa6, tsa};
use super::net::test::{sa4, sa6, tsa};
use std::net::*;

#[test]
Expand Down
11 changes: 1 addition & 10 deletions tests/net-ip.rs → tests/stdtests/net_ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,7 @@
//! library/std/src/net/ip/tests.rs at revision
//! c1a5ec7faf6c32af2f0aae1af4420e1bb1a3a7fe.
#![feature(ip)]
#![feature(const_ip)]
#![feature(const_ipv4)]
#![feature(const_ipv6)]

extern crate eyra;

mod net;

use crate::net::test::{sa4, sa6, tsa};
use super::net::test::{sa4, sa6, tsa};
use std::net::*;
use std::str::FromStr;

Expand Down
9 changes: 1 addition & 8 deletions tests/net-tcp.rs → tests/stdtests/net_tcp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@
//! library/std/src/net/tcp/tests.rs at revision
//! 497ee321af3b8496eaccd7af7b437f18bab81abf.
#![feature(io_error_uncategorized)]
#![feature(tcp_linger)]

extern crate eyra;

mod net;

use crate::net::test::{next_test_ip4, next_test_ip6};
use super::net::test::{next_test_ip4, next_test_ip6};
use std::fmt;
use std::io::prelude::*;
use std::io::{ErrorKind, IoSlice, IoSliceMut};
Expand Down
6 changes: 1 addition & 5 deletions tests/net-udp.rs → tests/stdtests/net_udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
//! library/std/src/net/udp/tests.rs at revision
//! 497ee321af3b8496eaccd7af7b437f18bab81abf.
extern crate eyra;

mod net;

use crate::net::test::{next_test_ip4, next_test_ip6};
use super::net::test::{next_test_ip4, next_test_ip6};
use std::io::ErrorKind;
use std::net::*;
#[cfg(not(windows))]
Expand Down
2 changes: 0 additions & 2 deletions tests/panic.rs → tests/stdtests/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#![allow(dead_code)]

extern crate eyra;

use std::cell::RefCell;
use std::panic::{AssertUnwindSafe, UnwindSafe};
use std::rc::Rc;
Expand Down
7 changes: 0 additions & 7 deletions tests/process.rs → tests/stdtests/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,6 @@
//! library/std/src/process/tests.rs at revision
//! defa2456246a8272ceace9c1cdccdf2e4c36175e.
#![feature(io_error_uncategorized)]
#![feature(read_buf)]
#![feature(maybe_uninit_uninit_array)]
#![feature(core_io_borrowed_buf)]

extern crate eyra;

use std::io::prelude::*;

use std::io::{BorrowedBuf, ErrorKind};
Expand Down
2 changes: 0 additions & 2 deletions tests/process-common.rs → tests/stdtests/process_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/sys/unix/process/process_common/tests.rs at revision
//! a52c79e859142c1cd5c0c5bdb73f16b754e1b98f.
extern crate eyra;

use std::ffi::OsStr;
use std::io::{Read, Write};
use std::mem;
Expand Down
2 changes: 0 additions & 2 deletions tests/process-unix.rs → tests/stdtests/process_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/sys/unix/process/process_unix/tests.rs at revision
//! 0b35f448f8e9f39ed6fc1c494eeb331afba513bc.
extern crate eyra;

use std::os::unix::process::{CommandExt, ExitStatusExt};
use std::panic::catch_unwind;
use std::process::Command;
Expand Down
2 changes: 0 additions & 2 deletions tests/sync-barrier.rs → tests/stdtests/sync_barrier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/sync/barrier.rs at revision
//! 497ee321af3b8496eaccd7af7b437f18bab81abf.
extern crate eyra;

use std::sync::mpsc::{channel, TryRecvError};
use std::sync::{Arc, Barrier};
use std::thread;
Expand Down
2 changes: 0 additions & 2 deletions tests/sync-condvar.rs → tests/stdtests/sync_condvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/sync/condvar/tests.rs at revision
//! 21c5f780f464b27802d0ee0f86c95eb29881096b.
extern crate eyra;

use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::channel;
use std::sync::{Arc, Condvar, Mutex};
Expand Down
4 changes: 0 additions & 4 deletions tests/sync-lazy_lock.rs → tests/stdtests/sync_lazy_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
//! library/std/src/sync/lazy_lock/tests.rs at revision
//! c1a2db3372a4d6896744919284f3287650a38ab7.
#![feature(lazy_cell)]

extern crate eyra;

use std::{
cell::LazyCell,
panic,
Expand Down
2 changes: 0 additions & 2 deletions tests/sync-mpsc.rs → tests/stdtests/sync_mpsc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/sync/mpsc/tests.rs at revision
//! 5fd561dea24d137734195d8d2dc82fe179553b2d.
extern crate eyra;

use std::env;
use std::sync::mpsc::*;
use std::thread;
Expand Down
2 changes: 0 additions & 2 deletions tests/sync-mpsc-sync.rs → tests/stdtests/sync_mpsc_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/sync/mpsc/sync_tests.rs at revision
//! 5fd561dea24d137734195d8d2dc82fe179553b2d.
extern crate eyra;

use std::env;
use std::sync::mpsc::*;
use std::thread;
Expand Down
2 changes: 0 additions & 2 deletions tests/sync-mutex.rs → tests/stdtests/sync_mutex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/sync/mutex/tests.rs at revision
//! 72a25d05bf1a4b155d74139ef700ff93af6d8e22.
extern crate eyra;

use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::channel;
use std::sync::Condvar;
Expand Down
2 changes: 0 additions & 2 deletions tests/sync-once.rs → tests/stdtests/sync_once.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/sync/once/tests.rs at revision
//! f42e96149dd03e816b8bc3c329e7b9a5d12fcdab.
extern crate eyra;

use std::panic;
use std::sync::mpsc::channel;
use std::sync::Once;
Expand Down
4 changes: 0 additions & 4 deletions tests/sync-once_lock.rs → tests/stdtests/sync_once_lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
//! library/std/src/sync/once_lock/tests.rs at revision
//! c1a2db3372a4d6896744919284f3287650a38ab7.
#![feature(once_cell_try)]

extern crate eyra;

use std::{
panic,
sync::OnceLock,
Expand Down
2 changes: 0 additions & 2 deletions tests/sync-rwlock.rs → tests/stdtests/sync_rwlock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/sync/rwlock/tests.rs at revision
//! 72a25d05bf1a4b155d74139ef700ff93af6d8e22.
extern crate eyra;

use rand::{self, Rng};
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::channel;
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions tests/thread.rs → tests/stdtests/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/thread/tests.rs at revision
//! eb14dd863a0d8af603c6783b10efff8454944c15.
extern crate eyra;

use std::any::Any;
use std::mem;
use std::panic::panic_any;
Expand Down
2 changes: 0 additions & 2 deletions tests/thread-local.rs → tests/stdtests/thread_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
//! library/std/src/thread/local/tests.rs at revision
//! 497ee321af3b8496eaccd7af7b437f18bab81abf.
extern crate eyra;

use std::cell::{Cell, UnsafeCell};
use std::sync::atomic::{AtomicU8, Ordering};
use std::sync::mpsc::{channel, Sender};
Expand Down
4 changes: 0 additions & 4 deletions tests/time.rs → tests/stdtests/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
//! library/std/src/time/tests.rs at revision
//! 72a25d05bf1a4b155d74139ef700ff93af6d8e22.
#![feature(cfg_target_has_atomic)]
#![feature(duration_constants)]
#![allow(soft_unstable)]

extern crate eyra;

use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
#[cfg(feature = "bench")]
#[cfg(not(target_arch = "wasm32"))]
Expand Down

0 comments on commit f19b6cb

Please sign in to comment.