Skip to content

Commit def1ef9

Browse files
committed
ci: 给「每条规则都为本宿主编译过」这条判据补它自己的分母
这个夹具断言的是「**每一条**规则都编译过」,而「每一条」是它自己carry的一张清单 —— 于是给这个包加第七个成员时,一条名字说它已经被覆盖的步骤会继续绿。 所以在构建之前先把那张清单与包自己的 `[features]` 比一次,两者必须相等。 实测两条腿:相等时通过;从夹具里删掉 `rules-hip` 当场变红。
1 parent b9d550f commit def1ef9

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,24 @@ jobs:
201201
# every rule returns before looking for a payload and nothing is
202202
# downloaded; what it asserts is that all six modules compile here.
203203
- name: every rule module compiles for this host
204-
working-directory: tests/all-rules-compile
205204
run: |
206205
set -e
206+
# THE FIXTURE'S OWN DENOMINATOR. It asserts "every rule compiles
207+
# here", and "every" is a list it carries -- so a seventh member
208+
# added to this package would be covered by a step whose name says it
209+
# already is. The list is therefore compared against the package's
210+
# own `[features]` before the build, and the two must be equal.
211+
feats=$(sed -n '/^\[features\]/,/^# /p' mcpp.toml \
212+
| grep -oE '^[a-z-]+ +=' | sed 's/ *=//' | grep -v '^default$' | sort)
213+
used=$(sed -n '/features = \[/,/\], host-module/p' tests/all-rules-compile/mcpp.toml \
214+
| grep -oE '"[a-z-]+"' | tr -d '"' | sort)
215+
[ -n "$feats" ] || { echo "FAIL: read no features out of mcpp.toml"; exit 1; }
216+
[ "$feats" = "$used" ] || {
217+
echo "FAIL: the fixture does not name every published feature"
218+
echo " package: $(echo $feats)"
219+
echo " fixture: $(echo $used)"
220+
exit 1; }
221+
cd tests/all-rules-compile
207222
"$MCPP" build
208223
"$MCPP" run | tee run.log
209224
grep -q '^all-rules-compile ok' run.log
@@ -470,9 +485,24 @@ jobs:
470485
# `no member named 'popen' in the global namespace`, reported against a
471486
# consumer that had nothing to do with it.
472487
- name: every rule module compiles for this host
473-
working-directory: tests/all-rules-compile
474488
run: |
475489
set -e
490+
# THE FIXTURE'S OWN DENOMINATOR. It asserts "every rule compiles
491+
# here", and "every" is a list it carries -- so a seventh member
492+
# added to this package would be covered by a step whose name says it
493+
# already is. The list is therefore compared against the package's
494+
# own `[features]` before the build, and the two must be equal.
495+
feats=$(sed -n '/^\[features\]/,/^# /p' mcpp.toml \
496+
| grep -oE '^[a-z-]+ +=' | sed 's/ *=//' | grep -v '^default$' | sort)
497+
used=$(sed -n '/features = \[/,/\], host-module/p' tests/all-rules-compile/mcpp.toml \
498+
| grep -oE '"[a-z-]+"' | tr -d '"' | sort)
499+
[ -n "$feats" ] || { echo "FAIL: read no features out of mcpp.toml"; exit 1; }
500+
[ "$feats" = "$used" ] || {
501+
echo "FAIL: the fixture does not name every published feature"
502+
echo " package: $(echo $feats)"
503+
echo " fixture: $(echo $used)"
504+
exit 1; }
505+
cd tests/all-rules-compile
476506
"$MCPP" build
477507
"$MCPP" run | tee run.log
478508
grep -q '^all-rules-compile ok' run.log

0 commit comments

Comments
 (0)