Skip to content

Commit 17fc4ec

Browse files
1a1a11ahaochengxia
andauthored
refactor: enable macos build workflow (#217)
* refactor: update macOS job configuration and upgrade checkout action to v4 * fix workflow * change compiler to default * fix * Pin seed for cross-plat test --------- Co-authored-by: haochengxia <xhc_1007@163.com>
1 parent 79e928c commit 17fc4ec

2 files changed

Lines changed: 28 additions & 28 deletions

File tree

.github/workflows/build.yml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@ name: build
22

33
on: [push, pull_request]
44

5+
permissions:
6+
contents: read
7+
58
env:
69
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
710
BUILD_TYPE: Release
811

912
jobs:
10-
# macos:
11-
# name: macos / clang
12-
# runs-on: macos-10.15
13-
# env:
14-
# CC: clang
15-
# steps:
16-
# - uses: actions/checkout@v2
17-
# - name: Prepare1
18-
# run: brew install gcc glib google-perftools libomp
19-
# - name: Prepare2
20-
# run: bash scripts/setup.sh
21-
# - name: Configure CMake
22-
# run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
23-
# - name: build
24-
# run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
25-
# - name: Run
26-
# continue-on-error: true
27-
# run: make test
13+
macos:
14+
name: macos / clang
15+
runs-on: macos-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Prepare
19+
run: bash scripts/install_dependency.sh
20+
- name: Configure CMake
21+
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
22+
- name: Build
23+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
24+
- name: Test
25+
working-directory: ${{github.workspace}}/build
26+
run: |
27+
ctest -C ${{env.BUILD_TYPE}} --output-on-failure
2828
2929
ubuntu:
3030
runs-on: ubuntu-latest
3131
steps:
32-
- uses: actions/checkout@v2
32+
- uses: actions/checkout@v4
3333
- name: Prepare
3434
run: bash scripts/install_dependency.sh
3535
- name: Configure CMake with LSan
@@ -49,7 +49,7 @@ jobs:
4949
selfhosted:
5050
runs-on: self-hosted
5151
steps:
52-
- uses: actions/checkout@v2
52+
- uses: actions/checkout@v4
5353
- name: Configure CMake
5454
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DENABLE_GLCACHE=on -DENABLE_LRB=on
5555
- name: Build

test/test_evictionAlgo.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ static void print_results(const cache_t *cache, const cache_stat_t *res) {
2828
}
2929
printf("};\n");
3030

31-
printf("uint64_t miss_cnt_true[] = {");
31+
printf("uint64_t miss_cnt[] = {");
3232
printf("%ld", (long)res[0].n_miss);
3333
for (uint64_t i = 1; i < CACHE_SIZE / STEP_SIZE; i++) {
3434
printf(", %ld", (long)res[i].n_miss);
3535
}
3636
printf("};\n");
3737

38-
printf("uint64_t miss_byte_true[] = {");
38+
printf("uint64_t miss_byte[] = {");
3939
printf("%ld", (long)res[0].n_miss_byte);
4040
for (uint64_t i = 1; i < CACHE_SIZE / STEP_SIZE; i++) {
4141
printf(", %ld", (long)res[i].n_miss_byte);
@@ -327,10 +327,10 @@ static void test_LeCaR(gconstpointer user_data) {
327327
}
328328

329329
static void test_Cacheus(gconstpointer user_data) {
330-
uint64_t miss_cnt_true[] = {89776, 82725, 78839, 73048,
331-
69329, 69184, 69117, 66048};
332-
uint64_t miss_byte_true[] = {4048868864, 3727920128, 3489738752, 3184179200,
333-
2981198336, 2968055296, 2925565440, 2789046784};
330+
uint64_t miss_cnt_true[] = {90052, 82866, 77130, 77115,
331+
69828, 68435, 67930, 66993};
332+
uint64_t miss_byte_true[] = {4068200448, 3757362176, 3439912448, 3359079424,
333+
3018722816, 2928907776, 2867576832, 2834809856};
334334

335335
reader_t *reader = (reader_t *)user_data;
336336
common_cache_params_t cc_params = {
@@ -607,8 +607,8 @@ static void empty_test(gconstpointer user_data) { ; }
607607

608608
int main(int argc, char *argv[]) {
609609
g_test_init(&argc, &argv, NULL);
610-
srand(0); // for reproducibility
611-
set_rand_seed(rand());
610+
srand(0); // for reproducibility
611+
set_rand_seed(42); // Use fixed seed for cross-platform consistency
612612

613613
reader_t *reader;
614614

0 commit comments

Comments
 (0)