@@ -132,8 +132,12 @@ int main() {
132132EOF
133133done
134134
135+ # A member's build-program output directory: one per configuration and
136+ # package, below the workspace root (mcpp 2026.10.10.1+). Every command here
137+ # builds the one configuration the pack asks for.
138+ outdir () { ls -d target/.build-mcpp/out/* /" $1 " 2> /dev/null | head -1; }
135139# The lines a member's program appended to its log, all of them.
136- runs () { cat " $1 /target/.build-mcpp/out /runs.log" 2> /dev/null; }
140+ runs () { cat " $( outdir " $1 " ) /runs.log" 2> /dev/null; }
137141count () { runs " $1 " | grep -c " $2 " || true ; }
138142
139143stage_of () { ls -d " $1 " /target/dist/" $1 " -0.1.0-* | grep -v -e ' \.stage-manifest$' -e ' \.tar\.gz$' | head -1; }
@@ -144,11 +148,11 @@ objects() { awk -F'\t' '$4 ~ /\.o$/' "$1/.ninja_log" | wc -l | tr -d ' '; }
144148# `core` is not a program, so it is not packed, and its program ran once in all:
145149# in the pass that asks for no format, and never again for a member whose answer
146150# does not depend on the request.
147- [ " $( count core ' ' ) " = 1 ] || fail " A: core's program ran $( count core ' ' ) times, not once" core/target/.build-mcpp/out /runs.log
151+ [ " $( count core ' ' ) " = 1 ] || fail " A: core's program ran $( count core ' ' ) times, not once" $( outdir core) /runs.log
148152for m in cli gui; do
149- [ " $( count $m ' ' ) " = 2 ] || fail " A: $m 's program ran $( count $m ' ' ) times, not once for each pass" $m /target/.build-mcpp/out /runs.log
150- [ " $( count $m ' ^format= stage=$' ) " = 1 ] || fail " A: $m 's first pass was told a request" $m /target/.build-mcpp/out /runs.log
151- [ " $( count $m ' ^format=zap stage=/' ) " = 1 ] || fail " A: $m 's second pass was not told its format and stage" $m /target/.build-mcpp/out /runs.log
153+ [ " $( count $m ' ' ) " = 2 ] || fail " A: $m 's program ran $( count $m ' ' ) times, not once for each pass" $( outdir $m ) /runs.log
154+ [ " $( count $m ' ^format= stage=$' ) " = 1 ] || fail " A: $m 's first pass was told a request" $( outdir $m ) /runs.log
155+ [ " $( count $m ' ^format=zap stage=/' ) " = 1 ] || fail " A: $m 's second pass was not told its format and stage" $( outdir $m ) /runs.log
152156done
153157grep -q " Packed .*cli.zap" a.log || fail " A: cli's distributable was not reported" a.log
154158grep -q " Packed .*gui.zap" a.log || fail " A: gui's distributable was not reported" a.log
@@ -159,15 +163,15 @@ for m in cli gui; do
159163 # The two spellings of one directory are compared as directories: a
160164 # temporary directory may be reached through a symbolic link.
161165 want=" $( cd " $( stage_of $m ) " && pwd -P) "
162- saw=" $( cat $m /target/.build-mcpp/out /seen-stage.txt) "
166+ saw=" $( cat $( outdir $m ) /seen-stage.txt) "
163167 [ -d " $saw " ] && [ " $( cd " $saw " && pwd -P) " = " $want " ] \
164168 || fail " D: $m 's program read '$saw ', and its tree is '$want '" a.log
165- grep -qx " member=$m " $m /target/.build-mcpp/out/ $m .zap || fail " D: $m 's distributable was made for another member" $m /target/.build-mcpp/out /$m .zap
166- grep -qx " ./bin/$m " $m /target/.build-mcpp/out/ $m .zap || fail " D: $m 's tree did not hold $m 's program" $m /target/.build-mcpp/out /$m .zap
169+ grep -qx " member=$m " $( outdir $m ) / $m .zap || fail " D: $m 's distributable was made for another member" $( outdir $m ) /$m .zap
170+ grep -qx " ./bin/$m " $( outdir $m ) / $m .zap || fail " D: $m 's tree did not hold $m 's program" $( outdir $m ) /$m .zap
167171done
168- [ " $( cat cli/target/.build-mcpp/out/ seen-stage.txt) " != " $( cat gui/target/.build-mcpp/out /seen-stage.txt) " ] \
172+ [ " $( cat $( outdir cli) / seen-stage.txt) " != " $( cat $( outdir gui) /seen-stage.txt) " ] \
169173 || fail " D: two members were told one staged tree"
170- grep -q " gui" cli/target/.build-mcpp/out/ cli.zap && fail " D: cli's tree holds gui's program" cli/target/.build-mcpp/out /cli.zap
174+ grep -q " gui" $( outdir cli) / cli.zap && fail " D: cli's tree holds gui's program" $( outdir cli) /cli.zap
171175echo " ok: D, each member's program reads its own staged tree"
172176
173177# ── B ────────────────────────────────────────────────────────────────────────
@@ -176,11 +180,11 @@ for m in cli gui; do
176180 mkdir multi/$m single/$m
177181 cp -R " $( stage_of $m ) " multi/$m /tree
178182 cp " $( stage_of $m ) .stage-manifest" multi/$m /stage-manifest
179- cp $m /target/.build-mcpp/out /$m .zap multi/$m /dist
183+ cp $( outdir $m ) /$m .zap multi/$m /dist
180184 " $MCPP " pack -p $m --format zap > b-$m .log 2>&1 || fail " B: mcpp pack -p $m failed" b-$m .log
181185 cp -R " $( stage_of $m ) " single/$m /tree
182186 cp " $( stage_of $m ) .stage-manifest" single/$m /stage-manifest
183- cp $m /target/.build-mcpp/out /$m .zap single/$m /dist
187+ cp $( outdir $m ) /$m .zap single/$m /dist
184188 diff -r multi/$m single/$m > b-$m .diff || fail " B: $m 's packed tree differs from the one mcpp pack -p $m makes" b-$m .diff
185189done
186190echo " ok: B, each member's tree and distributable are those of mcpp pack -p <member>"
0 commit comments