Skip to content

Commit 6ede7e1

Browse files
committed
fix: fresh user experience test uses clean env (no MCPP_VENDORED_XLINGS)
Move the test to AFTER self-host smoke. Simulate a real user: - Create a release-like self-contained mcpp install in a temp dir - Unset MCPP_HOME, MCPP_VENDORED_XLINGS, XLINGS_BIN - mcpp new hello → cd hello → mcpp build → mcpp run - Verify output mcpp resolves its home from the binary's location, so the copied layout with registry/ acts as a self-contained install.
1 parent deb7e51 commit 6ede7e1

3 files changed

Lines changed: 78 additions & 38 deletions

File tree

.github/workflows/ci-macos.yml

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -306,20 +306,6 @@ jobs:
306306
"$MCPP" toolchain default llvm@20.1.7
307307
bash tests/e2e/run_all.sh
308308
309-
- name: Fresh user experience (mcpp new → build → run)
310-
run: |
311-
MCPP=$(find target -path "*/bin/mcpp" | head -1)
312-
MCPP=$(cd "$(dirname "$MCPP")" && pwd)/$(basename "$MCPP")
313-
FRESH=$(mktemp -d)
314-
cd "$FRESH"
315-
"$MCPP" new hello
316-
cd hello
317-
"$MCPP" build
318-
out=$("$MCPP" run 2>&1)
319-
echo "$out"
320-
echo "$out" | grep -q "Hello from hello" || { echo "FAIL: unexpected output"; exit 1; }
321-
echo ":: Fresh user experience PASS"
322-
323309
- name: Self-host smoke (freshly-built mcpp builds itself again)
324310
run: |
325311
MCPP=$(find target -path "*/bin/mcpp" | head -1)
@@ -329,3 +315,26 @@ jobs:
329315
"$MCPP" build
330316
"$MCPP" --version
331317
echo ":: Self-host smoke PASS"
318+
319+
- name: Fresh user experience (clean env, mcpp new → build → run)
320+
run: |
321+
MCPP=$(find target -path "*/bin/mcpp" | head -1)
322+
MCPP=$(cd "$(dirname "$MCPP")" && pwd)/$(basename "$MCPP")
323+
FRESH=$(mktemp -d)
324+
INSTALL="$FRESH/mcpp-install"
325+
mkdir -p "$INSTALL/bin"
326+
cp "$MCPP" "$INSTALL/bin/mcpp"
327+
cp -r "$HOME/.mcpp/registry" "$INSTALL/registry" 2>/dev/null || true
328+
cp "$HOME/.mcpp/config.toml" "$INSTALL/config.toml" 2>/dev/null || true
329+
330+
env -u MCPP_HOME -u MCPP_VENDORED_XLINGS -u XLINGS_BIN \
331+
bash -c "
332+
cd '$FRESH'
333+
'$INSTALL/bin/mcpp' new hello
334+
cd hello
335+
'$INSTALL/bin/mcpp' build
336+
out=\$('$INSTALL/bin/mcpp' run 2>&1)
337+
echo \"\$out\"
338+
echo \"\$out\" | grep -q 'Hello from hello' || { echo 'FAIL: unexpected output'; exit 1; }
339+
echo ':: Fresh user experience PASS'
340+
"

.github/workflows/ci-windows.yml

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -100,28 +100,47 @@ jobs:
100100
"$MCPP_SELF" toolchain default llvm@20.1.7 2>/dev/null || true
101101
bash tests/e2e/run_all.sh
102102
103-
- name: Fresh user experience (mcpp new → build → run)
103+
- name: Self-host smoke (freshly-built mcpp builds itself again)
104104
shell: bash
105105
run: |
106106
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
107+
"$MCPP_SELF" build
108+
"$MCPP_SELF" --version
109+
echo ":: Self-host smoke PASS"
110+
111+
- name: Fresh user experience (clean env, mcpp new → build → run)
112+
shell: bash
113+
run: |
114+
# Simulate a real user: clean environment, no MCPP_HOME,
115+
# no MCPP_VENDORED_XLINGS. Use the self-hosted binary which
116+
# is self-contained (has bundled xlings in its registry/).
107117
FRESH=$(mktemp -d)
118+
# Copy the self-hosted mcpp into a release-like layout
119+
INSTALL_DIR="$FRESH/mcpp-install"
120+
mkdir -p "$INSTALL_DIR/bin" "$INSTALL_DIR/registry/bin"
121+
cp "$MCPP_SELF" "$INSTALL_DIR/bin/mcpp.exe"
122+
# Copy xlings + sandbox from the build so mcpp is self-contained
123+
cp -r "$USERPROFILE/.mcpp/registry/bin/xlings.exe" "$INSTALL_DIR/registry/bin/" 2>/dev/null || true
124+
cp -r "$USERPROFILE/.mcpp/registry/data" "$INSTALL_DIR/registry/data" 2>/dev/null || true
125+
cp -r "$USERPROFILE/.mcpp/registry/subos" "$INSTALL_DIR/registry/subos" 2>/dev/null || true
126+
cp "$USERPROFILE/.mcpp/config.toml" "$INSTALL_DIR/config.toml" 2>/dev/null || true
127+
128+
MCPP_BIN="$INSTALL_DIR/bin/mcpp.exe"
129+
130+
# Clear all mcpp/xlings env vars
131+
unset MCPP_HOME
132+
unset MCPP_VENDORED_XLINGS
133+
unset XLINGS_BIN
134+
108135
cd "$FRESH"
109-
"$MCPP_SELF" new hello
136+
"$MCPP_BIN" new hello
110137
cd hello
111-
"$MCPP_SELF" build
112-
out=$("$MCPP_SELF" run 2>&1)
138+
"$MCPP_BIN" build
139+
out=$("$MCPP_BIN" run 2>&1)
113140
echo "$out"
114141
echo "$out" | grep -q "Hello from hello" || { echo "FAIL: unexpected output"; exit 1; }
115142
echo ":: Fresh user experience PASS"
116143
117-
- name: Self-host smoke (freshly-built mcpp builds itself again)
118-
shell: bash
119-
run: |
120-
export MCPP_VENDORED_XLINGS="$XLINGS_BIN"
121-
"$MCPP_SELF" build
122-
"$MCPP_SELF" --version
123-
echo ":: Self-host smoke PASS"
124-
125144
- name: Package Windows release zip
126145
id: package
127146
shell: bash

.github/workflows/ci.yml

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -128,21 +128,33 @@ jobs:
128128
"$MCPP" toolchain default gcc@16.1.0
129129
bash tests/e2e/run_all.sh
130130
131-
- name: Fresh user experience (mcpp new → build → run)
131+
- name: Self-host smoke (freshly-built mcpp builds itself again)
132132
run: |
133133
MCPP=$(realpath "$(find target -type f -name mcpp -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)")
134-
FRESH=$(mktemp -d)
135-
cd "$FRESH"
136-
"$MCPP" new hello
137-
cd hello
138134
"$MCPP" build
139-
out=$("$MCPP" run 2>&1)
140-
echo "$out"
141-
echo "$out" | grep -q "Hello from hello" || { echo "FAIL: unexpected output"; exit 1; }
142-
echo ":: Fresh user experience PASS"
135+
"$MCPP" test
143136
144-
- name: Self-host smoke (freshly-built mcpp builds itself again)
137+
- name: Fresh user experience (clean env, mcpp new → build → run)
145138
run: |
146139
MCPP=$(realpath "$(find target -type f -name mcpp -printf '%T@ %p\n' | sort -rn | head -1 | cut -d' ' -f2)")
147-
"$MCPP" build
148-
"$MCPP" test
140+
FRESH=$(mktemp -d)
141+
# Create a release-like self-contained layout
142+
INSTALL="$FRESH/mcpp-install"
143+
mkdir -p "$INSTALL/bin"
144+
cp "$MCPP" "$INSTALL/bin/mcpp"
145+
# Copy registry so mcpp is self-contained
146+
cp -r "$HOME/.mcpp/registry" "$INSTALL/registry" 2>/dev/null || true
147+
cp "$HOME/.mcpp/config.toml" "$INSTALL/config.toml" 2>/dev/null || true
148+
149+
# Clear all mcpp env vars — simulate real user
150+
env -u MCPP_HOME -u MCPP_VENDORED_XLINGS -u XLINGS_BIN \
151+
bash -c "
152+
cd '$FRESH'
153+
'$INSTALL/bin/mcpp' new hello
154+
cd hello
155+
'$INSTALL/bin/mcpp' build
156+
out=\$('$INSTALL/bin/mcpp' run 2>&1)
157+
echo \"\$out\"
158+
echo \"\$out\" | grep -q 'Hello from hello' || { echo 'FAIL: unexpected output'; exit 1; }
159+
echo ':: Fresh user experience PASS'
160+
"

0 commit comments

Comments
 (0)