Skip to content

Commit 73ccdf8

Browse files
committed
CI: Bump Ubuntu to 24.04-LTS
Ubuntu Linux 24.04 (noble) is the latest LTS release, and this commit updates the CI pipeline hosts and recommended development environments accordingly. The version of clang-format is updated to v18, with all C source files re-indented. LLVM is also upgraded to version 18. After the adjustment of benchmark iterations, Dhrystone and CoreMark take significantly longer, and the aggregation script is limited to single run.
1 parent 38e0907 commit 73ccdf8

File tree

9 files changed

+52
-45
lines changed

9 files changed

+52
-45
lines changed

.ci/check-format.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set -x
88

99
for file in ${SOURCES};
1010
do
11-
clang-format-12 ${file} > expected-format
11+
clang-format-18 ${file} > expected-format
1212
diff -u -p --label="${file}" --label="expected coding style" ${file} expected-format
1313
done
14-
exit $(clang-format-12 --output-replacements-xml ${SOURCES} | egrep -c "</replacement>")
14+
exit $(clang-format-18 --output-replacements-xml ${SOURCES} | egrep -c "</replacement>")

.github/workflows/benchmark.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: default build
2929
if: ${{ steps.changed-files.outputs.any_changed == 'true' ||
3030
github.event_name == 'workflow_dispatch'}}
31-
run: make ENABLE_SDL=0
31+
run: make ENABLE_SDL=0 all artifact
3232
- name: Run benchmark
3333
if: ${{ steps.changed-files.outputs.any_changed == 'true' ||
3434
github.event_name == 'workflow_dispatch'}}

.github/workflows/main.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
detect-code-related-file-changes:
7-
runs-on: ubuntu-22.04
7+
runs-on: ubuntu-24.04
88
outputs:
99
has_code_related_changes: ${{ steps.set_has_code_related_changes.outputs.has_code_related_changes }}
1010
steps:
@@ -36,7 +36,7 @@ jobs:
3636
host-x64:
3737
needs: [detect-code-related-file-changes]
3838
if: needs.detect-code-related-file-changes.outputs.has_code_related_changes == 'true'
39-
runs-on: ubuntu-22.04
39+
runs-on: ubuntu-24.04
4040
steps:
4141
- uses: actions/checkout@v4
4242
- name: install-dependencies
@@ -46,7 +46,7 @@ jobs:
4646
.ci/riscv-toolchain-install.sh
4747
wget https://apt.llvm.org/llvm.sh
4848
sudo chmod +x ./llvm.sh
49-
sudo ./llvm.sh 17
49+
sudo ./llvm.sh 18
5050
shell: bash
5151
- name: default build
5252
run: make -j$(nproc)
@@ -80,14 +80,14 @@ jobs:
8080
host-arm64:
8181
needs: [detect-code-related-file-changes]
8282
if: needs.detect-code-related-file-changes.outputs.has_code_related_changes == 'true'
83-
runs-on: ubuntu-22.04
83+
runs-on: ubuntu-24.04
8484
steps:
8585
- name: checkout code
8686
uses: actions/checkout@v4
8787
- name: build artifact
8888
# The GitHub Action for non-x86 CPU
8989
# https://github.com/uraimo/run-on-arch-action
90-
uses: uraimo/run-on-arch-action@v2.7.1
90+
uses: uraimo/run-on-arch-action@v2
9191
with:
9292
arch: aarch64
9393
distro: ubuntu22.04
@@ -100,7 +100,7 @@ jobs:
100100
git config --global --add safe.directory ${{ github.workspace }}/src/mini-gdbstub
101101
wget https://apt.llvm.org/llvm.sh
102102
chmod +x ./llvm.sh
103-
./llvm.sh 17
103+
./llvm.sh 18
104104
# Append custom commands here
105105
run: |
106106
make -j$(nproc)
@@ -113,12 +113,12 @@ jobs:
113113
coding-style:
114114
needs: [detect-code-related-file-changes]
115115
if: needs.detect-code-related-file-changes.outputs.has_code_related_changes == 'true'
116-
runs-on: ubuntu-22.04
116+
runs-on: ubuntu-24.04
117117
steps:
118118
- uses: actions/checkout@v4
119119
- name: coding convention
120120
run: |
121-
sudo apt-get install -q -y clang-format-12
121+
sudo apt-get install -q -y clang-format-18
122122
.ci/check-newline.sh
123123
.ci/check-format.sh
124124
shell: bash
@@ -136,7 +136,7 @@ jobs:
136136
sudo apt-get install -q -y clang clang-tools libsdl2-dev libsdl2-mixer-dev
137137
wget https://apt.llvm.org/llvm.sh
138138
chmod +x ./llvm.sh
139-
sudo ./llvm.sh 17
139+
sudo ./llvm.sh 18
140140
shell: bash
141141
- name: run scan-build without JIT
142142
run: make distclean && scan-build -v -o ~/scan-build --status-bugs --use-cc=clang --force-analyze-debug-code --show-description -analyzer-config stable-report-filename=true -enable-checker valist,nullability make ENABLE_EXT_F=0 ENABLE_SDL=0 ENABLE_JIT=0
@@ -163,7 +163,7 @@ jobs:
163163
docker-hub-build-and-publish:
164164
needs: [detect-code-related-file-changes]
165165
if: needs.detect-code-related-file-changes.outputs.has_code_related_changes == 'true'
166-
runs-on: ubuntu-22.04
166+
runs-on: ubuntu-24.04
167167
steps:
168168
- name: Check out the repo
169169
uses: actions/checkout@v4

CONTRIBUTING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ However, participation requires adherence to fundamental ground rules:
4444
This variant should be considered the standard for all documentation efforts.
4545
For instance, opt for "initialize" over "initialise" and "color" rather than "colour".
4646

47-
Software requirement: [clang-format](https://clang.llvm.org/docs/ClangFormat.html) version 12 or later.
47+
Software requirement: [clang-format](https://clang.llvm.org/docs/ClangFormat.html) version 18 or later.
4848

4949
This repository consistently contains an up-to-date `.clang-format` file with rules that match the explained ones.
5050
For maintaining a uniform coding style, execute the command `clang-format -i *.{c,h}`.

src/rv32_template.c

+17-18
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,7 @@
119119
*/
120120

121121
/* Internal */
122-
RVOP(
123-
nop,
124-
{ rv->X[rv_reg_zero] = 0; },
125-
GEN({/* no operation */}))
122+
RVOP(nop, { rv->X[rv_reg_zero] = 0; }, GEN({/* no operation */}))
126123

127124
/* LUI is used to build 32-bit constants and uses the U-type format. LUI
128125
* places the U-immediate value in the top 20 bits of the destination
@@ -300,13 +297,14 @@ RVOP(
300297
if (!untaken) \
301298
goto nextop; \
302299
IIF(RV32_HAS(JIT)) \
303-
({ \
304-
cache_get(rv->block_cache, PC + 4, true); \
305-
if (!set_add(&pc_set, PC + 4)) \
306-
has_loops = true; \
307-
if (cache_hot(rv->block_cache, PC + 4)) \
308-
goto nextop; \
309-
}, ); \
300+
( \
301+
{ \
302+
cache_get(rv->block_cache, PC + 4, true); \
303+
if (!set_add(&pc_set, PC + 4)) \
304+
has_loops = true; \
305+
if (cache_hot(rv->block_cache, PC + 4)) \
306+
goto nextop; \
307+
}, ); \
310308
PC += 4; \
311309
last_pc = PC; \
312310
MUST_TAIL return untaken->impl(rv, untaken, cycle, PC); \
@@ -319,13 +317,14 @@ RVOP(
319317
struct rv_insn *taken = ir->branch_taken; \
320318
if (taken) { \
321319
IIF(RV32_HAS(JIT)) \
322-
({ \
323-
cache_get(rv->block_cache, PC, true); \
324-
if (!set_add(&pc_set, PC)) \
325-
has_loops = true; \
326-
if (cache_hot(rv->block_cache, PC)) \
327-
goto end_op; \
328-
}, ); \
320+
( \
321+
{ \
322+
cache_get(rv->block_cache, PC, true); \
323+
if (!set_add(&pc_set, PC)) \
324+
has_loops = true; \
325+
if (cache_hot(rv->block_cache, PC)) \
326+
goto end_op; \
327+
}, ); \
329328
last_pc = PC; \
330329
MUST_TAIL return taken->impl(rv, taken, cycle, PC); \
331330
} \

tests/coremark.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import json
77

8-
iter = 10
8+
iter = 1
99
coremark_param = "0x0 0x0 0x66 30000 7 1 2000"
1010
res = []
1111
file_exist = os.path.exists('build/rv32emu')
@@ -14,7 +14,7 @@
1414
exit(1)
1515
print("Start Test CoreMark benchmark")
1616
comp_proc = subprocess.check_output(
17-
"build/rv32emu build/coremark.elf {}".format(coremark_param), shell=True).decode("utf-8")
17+
"build/rv32emu build/riscv32/coremark {}".format(coremark_param), shell=True).decode("utf-8")
1818
if not comp_proc or comp_proc.find("Error") != -1:
1919
print("Test Error")
2020
exit(1)
@@ -24,7 +24,7 @@
2424
for i in range(iter):
2525
print("Running CoreMark benchmark - Run #{}".format(i + 1))
2626
comp_proc = subprocess.check_output(
27-
"build/rv32emu build/coremark.elf {}".format(coremark_param), shell=True).decode("utf-8")
27+
"build/rv32emu build/riscv32/coremark {}".format(coremark_param), shell=True).decode("utf-8")
2828
if not comp_proc:
2929
print("Fail\n")
3030
exit(1)

tests/dhrystone.sh

+10-2
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,26 @@
33
source tests/common.sh
44

55
# Set the number of runs for the Dhrystone benchmark
6-
N_RUNS=10
6+
N_RUNS=1
7+
8+
function sanity_check()
9+
{
10+
if test ! -f $O/riscv32/dhrystone; then
11+
make artifact || exit 1
12+
fi
13+
}
714

815
function run_dhrystone()
916
{
1017
# Run Dhrystone and extract the DMIPS value
11-
output=$($RUN $O/dhrystone.elf 2>&1)
18+
output=$($RUN $O/riscv32/dhrystone 2>&1)
1219
local exit_code=$?
1320
[ $exit_code -ne 0 ] && fail
1421
dmips=$(echo "$output" | grep -oE '[0-9]+' | awk 'NR==5{print}')
1522
echo "$dmips"
1623
}
1724

25+
sanity_check
1826
# Run Dhrystone benchmark and collect DMIPS values
1927
dmips_values=()
2028
for ((i=1; i<=$N_RUNS; i++))

tests/line.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void svpng(FILE *fp, unsigned w, unsigned h, const uint8_t *img, bool alpha)
7777
SVPNG_PUT((u) >> 24); \
7878
SVPNG_PUT(((u) >> 16) & 255); \
7979
SVPNG_PUT(((u) >> 8) & 255); \
80-
SVPNG_PUT((u) &255); \
80+
SVPNG_PUT((u) & 255); \
8181
} while (0)
8282

8383
#define SVPNG_U8C(u) \
@@ -94,7 +94,7 @@ void svpng(FILE *fp, unsigned w, unsigned h, const uint8_t *img, bool alpha)
9494

9595
#define SVPNG_U16LC(u) \
9696
do { \
97-
SVPNG_U8C((u) &255); \
97+
SVPNG_U8C((u) & 255); \
9898
SVPNG_U8C(((u) >> 8) & 255); \
9999
} while (0)
100100

@@ -103,7 +103,7 @@ void svpng(FILE *fp, unsigned w, unsigned h, const uint8_t *img, bool alpha)
103103
SVPNG_U8C((u) >> 24); \
104104
SVPNG_U8C(((u) >> 16) & 255); \
105105
SVPNG_U8C(((u) >> 8) & 255); \
106-
SVPNG_U8C((u) &255); \
106+
SVPNG_U8C((u) & 255); \
107107
} while (0)
108108

109109
#define SVPNG_U8ADLER(u) \

tests/uaes.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ static void doubleBGF128(block_t block)
951951
{ /* first: left-shift, then */
952952
c |= block[--i] << 1; /* append the previous MSBit */
953953
block[i] = (uint8_t) c;
954-
} /* if first MSBit is carried */
954+
} /* if first MSBit is carried */
955955
block[LAST] ^= c * 0x87; /* .. B ^= 10000111b (B.E.) */
956956
}
957957
#endif
@@ -1132,7 +1132,7 @@ static char padBlock(const uint8_t len, block_t block)
11321132
memset(p, n * (AES_PADDING != 2), n);
11331133
*p ^= '\x80' * (AES_PADDING == 2); /* either PKCS#7 / IEC7816-4 */
11341134
#else
1135-
if (len) /* default (zero) padding */
1135+
if (len) /* default (zero) padding */
11361136
{
11371137
memset(block + len, 0, BLOCKSIZE - len);
11381138
}
@@ -1294,7 +1294,7 @@ char AES_CBC_decrypt(const uint8_t *key,
12941294
xorBlock(iv, y); /* IV_next = C */
12951295
iv = x;
12961296
x += BLOCKSIZE;
1297-
} /* r = 0 unless CTS enabled */
1297+
} /* r = 0 unless CTS enabled */
12981298
if (r) { /* P2 = Dec(C1) ^ C2 */
12991299
mixThenXor(&rijndaelDecrypt, x, y, x + BLOCKSIZE, r, y + BLOCKSIZE);
13001300
memcpy(y, x + BLOCKSIZE, r);
@@ -1544,7 +1544,7 @@ static void XEX_Cipher(fmix_t cipher,
15441544

15451545
if (sectid == ~(size_t) 0) { /* the `i` block is either */
15461546
memcpy(T, tweak, BLOCKSIZE); /* ..a little-endian number */
1547-
} /* ..or a byte array. */
1547+
} /* ..or a byte array. */
15481548
else {
15491549
memset(T, 0, BLOCKSIZE);
15501550
copyLVal(T, sectid, 0);
@@ -2537,7 +2537,7 @@ static void modP1305(uint8_t *block, const int ovrfl)
25372537
{
25382538
t += block[i]; /* to get mod, first derive */
25392539
block[i++] = (uint8_t) t; /* .. B + (5 * q) and then */
2540-
} /* .. subtract q * (2^130) */
2540+
} /* .. subtract q * (2^130) */
25412541
block[SP - 1] -= 4 * (uint8_t) q;
25422542
}
25432543

0 commit comments

Comments
 (0)