mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 21:36:40 -10:00
The stubs logged with echo "x $*" >> "$STUB_LOG", which bash can write
in pieces for a long line, so a stub running at the same time could put
its own line in the middle. Every stub now appends through
testdata/stubs/stub-log, a Perl script that writes the whole line with a
single syswrite to the file opened for appending: the call log and the
stubs' shared lists ($STUB_DIR/containers-made, unpacked, scripts,
tm-excluded). The stubs run it from their own folder (${0%/*}), and
stubtest.New links it too when it puts only the named stubs on PATH.
TestCallLinesWhole runs two open stubs at once with 100 KB arguments
while the test appends short lines of its own to the log, and checks
every call landed whole; it failed on every run with the old stubs.
TestStubsLogWithStubLog fails on any stub that appends to $STUB_LOG or
$STUB_DIR with the shell's >>.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
8 lines
316 B
Bash
Executable File
8 lines
316 B
Bash
Executable File
#!/bin/bash
|
|
# Stand-in for VS Code's code command in tests: never the real editor.
|
|
# Logs every call to $STUB_LOG, and the SSH agent it was given
|
|
# ($SSH_AUTH_SOCK, or "unset") to $STUB_DIR/code-agent.
|
|
set -euo pipefail
|
|
"${0%/*}/stub-log" "$STUB_LOG" code "$@"
|
|
echo "${SSH_AUTH_SOCK-unset}" > "$STUB_DIR/code-agent"
|