Skip to content

Commit

Permalink
wip: trying to debug windows CI failures
Browse files Browse the repository at this point in the history
  • Loading branch information
Dr-Emann committed Jan 25, 2024
1 parent b01b9ce commit b6455dc
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 30 deletions.
60 changes: 30 additions & 30 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ env:

jobs:
test:
name: Test on ${{ matrix.os }} using Rust ${{ matrix.rust }} with bindgen features '${{ matrix.cargo_features }}'
name: Test on ${{ matrix.os }} using Rust ${{ matrix.rust }}'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
rust: [stable, nightly]
cargo_features: ['']
os: [windows-latest]
rust: [nightly]

steps:
- uses: hecrj/setup-rust-action@v2
Expand All @@ -39,38 +38,39 @@ jobs:
run: echo "LIBCLANG_PATH=C:\Program Files\LLVM\bin" >> $GITHUB_ENV
shell: bash

- name: Cargo fmt
run: cargo +${{ matrix.rust }} fmt --all -- --check
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly'

- name: Cargo clippy
run: cargo +${{ matrix.rust }} clippy --all-targets --workspace --features "${{ matrix.cargo_features }}"
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' && matrix.cargo_features != ''
- name: Run c roaring
if: matrix.os == 'windows-latest'
run: |
clang --version || true
clang -O3 -o c_roaring.exe roaring_fast_or.c
./c_roaring.exe
gcc --version || true
gcc -O3 -o c_roaring.exe roaring_fast_or.c
./c_roaring.exe
gcc --version || true
shell: bash

- name: Cargo clippy
run: cargo +${{ matrix.rust }} clippy --all-targets --workspace
if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly' && matrix.cargo_features == ''

- name: Build
run: cargo +${{ matrix.rust }} build --features "${{ matrix.cargo_features }}"
if: matrix.cargo_features != ''
# - name: Cargo fmt
# run: cargo +${{ matrix.rust }} fmt --all -- --check
# if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly'

- name: Build
run: cargo +${{ matrix.rust }} build
if: matrix.cargo_features == ''
# - name: Cargo clippy
# run: cargo +${{ matrix.rust }} clippy --all-targets --workspace
# if: matrix.os == 'ubuntu-latest' && matrix.rust == 'nightly'

- name: Test
run: cargo +${{ matrix.rust }} test --features "${{ matrix.cargo_features }}"
if: matrix.cargo_features != ''
# - name: Build
# run: cargo +${{ matrix.rust }} build

- name: Test
run: cargo +${{ matrix.rust }} test
if: matrix.cargo_features == ''
# - name: Test
# run: cargo +${{ matrix.rust }} test

- name: Benchmark
if: matrix.rust == 'nightly'
run: cargo +${{ matrix.rust }} bench
run: cargo +${{ matrix.rust }} bench -- 'or/fast'

- name: Minimal versions
if: matrix.rust == 'nightly'
run: cargo +${{ matrix.rust }} -Zdirect-minimal-versions test
# - name: Minimal versions
# if: matrix.rust == 'nightly'
# run: cargo +${{ matrix.rust }} -Zdirect-minimal-versions test
3 changes: 3 additions & 0 deletions croaring-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ fn main() {
println!("cargo:rerun-if-env-changed=ROARING_ARCH");

let mut build = cc::Build::new();
let compiler = build.get_compiler();
build.file("CRoaring/roaring.c");

if let Ok(target_arch) = env::var("ROARING_ARCH") {
build.flag_if_supported(&format!("-march={target_arch}"));
}

build.flag_if_supported("-Wno-unused-function");
eprintln!("compiler {:?}", compiler);
eprintln!("build: {build:#?}");
build.compile("roaring");
}
9 changes: 9 additions & 0 deletions croaring/src/bitmap/imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,15 @@ impl Bitmap {
#[doc(alias = "roaring_bitmap_or_many")]
#[must_use]
pub fn fast_or(bitmaps: &[&Bitmap]) -> Self {
#[cfg(windows)]
{
extern "C" {
pub fn croaring_hardware_support() -> std::ffi::c_int;
}
eprintln!("hardware support: {:x}", unsafe {
croaring_hardware_support()
});
}
let mut bms: Vec<*const ffi::roaring_bitmap_s> = bitmaps
.iter()
.map(|item| ptr::addr_of!(item.bitmap))
Expand Down
17 changes: 17 additions & 0 deletions roaring_fast_or.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include "croaring-sys/CRoaring/roaring.c"

int main(void) {
roaring_bitmap_t *r1 = roaring_bitmap_of(2, 500, 1000);
roaring_bitmap_t *r2 = roaring_bitmap_of(2, 1000, 2000);

const roaring_bitmap_t *bitmap_arr[2] = {r1, r2};
for (int i = 0; i < 10000; i++) {
roaring_bitmap_t *r = roaring_bitmap_or_many(2, bitmap_arr);
roaring_bitmap_free(r);
}

printf("Got done\n");

roaring_bitmap_free(r2);
roaring_bitmap_free(r1);
}

0 comments on commit b6455dc

Please sign in to comment.