Skip to content

Commit fd65327

Browse files
committed
measurement: run the recorded edges by their own targets
`ninja -t targets all` prints `<target>: <rule>`, and a Windows target begins with a drive letter and its colon, so `cut -d: -f1` handed ninja the target "D". The probe outputs also live under target/.build-mcpp/out, outside the build directory the step searched. The step now takes the two edge targets, cutting the rule at the last ": ", removes them, runs exactly those edges, and reads their outputs by the same paths. Run 2 read M-a on the Visual Studio row: with the system's runtime hidden, neither moc.exe nor lrelease.exe starts from a payload without a copy.
1 parent c702e0c commit fd65327

1 file changed

Lines changed: 19 additions & 8 deletions

File tree

‎.github/workflows/measure-windows-tool-crt.yml‎

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -209,17 +209,27 @@ jobs:
209209
echo "ok: M-a $tool.exe does not start without a runtime"
210210
done
211211
212+
# The recorded edges are run again with ninja directly: their outputs
213+
# (the edge targets, absolute paths under target/.build-mcpp/out) are
214+
# removed, so ninja runs exactly those two edges and nothing else.
212215
- name: "M-b: the candidate's action edge starts each tool"
213216
shell: bash
214217
run: |
215218
nf=$(cat "$RUNNER_TEMP/probe-candidate/ninja-file")
216219
bd=$(dirname "$nf")
217-
find "$bd" \( -name moc-probe.txt -o -name lrelease-probe.stamp \) -delete
218-
"$NINJA" -C "$bd" -t targets all | grep -E 'moc-probe.txt|lrelease-probe.stamp' | cut -d: -f1 > "$RUNNER_TEMP/edges"
219-
test -s "$RUNNER_TEMP/edges" || { echo "::error::no tool edge in the graph"; exit 1; }
220+
abs() { case "$1" in [A-Za-z]:*|/*) cygpath -u "$1" ;; *) echo "$bd/$1" ;; esac; }
221+
# `-t targets all` prints `<target>: <rule>`, and a Windows target
222+
# begins with a drive letter and its colon: the rule is cut at the
223+
# LAST `: `, never at the first colon.
224+
"$NINJA" -C "$bd" -t targets all | grep -E 'moc-probe.txt|lrelease-probe.stamp' | sed 's/: [^:]*$//' > "$RUNNER_TEMP/edges"
225+
[ "$(wc -l < "$RUNNER_TEMP/edges")" -eq 2 ] || { cat "$RUNNER_TEMP/edges"; echo "::error::the graph does not hold the two tool edges"; exit 1; }
226+
while IFS= read -r t; do rm -f "$(abs "$t")"; done < "$RUNNER_TEMP/edges"
227+
echo "edges: $(tr '\n' ' ' < "$RUNNER_TEMP/edges")"
220228
PATH="/usr/bin:/c/Windows/System32:/c/Windows" "$NINJA" -C "$bd" $(cat "$RUNNER_TEMP/edges")
221-
grep -q "Probe" "$(find "$bd" -name moc-probe.txt | head -1)" \
222-
|| { echo "::error::moc.exe ran but wrote no code for Probe"; exit 1; }
229+
moc_out=$(abs "$(grep 'moc-probe.txt' "$RUNNER_TEMP/edges")")
230+
grep -q "Probe" "$moc_out" || { echo "::error::moc.exe ran but wrote no code for Probe ($moc_out)"; exit 1; }
231+
lr_out=$(abs "$(grep 'lrelease-probe.stamp' "$RUNNER_TEMP/edges")")
232+
test -f "$lr_out" || { echo "::error::the lrelease edge left no stamp ($lr_out)"; exit 1; }
223233
echo "ok: M-b moc.exe and lrelease.exe start from the action's PATH (${{ matrix.row }})"
224234
225235
- name: "M-c (reading): the released mcpp's action edge"
@@ -228,9 +238,10 @@ jobs:
228238
nf=$(cat "$RUNNER_TEMP/probe-released/ninja-file")
229239
[ -n "$nf" ] || { echo "READING M-c: not recorded (see the step above)"; exit 0; }
230240
bd=$(dirname "$nf")
231-
find "$bd" \( -name moc-probe.txt -o -name lrelease-probe.stamp \) -delete
232-
edges=$("$NINJA" -C "$bd" -t targets all | grep -E 'moc-probe.txt|lrelease-probe.stamp' | cut -d: -f1)
233-
if PATH="/usr/bin:/c/Windows/System32:/c/Windows" "$NINJA" -C "$bd" $edges > "$RUNNER_TEMP/released.log" 2>&1; then
241+
abs() { case "$1" in [A-Za-z]:*|/*) cygpath -u "$1" ;; *) echo "$bd/$1" ;; esac; }
242+
"$NINJA" -C "$bd" -t targets all | grep -E 'moc-probe.txt|lrelease-probe.stamp' | sed 's/: [^:]*$//' > "$RUNNER_TEMP/edges-released"
243+
while IFS= read -r t; do rm -f "$(abs "$t")"; done < "$RUNNER_TEMP/edges-released"
244+
if PATH="/usr/bin:/c/Windows/System32:/c/Windows" "$NINJA" -C "$bd" $(cat "$RUNNER_TEMP/edges-released") > "$RUNNER_TEMP/released.log" 2>&1; then
234245
echo "READING M-c: the released mcpp's edge started the tools (${{ matrix.row }})"
235246
else
236247
echo "READING M-c: the released mcpp's edge did not start the tools (${{ matrix.row }}):"

0 commit comments

Comments
 (0)