Disable 64 bit atomic tests on emscripten

This commit is contained in:
David Tolnay 2019-07-16 10:00:44 -07:00
parent 7a4c1086b5
commit f3e2bb5104
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
2 changed files with 36 additions and 17 deletions

View File

@ -11,12 +11,15 @@ use std::ops::Bound;
use std::path::{Path, PathBuf};
use std::rc::{Rc, Weak as RcWeak};
use std::sync::atomic::{
AtomicBool, AtomicI16, AtomicI32, AtomicI64, AtomicI8, AtomicIsize, AtomicU16, AtomicU32,
AtomicU64, AtomicU8, AtomicUsize, Ordering,
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
AtomicUsize, Ordering,
};
use std::sync::{Arc, Weak as ArcWeak};
use std::time::{Duration, UNIX_EPOCH};
#[cfg(not(target_os = "emscripten"))]
use std::sync::atomic::{AtomicI64, AtomicU64};
use fnv::FnvHasher;
use serde::de::DeserializeOwned;
use serde::{Deserialize, Deserializer};
@ -1172,13 +1175,17 @@ fn test_atomics() {
test(AtomicI8::load, -127, Token::I8(-127i8));
test(AtomicI16::load, -510, Token::I16(-510i16));
test(AtomicI32::load, -131072, Token::I32(-131072i32));
test(AtomicI64::load, -8589934592, Token::I64(-8589934592));
test(AtomicIsize::load, -131072isize, Token::I32(-131072));
test(AtomicU8::load, 127, Token::U8(127u8));
test(AtomicU16::load, 510u16, Token::U16(510u16));
test(AtomicU32::load, 131072u32, Token::U32(131072u32));
test(AtomicU64::load, 8589934592u64, Token::U64(8589934592));
test(AtomicUsize::load, 131072usize, Token::U32(131072));
#[cfg(not(target_os = "emscripten"))]
{
test(AtomicI64::load, -8589934592, Token::I64(-8589934592));
test(AtomicU64::load, 8589934592u64, Token::U64(8589934592));
}
}
declare_error_tests! {

View File

@ -10,11 +10,17 @@ use std::num::Wrapping;
use std::ops::Bound;
use std::path::{Path, PathBuf};
use std::rc::{Rc, Weak as RcWeak};
use std::sync::{atomic, Arc, Weak as ArcWeak};
use std::sync::atomic::{
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
AtomicUsize,
};
use std::sync::{Arc, Weak as ArcWeak};
use std::time::{Duration, UNIX_EPOCH};
#[cfg(unix)]
use std::str;
#[cfg(not(target_os = "emscripten"))]
use std::sync::atomic::{AtomicI64, AtomicU64};
use fnv::FnvHasher;
use serde::Serialize;
@ -485,18 +491,24 @@ declare_tests! {
],
}
test_atomic {
atomic::AtomicBool::new(false) => &[Token::Bool(false)],
atomic::AtomicBool::new(true) => &[Token::Bool(true)],
atomic::AtomicI8::new(63i8) => &[Token::I8(63i8)],
atomic::AtomicI16::new(-318i16) => &[Token::I16(-318i16)],
atomic::AtomicI32::new(65792i32) => &[Token::I32(65792i32)],
atomic::AtomicI64::new(-4295032832i64) => &[Token::I64(-4295032832i64)],
atomic::AtomicIsize::new(-65792isize) => &[Token::I64(-65792i64)],
atomic::AtomicU8::new(192u8) => &[Token::U8(192u8)],
atomic::AtomicU16::new(510u16) => &[Token::U16(510u16)],
atomic::AtomicU32::new(131072u32) => &[Token::U32(131072u32)],
atomic::AtomicU64::new(12884901888u64) => &[Token::U64(12884901888u64)],
atomic::AtomicUsize::new(655360usize) => &[Token::U64(655360u64)],
AtomicBool::new(false) => &[Token::Bool(false)],
AtomicBool::new(true) => &[Token::Bool(true)],
AtomicI8::new(63i8) => &[Token::I8(63i8)],
AtomicI16::new(-318i16) => &[Token::I16(-318i16)],
AtomicI32::new(65792i32) => &[Token::I32(65792i32)],
AtomicIsize::new(-65792isize) => &[Token::I64(-65792i64)],
AtomicU8::new(192u8) => &[Token::U8(192u8)],
AtomicU16::new(510u16) => &[Token::U16(510u16)],
AtomicU32::new(131072u32) => &[Token::U32(131072u32)],
AtomicUsize::new(655360usize) => &[Token::U64(655360u64)],
}
}
#[cfg(not(target_os = "emscripten"))]
declare_tests! {
test_atomic64 {
AtomicI64::new(-4295032832i64) => &[Token::I64(-4295032832i64)],
AtomicU64::new(12884901888u64) => &[Token::U64(12884901888u64)],
}
}