Skip to content

Commit 7229f5f

Browse files
authored
Merge pull request #670 from sanpeqf/feat-platform
ci github: added corss compile tests
2 parents 328de55 + f767ab0 commit 7229f5f

File tree

12 files changed

+363
-117
lines changed

12 files changed

+363
-117
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: build default on ubuntu aarch64 gcc
2+
3+
on:
4+
repository_dispatch:
5+
workflow_dispatch:
6+
push:
7+
pull_request:
8+
schedule:
9+
- cron: '0 */2 * * *'
10+
11+
env:
12+
BUILD_TYPE: Release
13+
LD_LIBRARY_PATH: /usr/aarch64-linux-gnu/lib
14+
15+
jobs:
16+
build:
17+
name: Test on ${{matrix.os}}
18+
runs-on: ${{matrix.os}}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-22.04]
22+
23+
steps:
24+
- name: checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: install dependencies
30+
run: |
31+
sudo apt update
32+
sudo apt install cmake make qemu-user-binfmt \
33+
gcc gcc-aarch64-linux-gnu
34+
35+
- name: configure cmake
36+
run: |
37+
cmake -B ${{github.workspace}}/build \
38+
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install \
39+
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
40+
-D CMAKE_C_COMPILER=aarch64-linux-gnu-gcc \
41+
-D HOST_C_COMPILER=gcc \
42+
-D BFDEV_STRICT=ON \
43+
-D BFDEV_EXAMPLES=ON \
44+
-D BFDEV_TESTSUITE=ON
45+
46+
- name: make
47+
run: |
48+
cmake --build ${{github.workspace}}/build \
49+
--config ${{env.BUILD_TYPE}}
50+
51+
- name: install
52+
run: |
53+
cmake --build ${{github.workspace}}/build \
54+
--config ${{env.BUILD_TYPE}} -- install
55+
56+
- name: ctest
57+
working-directory: ${{github.workspace}}/build
58+
run: |
59+
sudo ln -s /usr/aarch64-linux-gnu/lib/ld-linux-aarch64.so.1 /lib
60+
ctest -C ${{env.BUILD_TYPE}} -V
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: build default on ubuntu armv7 gcc
2+
3+
on:
4+
repository_dispatch:
5+
workflow_dispatch:
6+
push:
7+
pull_request:
8+
schedule:
9+
- cron: '0 */2 * * *'
10+
11+
env:
12+
BUILD_TYPE: Release
13+
LD_LIBRARY_PATH: /usr/arm-linux-gnueabihf/lib
14+
15+
jobs:
16+
build:
17+
name: Test on ${{matrix.os}}
18+
runs-on: ${{matrix.os}}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-22.04]
22+
23+
steps:
24+
- name: checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: install dependencies
30+
run: |
31+
sudo apt update
32+
sudo apt install cmake make qemu-user-binfmt \
33+
gcc gcc-arm-linux-gnueabihf
34+
35+
- name: configure cmake
36+
run: |
37+
cmake -B ${{github.workspace}}/build \
38+
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install \
39+
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
40+
-D CMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \
41+
-D HOST_C_COMPILER=gcc \
42+
-D BFDEV_STRICT=ON \
43+
-D BFDEV_EXAMPLES=ON \
44+
-D BFDEV_TESTSUITE=ON
45+
46+
- name: make
47+
run: |
48+
cmake --build ${{github.workspace}}/build \
49+
--config ${{env.BUILD_TYPE}}
50+
51+
- name: install
52+
run: |
53+
cmake --build ${{github.workspace}}/build \
54+
--config ${{env.BUILD_TYPE}} -- install
55+
56+
- name: ctest
57+
working-directory: ${{github.workspace}}/build
58+
run: |
59+
sudo ln -s /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib
60+
ctest -C ${{env.BUILD_TYPE}} -V
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: build default on ubuntu mips gcc
2+
3+
on:
4+
repository_dispatch:
5+
workflow_dispatch:
6+
push:
7+
pull_request:
8+
schedule:
9+
- cron: '0 */2 * * *'
10+
11+
env:
12+
BUILD_TYPE: Release
13+
LD_LIBRARY_PATH: /usr/mips-linux-gnu/lib
14+
15+
jobs:
16+
build:
17+
name: Test on ${{matrix.os}}
18+
runs-on: ${{matrix.os}}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-22.04]
22+
23+
steps:
24+
- name: checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: install dependencies
30+
run: |
31+
sudo apt update
32+
sudo apt install cmake make qemu-user-binfmt \
33+
gcc gcc-mips-linux-gnu
34+
35+
- name: configure cmake
36+
run: |
37+
cmake -B ${{github.workspace}}/build \
38+
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install \
39+
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
40+
-D CMAKE_C_COMPILER=mips-linux-gnu-gcc \
41+
-D HOST_C_COMPILER=gcc \
42+
-D BFDEV_STRICT=ON \
43+
-D BFDEV_EXAMPLES=ON \
44+
-D BFDEV_TESTSUITE=ON
45+
46+
- name: make
47+
run: |
48+
cmake --build ${{github.workspace}}/build \
49+
--config ${{env.BUILD_TYPE}}
50+
51+
- name: install
52+
run: |
53+
cmake --build ${{github.workspace}}/build \
54+
--config ${{env.BUILD_TYPE}} -- install
55+
56+
- name: ctest
57+
working-directory: ${{github.workspace}}/build
58+
run: |
59+
sudo ln -s /usr/mips-linux-gnu/lib/ld.so.1 /lib
60+
ctest -C ${{env.BUILD_TYPE}} -V
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: build default on ubuntu mips64 gcc
2+
3+
on:
4+
repository_dispatch:
5+
workflow_dispatch:
6+
push:
7+
pull_request:
8+
schedule:
9+
- cron: '0 */2 * * *'
10+
11+
env:
12+
BUILD_TYPE: Release
13+
LD_LIBRARY_PATH: /usr/mips64-linux-gnuabi64/lib
14+
15+
jobs:
16+
build:
17+
name: Test on ${{matrix.os}}
18+
runs-on: ${{matrix.os}}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-22.04]
22+
23+
steps:
24+
- name: checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: install dependencies
30+
run: |
31+
sudo apt update
32+
sudo apt install cmake make qemu-user-binfmt \
33+
gcc gcc-mips64-linux-gnuabi64
34+
35+
- name: configure cmake
36+
run: |
37+
cmake -B ${{github.workspace}}/build \
38+
-D CMAKE_INSTALL_PREFIX=${{github.workspace}}/build/install \
39+
-D CMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \
40+
-D CMAKE_C_COMPILER=mips64-linux-gnuabi64-gcc \
41+
-D HOST_C_COMPILER=gcc \
42+
-D BFDEV_STRICT=ON \
43+
-D BFDEV_EXAMPLES=ON \
44+
-D BFDEV_TESTSUITE=ON
45+
46+
- name: make
47+
run: |
48+
cmake --build ${{github.workspace}}/build \
49+
--config ${{env.BUILD_TYPE}}
50+
51+
- name: install
52+
run: |
53+
cmake --build ${{github.workspace}}/build \
54+
--config ${{env.BUILD_TYPE}} -- install
55+
56+
- name: ctest
57+
working-directory: ${{github.workspace}}/build
58+
run: |
59+
sudo ln -s /usr/mips64-linux-gnuabi64/lib/ld.so.1 /lib64
60+
ctest -C ${{env.BUILD_TYPE}} -V

README.md

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,17 @@ bfdev is a high-performance, aesthetically pleasing, and portable infrastructure
88

99
## Continuous Integration Status
1010

11-
| Status (master) | Status (devel) | Description |
12-
| :----------------------------------------------------------: | :----------------------------------------------------------: | :----------------------------------: |
13-
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-gcc.yml?query=branch%3Adevel) | Build default config on Ubuntu gcc |
14-
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-clang.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-clang.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-clang.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-clang.yml?query=branch%3Adevel) | Build default config on Ubuntu clang |
15-
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/macos.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/macos.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/macos.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/macos.yml?query=branch%3Adevel) | Build default config on Macos |
16-
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/windows.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/windows.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/windows.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/windows.yml?query=branch%3Adevel) | Build default config on Windows |
17-
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml?query=branch%3Adevel) | Code analyse on codeql |
11+
| Status (master) | Status (devel) | Description |
12+
| :-------------: | :------------: | :---------: |
13+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-gcc.yml?query=branch%3Adevel) | Build default config on Ubuntu GCC |
14+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-clang.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-clang.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-clang.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-clang.yml?query=branch%3Adevel) | Build default config on Ubuntu Clang |
15+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/macos.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/macos.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/macos.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/macos.yml?query=branch%3Adevel) | Build default config on Macos |
16+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/windows.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/windows.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/windows.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/windows.yml?query=branch%3Adevel) | Build default config on Windows |
17+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-armv7-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-armv7-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-armv7-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-armv7-gcc.yml?query=branch%3Adevel) | Cross build ARMv7 default on Ubuntu GCC |
18+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-aarch64-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-aarch64-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-aarch64-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-aarch64-gcc.yml?query=branch%3Adevel) | Cross build AArch64 default on Ubuntu GCC |
19+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips-gcc.yml?query=branch%3Adevel) | Cross build MIPS default on Ubuntu GCC |
20+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips64-gcc.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips64-gcc.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips64-gcc.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/ubuntu-mips64-gcc.yml?query=branch%3Adevel) | Cross build MIPS64 default on Ubuntu GCC |
21+
| [![build status](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml/badge.svg?branch=master)](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml?query=branch%3Amaster) | [![build status](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml/badge.svg?branch=devel)](https://github.com/openbfdev/bfdev/actions/workflows/codeql.yml?query=branch%3Adevel) | Code analyse on codeql |
1822

1923
## Why Choose
2024

include/bfdev/bitmap.h

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ BFDEV_BEGIN_DECLS
3636
bfdev_align_check(bits, BFDEV_BITMAP_ALIGN) \
3737
)
3838

39+
#define bfdev_bitmap_size(nbits) \
40+
BFDEV_BITS_DIV_U8(bfdev_align_high(nbits, BFDEV_BITS_PER_LONG))
41+
3942
static __bfdev_always_inline bfdev_bool
4043
bfdev_bitmap_empty(const unsigned long *src, unsigned int bits)
4144
{
@@ -45,7 +48,7 @@ bfdev_bitmap_empty(const unsigned long *src, unsigned int bits)
4548
if (!bfdev_bitmap_const_aligned(bits))
4649
return bfdev_find_first_bit(src, bits) >= bits;
4750

48-
return !bfdev_memdiff(src, BFDEV_UINT8_MIN, bits / BFDEV_BITS_PER_BYTE);
51+
return !bfdev_memdiff(src, BFDEV_UINT8_MIN, BFDEV_BITS_DIV_U8(bits));
4952
}
5053

5154
static __bfdev_always_inline bfdev_bool
@@ -57,7 +60,7 @@ bfdev_bitmap_full(const unsigned long *src, unsigned int bits)
5760
if (!bfdev_bitmap_const_aligned(bits))
5861
return bfdev_find_first_zero(src, bits) >= bits;
5962

60-
return !bfdev_memdiff(src, BFDEV_UINT8_MAX, bits / BFDEV_BITS_PER_BYTE);
63+
return !bfdev_memdiff(src, BFDEV_UINT8_MAX, BFDEV_BITS_DIV_U8(bits));
6164
}
6265

6366
static __bfdev_always_inline bfdev_bool
@@ -70,7 +73,7 @@ bfdev_bitmap_equal(const unsigned long *src1, const unsigned long *src2,
7073
if (!bfdev_bitmap_const_aligned(bits))
7174
return bfdev_bitmap_comp_equal(src1, src2, bits);
7275

73-
return bfdev_memcmp(src1, src2, bits / BFDEV_BITS_PER_BYTE);
76+
return bfdev_memcmp(src1, src2, BFDEV_BITS_DIV_U8(bits));
7477
}
7578

7679
static __bfdev_always_inline bfdev_bool
@@ -202,8 +205,8 @@ bfdev_bitmap_set(unsigned long *bitmap, unsigned int start, unsigned int bits)
202205
!bfdev_bitmap_const_aligned(bits))
203206
return bfdev_bitmap_comp_set(bitmap, start, bits);
204207

205-
offset = start / BFDEV_BITS_PER_BYTE;
206-
size = bits / BFDEV_BITS_PER_BYTE;
208+
offset = BFDEV_BITS_DIV_U8(start);
209+
size = BFDEV_BITS_DIV_U8(bits);
207210

208211
bfdev_memset((char *)bitmap + offset, 0xff, size);
209212
}
@@ -220,8 +223,8 @@ bfdev_bitmap_clr(unsigned long *bitmap, unsigned int start, unsigned int bits)
220223
!bfdev_bitmap_const_aligned(bits))
221224
return bfdev_bitmap_comp_clr(bitmap, start, bits);
222225

223-
offset = start / BFDEV_BITS_PER_BYTE;
224-
size = bits / BFDEV_BITS_PER_BYTE;
226+
offset = BFDEV_BITS_DIV_U8(start);
227+
size = BFDEV_BITS_DIV_U8(bits);
225228

226229
bfdev_memset((char *)bitmap + offset, 0, size);
227230
}
@@ -236,7 +239,7 @@ bfdev_bitmap_zero(unsigned long *bitmap, unsigned int bits)
236239
return;
237240
}
238241

239-
length = BFDEV_BITS_TO_U8(bits);
242+
length = bfdev_bitmap_size(bits);
240243
bfdev_memset(bitmap, 0, length);
241244
}
242245

@@ -250,7 +253,7 @@ bfdev_bitmap_fill(unsigned long *bitmap, unsigned int bits)
250253
return;
251254
}
252255

253-
length = BFDEV_BITS_TO_U8(bits);
256+
length = bfdev_bitmap_size(bits);
254257
bfdev_memset(bitmap, BFDEV_UINT8_MAX, length);
255258
}
256259

@@ -264,7 +267,7 @@ bfdev_bitmap_copy(unsigned long *dest, unsigned long *src, unsigned int bits)
264267
return;
265268
}
266269

267-
length = BFDEV_BITS_TO_U8(bits);
270+
length = bfdev_bitmap_size(bits);
268271
bfdev_memcpy(dest, src, length);
269272
}
270273

0 commit comments

Comments
 (0)