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_FLAG="/tmp/.beakerlib_compiler_jotai_suite"
|
||||||
JOTAI_DIR="/tmp/jotai-benchmarks"
|
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() {
|
jotaiSetup() {
|
||||||
if [ ! -f "$JOTAI_FLAG" ]; then
|
if [ ! -f "$JOTAI_FLAG" ]; then
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
|
|||||||
@@ -14,16 +14,9 @@ rlJournalStart
|
|||||||
TmpDir=$(mktemp -d)
|
TmpDir=$(mktemp -d)
|
||||||
rlRun "cd $TmpDir" 0 "进入临时目录"
|
rlRun "cd $TmpDir" 0 "进入临时目录"
|
||||||
|
|
||||||
BENCH_FILE=$(find "$BENCH_DIR" -name '*.c' -type f 2>/dev/null | head -1)
|
jotaiPrepareBenchmark ./bench.c
|
||||||
if [ -z "$BENCH_FILE" ]; then
|
if [ ! -f ./bench.c ]; then
|
||||||
BENCH_FILE=$(find /tmp/jotai-benchmarks/benchmarks -name '*.c' -type f 2>/dev/null | head -1)
|
rlFail "bench.c 创建失败"
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$BENCH_FILE" ]; then
|
|
||||||
rlFail "未找到可用的 benchmark 文件"
|
|
||||||
else
|
|
||||||
rlLogInfo "选择的 benchmark: $(basename $BENCH_FILE)"
|
|
||||||
cp "$BENCH_FILE" ./bench.c
|
|
||||||
fi
|
fi
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
@@ -31,11 +24,11 @@ rlJournalStart
|
|||||||
if [ ! -f ./bench.c ]; then
|
if [ ! -f ./bench.c ]; then
|
||||||
rlFail "bench.c 不存在,跳过测试"
|
rlFail "bench.c 不存在,跳过测试"
|
||||||
else
|
else
|
||||||
local outputs=()
|
outputs=()
|
||||||
|
|
||||||
for opt in O0 O1 O2 O3; do
|
for opt in O0 O1 O2 O3; do
|
||||||
local bin="bench_clang_$opt"
|
bin="bench_clang_$opt"
|
||||||
local out="output_clang_$opt.txt"
|
out="output_clang_$opt.txt"
|
||||||
|
|
||||||
rlRun "clang -$opt bench.c -o $bin -lm 2>&1" 0 "Clang -$opt 编译"
|
rlRun "clang -$opt bench.c -o $bin -lm 2>&1" 0 "Clang -$opt 编译"
|
||||||
|
|
||||||
@@ -81,8 +74,8 @@ rlJournalStart
|
|||||||
|
|
||||||
# 验证 Clang 内部各优化级别一致性
|
# 验证 Clang 内部各优化级别一致性
|
||||||
if [ ${#outputs[@]} -ge 2 ]; then
|
if [ ${#outputs[@]} -ge 2 ]; then
|
||||||
local first="${outputs[0]}"
|
first="${outputs[0]}"
|
||||||
local all_match=1
|
all_match=1
|
||||||
for ((i=1; i<${#outputs[@]}; i++)); do
|
for ((i=1; i<${#outputs[@]}; i++)); do
|
||||||
if [ "${outputs[$i]}" != "$first" ]; then
|
if [ "${outputs[$i]}" != "$first" ]; then
|
||||||
all_match=0
|
all_match=0
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ CEOF
|
|||||||
|
|
||||||
rlPhaseStartTest "GCC 浮点"
|
rlPhaseStartTest "GCC 浮点"
|
||||||
for mode in "no-fast-math" "ffast-math"; do
|
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"
|
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 "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"
|
grep -q "sin_pi_ok" /tmp/fp_gcc_${mode}.txt && rlPass "GCC $mode: sin(pi)≈0"
|
||||||
|
|||||||
@@ -14,17 +14,9 @@ rlJournalStart
|
|||||||
TmpDir=$(mktemp -d)
|
TmpDir=$(mktemp -d)
|
||||||
rlRun "cd $TmpDir" 0 "进入临时目录"
|
rlRun "cd $TmpDir" 0 "进入临时目录"
|
||||||
|
|
||||||
# 选择一个 benchmark 文件(优先选小的,编译快)
|
jotaiPrepareBenchmark ./bench.c
|
||||||
BENCH_FILE=$(find "$BENCH_DIR" -name '*.c' -type f 2>/dev/null | head -1)
|
if [ ! -f ./bench.c ]; then
|
||||||
if [ -z "$BENCH_FILE" ]; then
|
rlFail "bench.c 创建失败"
|
||||||
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
|
|
||||||
fi
|
fi
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
@@ -32,12 +24,12 @@ rlJournalStart
|
|||||||
if [ ! -f ./bench.c ]; then
|
if [ ! -f ./bench.c ]; then
|
||||||
rlFail "bench.c 不存在,跳过测试"
|
rlFail "bench.c 不存在,跳过测试"
|
||||||
else
|
else
|
||||||
local outputs=()
|
outputs=()
|
||||||
local exit_codes=()
|
exit_codes=()
|
||||||
|
|
||||||
for opt in O0 O1 O2 O3; do
|
for opt in O0 O1 O2 O3; do
|
||||||
local bin="bench_gcc_$opt"
|
bin="bench_gcc_$opt"
|
||||||
local out="output_gcc_$opt.txt"
|
out="output_gcc_$opt.txt"
|
||||||
|
|
||||||
# 编译
|
# 编译
|
||||||
rlRun "gcc -std=c99 -$opt bench.c -o $bin -lm 2>&1" 0 "GCC -$opt 编译"
|
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
|
if [ ${#outputs[@]} -ge 2 ]; then
|
||||||
local first="${outputs[0]}"
|
first="${outputs[0]}"
|
||||||
local all_match=1
|
all_match=1
|
||||||
for ((i=1; i<${#outputs[@]}; i++)); do
|
for ((i=1; i<${#outputs[@]}; i++)); do
|
||||||
if [ "${outputs[$i]}" != "$first" ]; then
|
if [ "${outputs[$i]}" != "$first" ]; then
|
||||||
all_match=0
|
all_match=0
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ rlJournalStart
|
|||||||
rlRun "find /tmp/jotai-benchmarks/benchmarks -name '*.c' -type f | head -20" 0 "列出前 20 个 C benchmark 文件"
|
rlRun "find /tmp/jotai-benchmarks/benchmarks -name '*.c' -type f | head -20" 0 "列出前 20 个 C benchmark 文件"
|
||||||
|
|
||||||
# 验证有至少一个 C 文件
|
# 验证有至少一个 C 文件
|
||||||
local count
|
|
||||||
count=$(find /tmp/jotai-benchmarks/benchmarks -name '*.c' -type f 2>/dev/null | wc -l)
|
count=$(find /tmp/jotai-benchmarks/benchmarks -name '*.c' -type f 2>/dev/null | wc -l)
|
||||||
if [ "$count" -gt 0 ]; then
|
if [ "$count" -gt 0 ]; then
|
||||||
rlPass "仓库包含 $count 个 C benchmark 文件"
|
rlPass "仓库包含 $count 个 C benchmark 文件"
|
||||||
@@ -38,7 +37,6 @@ rlJournalStart
|
|||||||
|
|
||||||
# 检查 anghaLeaves 目录
|
# 检查 anghaLeaves 目录
|
||||||
if [ -d "$BENCH_DIR" ]; then
|
if [ -d "$BENCH_DIR" ]; then
|
||||||
local angha_count
|
|
||||||
angha_count=$(find "$BENCH_DIR" -name '*.c' -type f 2>/dev/null | wc -l)
|
angha_count=$(find "$BENCH_DIR" -name '*.c' -type f 2>/dev/null | wc -l)
|
||||||
rlPass "anghaLeaves 目录包含 $angha_count 个 benchmark 文件"
|
rlPass "anghaLeaves 目录包含 $angha_count 个 benchmark 文件"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_async_handler
|
path: /tests/functional/kernel/realtime/test_realtime_async_handler
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_gtod_latency
|
path: /tests/functional/kernel/realtime/test_realtime_gtod_latency
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_hrtimer_prio
|
path: /tests/functional/kernel/realtime/test_realtime_hrtimer_prio
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_matrix_mult
|
path: /tests/functional/kernel/realtime/test_realtime_matrix_mult
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_measurement
|
path: /tests/functional/kernel/realtime/test_realtime_measurement
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_periodic_cpu_load
|
path: /tests/functional/kernel/realtime/test_realtime_periodic_cpu_load
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_pi_perf
|
path: /tests/functional/kernel/realtime/test_realtime_pi_perf
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_pi_tests
|
path: /tests/functional/kernel/realtime/test_realtime_pi_tests
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_prio_preempt
|
path: /tests/functional/kernel/realtime/test_realtime_prio_preempt
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_prio_wake
|
path: /tests/functional/kernel/realtime/test_realtime_prio_wake
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_pthread_kill_latency
|
path: /tests/functional/kernel/realtime/test_realtime_pthread_kill_latency
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_rt_migrate
|
path: /tests/functional/kernel/realtime/test_realtime_rt_migrate
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_sched_football
|
path: /tests/functional/kernel/realtime/test_realtime_sched_football
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_sched_jitter
|
path: /tests/functional/kernel/realtime/test_realtime_sched_jitter
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_sched_latency
|
path: /tests/functional/kernel/realtime/test_realtime_sched_latency
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
@@ -10,4 +10,5 @@ tier: 1
|
|||||||
path: /tests/functional/kernel/realtime/test_realtime_thread_clock
|
path: /tests/functional/kernel/realtime/test_realtime_thread_clock
|
||||||
require:
|
require:
|
||||||
- ltp
|
- ltp
|
||||||
|
- hostname
|
||||||
- beakerlib
|
- beakerlib
|
||||||
Regular → Executable
@@ -11,10 +11,14 @@ rlJournalStart
|
|||||||
vimSetup
|
vimSetup
|
||||||
TmpDir=$(mktemp -d)
|
TmpDir=$(mktemp -d)
|
||||||
rlRun "cd $TmpDir" 0 "进入临时测试目录"
|
rlRun "cd $TmpDir" 0 "进入临时测试目录"
|
||||||
|
echo "hello world" > file1.txt
|
||||||
|
echo "hello ruyi" > file2.txt
|
||||||
|
rlAssertExists "file1.txt"
|
||||||
|
rlAssertExists "file2.txt"
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "Vimdiff"
|
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
|
rlPhaseEnd
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user