Skip to content

Commit 3e68059

Browse files
committed
ci: the emulated serial console ends lines with CRLF
裸机那一步的四行与宿主的四行**内容完全一致**,而 `diff` 报四行全不同: 1,4c1,4 < sorted: 2 4 7 --- > sorted: 2 4 7 不可见字符。裸机运行经由模拟的 16550 UART 到达控制台,而串口控制台 以 CRLF 结束一行;宿主运行不是。 ⭐ 这种失败读起来像是**被测的主张不成立**,而不像承载它的传输层不同 —— 两侧各加一个 `tr -d '\r'`。断言的是程序打印了什么,不是字节怎么到达的。 同样是把那一步从裸的 `mcpp run`(宿主)改成真的 `--target riscv64-none-elf` 之后才暴露的。
1 parent 747085e commit 3e68059

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,16 @@ jobs:
151151
cd examples/same-source && mcpp run 2>&1 | tee host.log
152152
grep -q 'import std over openkal: ok' host.log
153153
# The four lines are the same four lines.
154-
diff <(grep -E '^(sorted|caught|unwound|import std over openkal):' out.log) \
155-
<(grep -E '^(sorted|caught|unwound|import std over openkal):' host.log)
154+
#
155+
# ⚠️ `tr -d '\r'` ON BOTH SIDES, AND IT IS NOT COSMETIC. The bare-metal
156+
# run reaches the console through an emulated 16550 UART, and a serial
157+
# console terminates lines with CRLF; the native run does not. Without
158+
# this the diff reports four differing lines whose visible text is
159+
# identical, which reads as a failure of the claim being tested rather
160+
# than of the transport carrying it. The assertion is about what the
161+
# program printed, not about how the bytes arrived.
162+
diff <(grep -E '^(sorted|caught|unwound|import std over openkal):' out.log | tr -d '\r') \
163+
<(grep -E '^(sorted|caught|unwound|import std over openkal):' host.log | tr -d '\r')
156164
157165
# ⭐⭐ AND THE SAME SOURCE FOR TWO MACHINES THIS ONE IS NOT.
158166
#

0 commit comments

Comments
 (0)