Skip to content

Commit

Permalink
Merge #304
Browse files Browse the repository at this point in the history
304: Tests: Add test_thread_local r=stlankes a=mkroening

See

* hermit-os/hermit-rs#170

Co-authored-by: Martin Kröning <[email protected]>
  • Loading branch information
bors[bot] and mkroening authored Dec 2, 2021
2 parents 23963c9 + 2f01321 commit 4edf87d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/thread.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![feature(test)]
#![feature(thread_local)]
#![no_std]
#![no_main]
#![test_runner(common::test_case_runner)]
Expand Down Expand Up @@ -40,6 +41,22 @@ pub fn thread_test() {
}
}

#[test_case]
pub fn test_thread_local() {
#[thread_local]
static BYTE: u8 = 0x42;

#[thread_local]
static CAFECAFE: u64 = 0xCAFECAFE;

#[thread_local]
static DEADBEEF: u64 = 0xDEADBEEF;

assert_eq!(0x42, BYTE);
assert_eq!(0xCAFECAFE, CAFECAFE);
assert_eq!(0xDEADBEEF, DEADBEEF);
}

#[no_mangle]
extern "C" fn runtime_entry(_argc: i32, _argv: *const *const u8, _env: *const *const u8) -> ! {
test_main();
Expand Down

0 comments on commit 4edf87d

Please sign in to comment.