From ea790dd05d587aa5e22fe36893f4f8bb083c7fd3 Mon Sep 17 00:00:00 2001 From: lzkk <956449176@qq.com> Date: Thu, 28 May 2026 15:35:43 +0800 Subject: [PATCH] =?UTF-8?q?fix(scripts):=20score.sh=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=20canon=5Fdiff=20=E5=BF=BD=E7=95=A5=E5=B0=BE=E9=83=A8=E7=A9=BA?= =?UTF-8?q?=E7=99=BD=E2=80=94=E2=80=94=E5=8C=B9=E9=85=8D=202026test.sh=20?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit performance 60/60 AC, functional 100/100 AC, h_functional 40/40 AC。 --- scripts/score.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/score.sh b/scripts/score.sh index 70405310..e9228b40 100755 --- a/scripts/score.sh +++ b/scripts/score.sh @@ -23,6 +23,17 @@ BLUE='\033[0;34m' BOLD='\033[1m' NC='\033[0m' +# 规范比较:忽略尾部空格和尾部空行(与 2026test.sh 的 canon_compare 一致) +canon_diff() { + local f1="$1" f2="$2" + diff -q \ + <(sed 's/\r$//; s/[[:space:]]*$//' "$f1" \ + | awk '{lines[NR]=$0} END{last=NR; while(last>0&&lines[last]=="")last--; for(i=1;i<=last;i++)print lines[i]}') \ + <(sed 's/\r$//; s/[[:space:]]*$//' "$f2" \ + | awk '{lines[NR]=$0} END{last=NR; while(last>0&&lines[last]=="")last--; for(i=1;i<=last;i++)print lines[i]}') \ + >/dev/null 2>&1 +} + GCC="aarch64-linux-gnu-gcc" GCC_COMPILE_FLAGS="-std=gnu89 -O2 -x c" GCC_LINK_FLAGS="-static" @@ -239,7 +250,7 @@ run_with_args() { echo "$exit_code" } > "$our_actual" if [[ -f "$out_file" ]]; then - diff -q "$our_actual" "$out_file" >/dev/null 2>&1 && our_correct=1 + canon_diff "$our_actual" "$out_file" && our_correct=1 else our_correct=1 fi