Skip to content

Commit

Permalink
Fix Rust conditional attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
buybackoff committed Sep 6, 2020
1 parent 0b8be57 commit 6426fce
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ env:
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
test_nuget:
name: Test NuGet package on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Test
run: dotnet test dotnet/tests/Spreads.Native.Tests.NuGet/Spreads.Native.Tests.NuGet.csproj -c Release --verbosity normal
# test_nuget:
# name: Test NuGet package on ${{ matrix.os }}
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [windows-latest]
# steps:
# - uses: actions/checkout@v2
# - name: Setup .NET Core
# uses: actions/setup-dotnet@v1
# with:
# dotnet-version: 3.1.x
# - name: Test
# run: dotnet test dotnet/tests/Spreads.Native.Tests.NuGet/Spreads.Native.Tests.NuGet.csproj -c Release --verbosity normal


native_build_macos:
Expand Down
2 changes: 1 addition & 1 deletion dotnet/build/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<QVersion>1</QVersion>

<!-- Overrides -->
<MMDDVersion>906</MMDDVersion>
<MMDDVersion>907</MMDDVersion>
<PackageHHMMSSSuffix></PackageHHMMSSSuffix>
</PropertyGroup>

Expand Down
6 changes: 3 additions & 3 deletions rs/spreads-pal/src/cpu.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[cfg(windows)]
#[cfg(target_os = "windows")]
#[no_mangle]
pub extern "C" fn spreads_pal_get_cpu_number() -> libc::c_int {
unsafe {
Expand All @@ -8,7 +8,7 @@ pub extern "C" fn spreads_pal_get_cpu_number() -> libc::c_int {
}
}

#[cfg(any(linux))]
#[cfg(target_os = "linux")]
#[no_mangle]
pub extern "C" fn spreads_pal_get_cpu_number() -> libc::c_int {
unsafe {
Expand All @@ -17,7 +17,7 @@ pub extern "C" fn spreads_pal_get_cpu_number() -> libc::c_int {
}
}

#[cfg(not(any(windows, linux)))]
#[cfg(not(any(target_os = "windows", target_os = "linux")))]
#[no_mangle]
pub extern "C" fn spreads_pal_get_cpu_number() -> libc::c_int {
return -1;
Expand Down
6 changes: 3 additions & 3 deletions rs/spreads-pal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod cpu;
#[cfg(test)]
pub mod tests {
#[test]
#[cfg(any(windows, linux))]
#[cfg(any(target_os = "linux", target_os = "windows"))]
pub fn can_get_cpu_number_current() {
// TODO xplat set affinity
let result = super::cpu::spreads_pal_get_cpu_number();
Expand All @@ -12,9 +12,9 @@ pub mod tests {
}

#[test]
#[cfg(any(linux))]
#[cfg(target_os = "linux")]
pub fn can_get_cpu_number_with_affinity() {
let cpu_num = 3;
let cpu_num = 1;
unsafe {
let mut cpu_set: libc::cpu_set_t = std::mem::zeroed();
libc::CPU_ZERO(&mut cpu_set);
Expand Down

0 comments on commit 6426fce

Please sign in to comment.