mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-09 16:37:36 +00:00
Fix testing of the standard library with Emscripten
This does need EMCC_CFLAGS="-s MAXIMUM_MEMORY=2GB" avoid several OOMs.
This commit is contained in:
parent
48ef38d350
commit
d0a70d9328
@ -353,6 +353,7 @@ pub fn iter_10k(b: &mut Bencher) {
|
||||
}
|
||||
|
||||
#[bench]
|
||||
#[cfg_attr(target_os = "emscripten", ignore)] // hits an OOM
|
||||
pub fn iter_1m(b: &mut Bencher) {
|
||||
bench_iter(b, 1_000, 1_000_000);
|
||||
}
|
||||
|
@ -366,14 +366,25 @@ rotate!(rotate_medium_half, gen_random, 9158, 9158 / 2);
|
||||
rotate!(rotate_medium_half_plus_one, gen_random, 9158, 9158 / 2 + 1);
|
||||
|
||||
// Intended to use more RAM than the machine has cache
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_by1, gen_random, 5 * 1024 * 1024, 1);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_by9199_u64, gen_random, 5 * 1024 * 1024, 9199);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_by9199_bytes, gen_random_bytes, 5 * 1024 * 1024, 9199);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_by9199_strings, gen_strings, 5 * 1024 * 1024, 9199);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_by9199_big, gen_big_random, 5 * 1024 * 1024, 9199);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_by1234577_u64, gen_random, 5 * 1024 * 1024, 1234577);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_by1234577_bytes, gen_random_bytes, 5 * 1024 * 1024, 1234577);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_by1234577_strings, gen_strings, 5 * 1024 * 1024, 1234577);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_by1234577_big, gen_big_random, 5 * 1024 * 1024, 1234577);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_half, gen_random, 5 * 1024 * 1024, 5 * 1024 * 1024 / 2);
|
||||
#[cfg(not(target_os = "emscripten"))] // hits an OOM
|
||||
rotate!(rotate_huge_half_plus_one, gen_random, 5 * 1024 * 1024, 5 * 1024 * 1024 / 2 + 1);
|
||||
|
@ -547,6 +547,11 @@ fn bench_in_place_collect_droppable(b: &mut Bencher) {
|
||||
})
|
||||
}
|
||||
|
||||
// node.js gives out of memory error to use with length 1_100_000
|
||||
#[cfg(target_os = "emscripten")]
|
||||
const LEN: usize = 4096;
|
||||
|
||||
#[cfg(not(target_os = "emscripten"))]
|
||||
const LEN: usize = 16384;
|
||||
|
||||
#[bench]
|
||||
|
@ -11,7 +11,14 @@ use crate::sort::{Sort, known_good_stable_sort, patterns};
|
||||
#[cfg(miri)]
|
||||
const TEST_LENGTHS: &[usize] = &[2, 3, 4, 7, 10, 15, 20, 24, 33, 50, 100, 171, 300];
|
||||
|
||||
#[cfg(not(miri))]
|
||||
// node.js gives out of memory error to use with length 1_100_000
|
||||
#[cfg(all(not(miri), target_os = "emscripten"))]
|
||||
const TEST_LENGTHS: &[usize] = &[
|
||||
2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 20, 24, 30, 32, 33, 35, 50, 100, 200, 500, 1_000,
|
||||
2_048, 5_000, 10_000, 100_000,
|
||||
];
|
||||
|
||||
#[cfg(all(not(miri), not(target_os = "emscripten")))]
|
||||
const TEST_LENGTHS: &[usize] = &[
|
||||
2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 16, 17, 20, 24, 30, 32, 33, 35, 50, 100, 200, 500, 1_000,
|
||||
2_048, 5_000, 10_000, 100_000, 1_100_000,
|
||||
|
@ -128,6 +128,7 @@ fn try_unwrap() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
|
||||
fn into_inner() {
|
||||
for _ in 0..100
|
||||
// ^ Increase chances of hitting potential race conditions
|
||||
|
@ -126,6 +126,7 @@ mod io_benches {
|
||||
use crate::io::prelude::*;
|
||||
|
||||
#[bench]
|
||||
#[cfg_attr(target_os = "emscripten", ignore)] // no /dev
|
||||
fn bench_copy_buf_reader(b: &mut Bencher) {
|
||||
let mut file_in = File::open("/dev/zero").expect("opening /dev/zero failed");
|
||||
// use dyn to avoid specializations unrelated to readbuf
|
||||
|
@ -1,7 +1,7 @@
|
||||
#![feature(anonymous_pipe)]
|
||||
|
||||
fn main() {
|
||||
#[cfg(all(not(miri), any(unix, windows)))]
|
||||
#[cfg(all(not(miri), any(unix, windows), not(target_os = "emscripten")))]
|
||||
{
|
||||
use std::io::{Read, pipe};
|
||||
use std::{env, process};
|
||||
|
@ -5,7 +5,8 @@ use std::{env, fs, process, str};
|
||||
mod common;
|
||||
|
||||
#[test]
|
||||
#[cfg_attr(any(miri, target_os = "wasi"), ignore)] // Process spawning not supported by Miri and wasi
|
||||
// Process spawning not supported by Miri, Emscripten and wasi
|
||||
#[cfg_attr(any(miri, target_os = "emscripten", target_os = "wasi"), ignore)]
|
||||
fn issue_15149() {
|
||||
// If we're the parent, copy our own binary to a new directory.
|
||||
let my_path = env::current_exe().unwrap();
|
||||
|
Loading…
Reference in New Issue
Block a user