about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-04-09 21:41:10 +0000
committerbors <bors@rust-lang.org>2018-04-09 21:41:10 +0000
commit880fbd7c4e663f9cfbffb7603ce9a6932a15effd (patch)
tree46e0f380ece5a5ab44d4ddab50c860c3d0b4884c
parent4b9b70c394e7f341b4016fce4cbf763d404b26f9 (diff)
parent69c3830c4487ce50017ab323d0ce4cbc0b6a4700 (diff)
downloadrust-880fbd7c4e663f9cfbffb7603ce9a6932a15effd.tar.gz
rust-880fbd7c4e663f9cfbffb7603ce9a6932a15effd.zip
Auto merge of #49811 - alexcrichton:fix-android, r=SimonSapin
std: Be sure to modify atomics in tests

See #49775 for some more information but it looks like this is working around an
LLVM bug for the time being.

Closes #49775
-rw-r--r--src/libcore/tests/atomic.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/libcore/tests/atomic.rs b/src/libcore/tests/atomic.rs
index f634fabe503..a3667b3f3fe 100644
--- a/src/libcore/tests/atomic.rs
+++ b/src/libcore/tests/atomic.rs
@@ -104,8 +104,10 @@ static S_UINT: AtomicUsize = AtomicUsize::new(0);
 
 #[test]
 fn static_init() {
-    assert!(!S_FALSE.load(SeqCst));
-    assert!(S_TRUE.load(SeqCst));
-    assert!(S_INT.load(SeqCst) == 0);
-    assert!(S_UINT.load(SeqCst) == 0);
+    // Note that we're not really testing the mutability here but it's important
+    // on Android at the moment (#49775)
+    assert!(!S_FALSE.swap(true, SeqCst));
+    assert!(S_TRUE.swap(false, SeqCst));
+    assert!(S_INT.fetch_add(1, SeqCst) == 0);
+    assert!(S_UINT.fetch_add(1, SeqCst) == 0);
 }