Skip to content

Commit b633d62

Browse files
committed
fix: update tests for mcpp-index → mcpplibs rename
Update E2E and unit tests to expect "mcpplibs" as the default index name. For tests that symlink pre-cached CI data, support both old "mcpp-index" and new "mcpplibs" directory names.
1 parent 975258f commit b633d62

7 files changed

Lines changed: 24 additions & 18 deletions

File tree

tests/e2e/10_env_command.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@ out=$("$MCPP" self env 2>&1)
1919
[[ -f "$MCPP_HOME/registry/.xlings.json" ]] || { echo "missing seeded .xlings.json"; exit 1; }
2020
[[ -x "$MCPP_HOME/registry/bin/xlings" ]] || { echo "xlings binary not acquired"; exit 1; }
2121

22-
# Verify seeded .xlings.json contains mcpp-index and NOT awesome
23-
grep -q '"name": "mcpp-index"' "$MCPP_HOME/registry/.xlings.json" || {
24-
echo "seeded .xlings.json missing mcpp-index"; exit 1; }
22+
# Verify seeded .xlings.json contains mcpplibs and NOT awesome
23+
grep -q '"name": "mcpplibs"' "$MCPP_HOME/registry/.xlings.json" || {
24+
echo "seeded .xlings.json missing mcpplibs"; exit 1; }
2525
if grep -q '"name": "awesome"' "$MCPP_HOME/registry/.xlings.json"; then
2626
echo "seeded .xlings.json should NOT contain awesome"; exit 1
2727
fi
2828

2929
# Output should mention key paths (use grep — [[ pattern match struggles with multi-line + parens)
3030
echo "$out" | grep -q 'MCPP_HOME' || { echo "no MCPP_HOME in env output"; exit 1; }
3131
echo "$out" | grep -q 'xlings binary' || { echo "no xlings binary in env output"; exit 1; }
32-
echo "$out" | grep -q 'mcpp-index' || { echo "no mcpp-index in env output"; exit 1; }
32+
echo "$out" | grep -q 'mcpplibs' || { echo "no mcpplibs in env output"; exit 1; }
3333

3434
echo "OK"

tests/e2e/11_index_list.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export MCPP_HOME="$TMP/mcpp-home"
1010
# init
1111
"$MCPP" self env > /dev/null
1212

13-
# list should at minimum show mcpp-index (from seeded config)
13+
# list should at minimum show mcpplibs (from seeded config)
1414
out=$("$MCPP" index list 2>&1)
15-
[[ "$out" == *"mcpp-index"* ]] || { echo "index list missing mcpp-index: $out"; exit 1; }
15+
[[ "$out" == *"mcpplibs"* ]] || { echo "index list missing mcpplibs: $out"; exit 1; }
1616

1717
echo "OK"

tests/e2e/19_bmi_cache_reuse.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ fp_dir="$(ls "$MCPP_HOME/bmi" | head -1)"
9191
[[ -n "$fp_dir" ]] || { echo "no fingerprint dir under bmi/"; exit 1; }
9292

9393
# Create a synthetic cache entry as if a previous build produced it.
94-
fake_pkg_dir="$MCPP_HOME/bmi/$fp_dir/deps/mcpp-index/fake.pkg@9.9.9"
94+
fake_pkg_dir="$MCPP_HOME/bmi/$fp_dir/deps/mcpplibs/fake.pkg@9.9.9"
9595
mkdir -p "$fake_pkg_dir/gcm.cache" "$fake_pkg_dir/obj"
9696
echo SYN > "$fake_pkg_dir/gcm.cache/fake.pkg.gcm"
9797
echo SYN > "$fake_pkg_dir/obj/fake.m.o"

tests/e2e/23_remove_update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ cat > mcpp.lock <<'EOF'
3333
version = 1
3434
[package.bar]
3535
version = "2.0.0"
36-
source = "mcpp-index+https://example.com"
36+
source = "mcpplibs+https://example.com"
3737
hash = "sha256:placeholder"
3838
EOF
3939

tests/e2e/32_semver_merge.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@ source "$(dirname "$0")/_inherit_toolchain.sh"
1414

1515
# Index is needed since we exercise version-source deps.
1616
mkdir -p "$MCPP_HOME/registry/data"
17-
if [[ -d "$HOME/.mcpp/registry/data/mcpp-index" ]]; then
18-
ln -sf "$HOME/.mcpp/registry/data/mcpp-index" \
19-
"$MCPP_HOME/registry/data/mcpp-index"
20-
fi
17+
# Link pre-cached index data (may be under old "mcpp-index" or new "mcpplibs" name)
18+
for idx_name in mcpplibs mcpp-index; do
19+
if [[ -d "$HOME/.mcpp/registry/data/$idx_name" ]]; then
20+
ln -sf "$HOME/.mcpp/registry/data/$idx_name" \
21+
"$MCPP_HOME/registry/data/$idx_name"
22+
fi
23+
done
2124
# Pre-cached xpkg downloads so the test doesn't re-fetch the world.
2225
if [[ -d "$HOME/.mcpp/registry/data/xpkgs" ]]; then
2326
[[ -e "$MCPP_HOME/registry/data/xpkgs" ]] \

tests/e2e/33_multi_version_mangling.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ source "$(dirname "$0")/_inherit_toolchain.sh"
1818

1919
# Index + xpkgs need to be visible since we exercise version-source deps.
2020
mkdir -p "$MCPP_HOME/registry/data"
21-
if [[ -d "$HOME/.mcpp/registry/data/mcpp-index" ]]; then
22-
ln -sf "$HOME/.mcpp/registry/data/mcpp-index" \
23-
"$MCPP_HOME/registry/data/mcpp-index"
24-
fi
21+
# Link pre-cached index data (may be under old "mcpp-index" or new "mcpplibs" name)
22+
for idx_name in mcpplibs mcpp-index; do
23+
if [[ -d "$HOME/.mcpp/registry/data/$idx_name" ]]; then
24+
ln -sf "$HOME/.mcpp/registry/data/$idx_name" \
25+
"$MCPP_HOME/registry/data/$idx_name"
26+
fi
27+
done
2528
if [[ -d "$HOME/.mcpp/registry/data/xpkgs" ]]; then
2629
[[ -e "$MCPP_HOME/registry/data/xpkgs" ]] \
2730
|| ln -sf "$HOME/.mcpp/registry/data/xpkgs" \

tests/unit/test_bmi_cache.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ CacheKey makeKey(const std::filesystem::path& home) {
2828
return CacheKey{
2929
.mcppHome = home,
3030
.fingerprint = "deadbeef0123abcd",
31-
.indexName = "mcpp-index",
31+
.indexName = "mcpplibs",
3232
.packageName = "mcpplibs.cmdline",
3333
.version = "0.0.1",
3434
};
@@ -44,7 +44,7 @@ void writeFile(const std::filesystem::path& p, std::string_view body) {
4444
TEST(BmiCache, KeyDirLayoutMatchesDocs26) {
4545
auto k = makeKey("/home/u/.mcpp");
4646
EXPECT_EQ(k.dir().string(),
47-
"/home/u/.mcpp/bmi/deadbeef0123abcd/deps/mcpp-index/mcpplibs.cmdline@0.0.1");
47+
"/home/u/.mcpp/bmi/deadbeef0123abcd/deps/mcpplibs/mcpplibs.cmdline@0.0.1");
4848
EXPECT_EQ(k.manifestFile().filename().string(), "manifest.txt");
4949
EXPECT_EQ(k.gcmDir().filename().string(), "gcm.cache");
5050
EXPECT_EQ(k.objDir().filename().string(), "obj");

0 commit comments

Comments
 (0)