[tip: locking/core] rust: sync: atomic: Add store_release/load_acquire tests

tip-bot2 for FUJITA Tomonori posted 1 patch 3 weeks, 5 days ago
rust/kernel/sync/atomic/predefine.rs | 10 ++++++++++
1 file changed, 10 insertions(+)
[tip: locking/core] rust: sync: atomic: Add store_release/load_acquire tests
Posted by tip-bot2 for FUJITA Tomonori 3 weeks, 5 days ago
The following commit has been merged into the locking/core branch of tip:

Commit-ID:     7b001c97d9bdaea50e1e1834040c58f7ef9f4e89
Gitweb:        https://git.kernel.org/tip/7b001c97d9bdaea50e1e1834040c58f7ef9f4e89
Author:        FUJITA Tomonori <fujita.tomonori@gmail.com>
AuthorDate:    Thu, 11 Dec 2025 20:38:26 +09:00
Committer:     Boqun Feng <boqun.feng@gmail.com>
CommitterDate: Fri, 09 Jan 2026 19:01:41 +08:00

rust: sync: atomic: Add store_release/load_acquire tests

Add minimum store_release/load_acquire tests.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@gmail.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Link: https://patch.msgid.link/20251211113826.1299077-5-fujita.tomonori@gmail.com
---
 rust/kernel/sync/atomic/predefine.rs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/rust/kernel/sync/atomic/predefine.rs b/rust/kernel/sync/atomic/predefine.rs
index 09b357b..51e9df0 100644
--- a/rust/kernel/sync/atomic/predefine.rs
+++ b/rust/kernel/sync/atomic/predefine.rs
@@ -138,6 +138,16 @@ mod tests {
     }
 
     #[test]
+    fn atomic_acquire_release_tests() {
+        for_each_type!(42 in [i8, i16, i32, i64, u32, u64, isize, usize] |v| {
+            let x = Atomic::new(0);
+
+            x.store(v, Release);
+            assert_eq!(v, x.load(Acquire));
+        });
+    }
+
+    #[test]
     fn atomic_xchg_tests() {
         for_each_type!(42 in [i32, i64, u32, u64, isize, usize] |v| {
             let x = Atomic::new(v);