File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Windows test
2+
3+ on : workflow_dispatch
4+
5+ defaults :
6+ run :
7+ shell : bash
8+
9+ jobs :
10+ test :
11+ name : Test
12+ runs-on : windows-2025
13+ strategy :
14+ matrix :
15+ include :
16+ - target : x86_64-pc-windows-msvc
17+ - target : i686-pc-windows-gnu
18+ steps :
19+ - uses : actions/checkout@v6
20+ - name : Set up Rust toolchain
21+ run : |
22+ rustup default ${{ matrix.target }}
23+ rustc -Vv
24+ - name : Test
25+ run : |
26+ cd ./libc-test
27+ cargo t --target ${{ matrix.target }}
Original file line number Diff line number Diff line change 1+ //! Ensures Windows `time`-related routines align with `libc`'s interface. By
2+ //! default, both MSVC and GNU (under `mingw`) expose 64-bit symbols. `libc`
3+ //! also does that, but there's been slight inconsistencies in the past.
4+
5+ #![ cfg( windows) ]
6+
7+ /// Ensures a 64-bit write is performed on values that should always be 64 bits.
8+ /// This may fail if
9+ /// (1) the routine links with its 32-bit variant. This only happens if
10+ /// `_USE_32BIT_TIME_T` is defined. In theory, this should not be
11+ /// possible when working with Rust's `libc`.
12+ /// (2) Or `time_t` is 32-bits, and a 64-bit write overwrites both array items.
13+ /// This should neither be possible unless the above macro is defined.
14+ /// Support for non-64-bit values in `libc` should thus be non-existent.
15+ #[ test]
16+ fn test_64_bit_store ( ) {
17+ let mut time_values: [ libc:: time_t ; 2 ] = [ 123 , 456 ] ;
18+ let ptr = time_values. as_mut_ptr ( ) ;
19+ unsafe { libc:: time ( ptr) } ;
20+ assert ! ( time_values[ 0 ] != 123 ) ;
21+ assert_eq ! ( time_values[ 1 ] , 456 ) ;
22+ }
You can’t perform that action at this time.
0 commit comments