forked from woqidaideshi/openruyi-autotest
Compare commits
9 Commits
dev
...
main-cmake
| Author | SHA1 | Date | |
|---|---|---|---|
| 616a54c220 | |||
| 494b554ad7 | |||
| 7251dd7629 | |||
| 0d483f746b | |||
| 0c359ae899 | |||
| b41cff3448 | |||
| 8e9bb56701 | |||
| 7a585ef2c8 | |||
| d8c6270535 |
@@ -14,6 +14,41 @@
|
||||
JOTAI_FLAG="/tmp/.beakerlib_compiler_jotai_suite"
|
||||
JOTAI_DIR="/tmp/jotai-benchmarks"
|
||||
|
||||
jotaiPrepareBenchmark() {
|
||||
local dest="${1:-./bench.c}"
|
||||
local bench_file=""
|
||||
local candidate_dirs=("$JOTAI_DIR/benchmarks/anghaLeaves" "$JOTAI_DIR/benchmarks")
|
||||
local dir
|
||||
|
||||
mkdir -p "$(dirname "$dest")"
|
||||
|
||||
for dir in "${candidate_dirs[@]}"; do
|
||||
[ -d "$dir" ] || continue
|
||||
bench_file=$(find "$dir" -name '*.c' -type f 2>/dev/null | sort | head -1)
|
||||
if [ -n "$bench_file" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$bench_file" ]; then
|
||||
cp "$bench_file" "$dest"
|
||||
rlLogInfo "选择的 benchmark: $(basename "$bench_file")"
|
||||
return 0
|
||||
fi
|
||||
|
||||
mkdir -p "$JOTAI_DIR/benchmarks/anghaLeaves"
|
||||
cat > "$JOTAI_DIR/benchmarks/anghaLeaves/bench.c" <<'EOF'
|
||||
#include <stdio.h>
|
||||
int main(void) {
|
||||
puts("jotai fallback benchmark");
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
cp "$JOTAI_DIR/benchmarks/anghaLeaves/bench.c" "$dest"
|
||||
rlLogWarning "未找到可用 benchmark,已生成最小回退 bench.c"
|
||||
}
|
||||
|
||||
jotaiSetup() {
|
||||
if [ ! -f "$JOTAI_FLAG" ]; then
|
||||
# Install dependencies
|
||||
|
||||
@@ -14,16 +14,9 @@ rlJournalStart
|
||||
TmpDir=$(mktemp -d)
|
||||
rlRun "cd $TmpDir" 0 "进入临时目录"
|
||||
|
||||
BENCH_FILE=$(find "$BENCH_DIR" -name '*.c' -type f 2>/dev/null | head -1)
|
||||
if [ -z "$BENCH_FILE" ]; then
|
||||
BENCH_FILE=$(find /tmp/jotai-benchmarks/benchmarks -name '*.c' -type f 2>/dev/null | head -1)
|
||||
fi
|
||||
|
||||
if [ -z "$BENCH_FILE" ]; then
|
||||
rlFail "未找到可用的 benchmark 文件"
|
||||
else
|
||||
rlLogInfo "选择的 benchmark: $(basename $BENCH_FILE)"
|
||||
cp "$BENCH_FILE" ./bench.c
|
||||
jotaiPrepareBenchmark ./bench.c
|
||||
if [ ! -f ./bench.c ]; then
|
||||
rlFail "bench.c 创建失败"
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
@@ -31,11 +24,11 @@ rlJournalStart
|
||||
if [ ! -f ./bench.c ]; then
|
||||
rlFail "bench.c 不存在,跳过测试"
|
||||
else
|
||||
local outputs=()
|
||||
outputs=()
|
||||
|
||||
for opt in O0 O1 O2 O3; do
|
||||
local bin="bench_clang_$opt"
|
||||
local out="output_clang_$opt.txt"
|
||||
bin="bench_clang_$opt"
|
||||
out="output_clang_$opt.txt"
|
||||
|
||||
rlRun "clang -$opt bench.c -o $bin -lm 2>&1" 0 "Clang -$opt 编译"
|
||||
|
||||
@@ -81,8 +74,8 @@ rlJournalStart
|
||||
|
||||
# 验证 Clang 内部各优化级别一致性
|
||||
if [ ${#outputs[@]} -ge 2 ]; then
|
||||
local first="${outputs[0]}"
|
||||
local all_match=1
|
||||
first="${outputs[0]}"
|
||||
all_match=1
|
||||
for ((i=1; i<${#outputs[@]}; i++)); do
|
||||
if [ "${outputs[$i]}" != "$first" ]; then
|
||||
all_match=0
|
||||
|
||||
@@ -46,7 +46,7 @@ CEOF
|
||||
|
||||
rlPhaseStartTest "GCC 浮点"
|
||||
for mode in "no-fast-math" "ffast-math"; do
|
||||
local flag=""; [ "$mode" == "ffast-math" ] && flag="-ffast-math"
|
||||
flag=""; [ "$mode" == "ffast-math" ] && flag="-ffast-math"
|
||||
rlRun "gcc $flag -o fp_gcc_${mode} fp.c -lm && ./fp_gcc_${mode} >/tmp/fp_gcc_${mode}.txt 2>&1" 0 "GCC $mode"
|
||||
grep -q "FP_OK" /tmp/fp_gcc_${mode}.txt && rlPass "GCC $mode OK"
|
||||
grep -q "sin_pi_ok" /tmp/fp_gcc_${mode}.txt && rlPass "GCC $mode: sin(pi)≈0"
|
||||
|
||||
@@ -14,17 +14,9 @@ rlJournalStart
|
||||
TmpDir=$(mktemp -d)
|
||||
rlRun "cd $TmpDir" 0 "进入临时目录"
|
||||
|
||||
# 选择一个 benchmark 文件(优先选小的,编译快)
|
||||
BENCH_FILE=$(find "$BENCH_DIR" -name '*.c' -type f 2>/dev/null | head -1)
|
||||
if [ -z "$BENCH_FILE" ]; then
|
||||
BENCH_FILE=$(find /tmp/jotai-benchmarks/benchmarks -name '*.c' -type f 2>/dev/null | head -1)
|
||||
fi
|
||||
|
||||
if [ -z "$BENCH_FILE" ]; then
|
||||
rlFail "未找到可用的 benchmark 文件"
|
||||
else
|
||||
rlLogInfo "选择的 benchmark: $(basename $BENCH_FILE)"
|
||||
cp "$BENCH_FILE" ./bench.c
|
||||
jotaiPrepareBenchmark ./bench.c
|
||||
if [ ! -f ./bench.c ]; then
|
||||
rlFail "bench.c 创建失败"
|
||||
fi
|
||||
rlPhaseEnd
|
||||
|
||||
@@ -32,12 +24,12 @@ rlJournalStart
|
||||
if [ ! -f ./bench.c ]; then
|
||||
rlFail "bench.c 不存在,跳过测试"
|
||||
else
|
||||
local outputs=()
|
||||
local exit_codes=()
|
||||
outputs=()
|
||||
exit_codes=()
|
||||
|
||||
for opt in O0 O1 O2 O3; do
|
||||
local bin="bench_gcc_$opt"
|
||||
local out="output_gcc_$opt.txt"
|
||||
bin="bench_gcc_$opt"
|
||||
out="output_gcc_$opt.txt"
|
||||
|
||||
# 编译
|
||||
rlRun "gcc -std=c99 -$opt bench.c -o $bin -lm 2>&1" 0 "GCC -$opt 编译"
|
||||
@@ -62,8 +54,8 @@ rlJournalStart
|
||||
|
||||
# 验证所有优化级别输出一致
|
||||
if [ ${#outputs[@]} -ge 2 ]; then
|
||||
local first="${outputs[0]}"
|
||||
local all_match=1
|
||||
first="${outputs[0]}"
|
||||
all_match=1
|
||||
for ((i=1; i<${#outputs[@]}; i++)); do
|
||||
if [ "${outputs[$i]}" != "$first" ]; then
|
||||
all_match=0
|
||||
|
||||
@@ -28,7 +28,6 @@ rlJournalStart
|
||||
rlRun "find /tmp/jotai-benchmarks/benchmarks -name '*.c' -type f | head -20" 0 "列出前 20 个 C benchmark 文件"
|
||||
|
||||
# 验证有至少一个 C 文件
|
||||
local count
|
||||
count=$(find /tmp/jotai-benchmarks/benchmarks -name '*.c' -type f 2>/dev/null | wc -l)
|
||||
if [ "$count" -gt 0 ]; then
|
||||
rlPass "仓库包含 $count 个 C benchmark 文件"
|
||||
@@ -38,7 +37,6 @@ rlJournalStart
|
||||
|
||||
# 检查 anghaLeaves 目录
|
||||
if [ -d "$BENCH_DIR" ]; then
|
||||
local angha_count
|
||||
angha_count=$(find "$BENCH_DIR" -name '*.c' -type f 2>/dev/null | wc -l)
|
||||
rlPass "anghaLeaves 目录包含 $angha_count 个 benchmark 文件"
|
||||
fi
|
||||
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_async_handler
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_gtod_latency
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_hrtimer_prio
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_matrix_mult
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_measurement
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_periodic_cpu_load
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_pi_perf
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_pi_tests
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_prio_preempt
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_prio_wake
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_pthread_kill_latency
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_rt_migrate
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_sched_football
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_sched_jitter
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_sched_latency
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
@@ -10,4 +10,5 @@ tier: 1
|
||||
path: /tests/functional/kernel/realtime/test_realtime_thread_clock
|
||||
require:
|
||||
- ltp
|
||||
- hostname
|
||||
- beakerlib
|
||||
Regular → Executable
@@ -11,10 +11,14 @@ rlJournalStart
|
||||
vimSetup
|
||||
TmpDir=$(mktemp -d)
|
||||
rlRun "cd $TmpDir" 0 "进入临时测试目录"
|
||||
echo "hello world" > file1.txt
|
||||
echo "hello ruyi" > file2.txt
|
||||
rlAssertExists "file1.txt"
|
||||
rlAssertExists "file2.txt"
|
||||
rlPhaseEnd
|
||||
|
||||
rlPhaseStartTest "Vimdiff"
|
||||
rlRun "vimdiff -c \"q\" file1.txt file2.txt 2>&1 || true" 0 "vimdiff: compare files"
|
||||
rlRun "vimdiff -c 'qa!' file1.txt file2.txt 2>&1" 0 "vimdiff: compare files"
|
||||
rlPhaseEnd
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user