do not edit — generated by btf.
git.druid.rocksindexdruid520mptest/suites/sysroots.sh

test/suites/sysroots.sh


# suite: sysroot resolution and isolation -- cross-sysroot dependency
# routing (inherit / own root / default root), the whole-invocation
# --sysroot= flag, per-root hold/use/tag-pin independence, same-name
# installs in different roots, and sysroot-scoped linkdeps.
 
# a dependency with no SYSROOT= of its own is routed into its parent's
# sysroot, not the default root.
test_dep_inherits_parent_sysroot() {
	t_begin "dep_inherits_parent_sysroot"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	echo 'MP_PREFIX=/usr/local-sr1-sysroot' > /usr/ports/sysroots/sr1root.conf
	rm -rf /usr/local-sr1-sysroot "$WD/sysroots/sr1root"
	mkdir -p /usr/local-sr1-sysroot
	mkport sr1dep <<'EOF'
pkg_name="sr1dep"
pkg_ver="1.0"
install:
	touch $MP_PREFIX/sr1dep-installed
remove:
	rm -f $MP_PREFIX/sr1dep-installed
EOF
	mkport sr1top <<'EOF'
pkg_name="sr1top"
pkg_ver="1.0"
pkg_deps="sr1dep"
install:
	touch $MP_PREFIX/sr1top-installed
remove:
	rm -f $MP_PREFIX/sr1top-installed
EOF
	cat >> "$CONF" <<'EOF'
sr1top:
	SYSROOT=sr1root
EOF
	mp install sr1top >/tmp/sr1.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr1root.conf /usr/local-sr1-sysroot; return; }
	assert_file_exists /usr/local-sr1-sysroot/sr1top-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr1root.conf /usr/local-sr1-sysroot; return; }
	assert_file_exists /usr/local-sr1-sysroot/sr1dep-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr1root.conf /usr/local-sr1-sysroot; return; }
	assert_file_absent "$MP_PREFIX/sr1dep-installed" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr1root.conf /usr/local-sr1-sysroot; return; }
	sysdb=$(cat "$WD/sysroots/sr1root/db")
	assert_contains "$sysdb" "sr1dep" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr1root.conf /usr/local-sr1-sysroot; return; }
	rm -rf /usr/ports/sysroots/sr1root.conf /usr/local-sr1-sysroot
	t_pass
}
 
# a dependency with its own SYSROOT=<other> is routed to that other
# root even when its parent lives in a different one -- the two roots'
# dbs each track only their own package.
test_dep_own_sysroot_overrides_parent() {
	t_begin "dep_own_sysroot_overrides_parent"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	echo 'MP_PREFIX=/usr/local-sr2-sysx' > /usr/ports/sysroots/sr2x.conf
	echo 'MP_PREFIX=/usr/local-sr2-sysy' > /usr/ports/sysroots/sr2y.conf
	rm -rf /usr/local-sr2-sysx /usr/local-sr2-sysy "$WD/sysroots/sr2x" "$WD/sysroots/sr2y"
	mkdir -p /usr/local-sr2-sysx /usr/local-sr2-sysy
	mkport sr2dep <<'EOF'
pkg_name="sr2dep"
pkg_ver="1.0"
install:
	touch $MP_PREFIX/sr2dep-installed
remove:
	rm -f $MP_PREFIX/sr2dep-installed
EOF
	mkport sr2top <<'EOF'
pkg_name="sr2top"
pkg_ver="1.0"
pkg_deps="sr2dep"
install:
	touch $MP_PREFIX/sr2top-installed
remove:
	rm -f $MP_PREFIX/sr2top-installed
EOF
	cat >> "$CONF" <<'EOF'
sr2top:
	SYSROOT=sr2x
sr2dep:
	SYSROOT=sr2y
EOF
	mp install sr2top >/tmp/sr2.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr2x.conf /usr/ports/sysroots/sr2y.conf /usr/local-sr2-sysx /usr/local-sr2-sysy; return; }
	assert_file_exists /usr/local-sr2-sysx/sr2top-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr2x.conf /usr/ports/sysroots/sr2y.conf /usr/local-sr2-sysx /usr/local-sr2-sysy; return; }
	assert_file_exists /usr/local-sr2-sysy/sr2dep-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr2x.conf /usr/ports/sysroots/sr2y.conf /usr/local-sr2-sysx /usr/local-sr2-sysy; return; }
	assert_file_absent /usr/local-sr2-sysx/sr2dep-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr2x.conf /usr/ports/sysroots/sr2y.conf /usr/local-sr2-sysx /usr/local-sr2-sysy; return; }
	xdb=$(cat "$WD/sysroots/sr2x/db")
	ydb=$(cat "$WD/sysroots/sr2y/db")
	assert_contains "$xdb" "sr2top" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr2x.conf /usr/ports/sysroots/sr2y.conf /usr/local-sr2-sysx /usr/local-sr2-sysy; return; }
	assert_not_contains "$xdb" "sr2dep" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr2x.conf /usr/ports/sysroots/sr2y.conf /usr/local-sr2-sysx /usr/local-sr2-sysy; return; }
	assert_contains "$ydb" "sr2dep" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr2x.conf /usr/ports/sysroots/sr2y.conf /usr/local-sr2-sysx /usr/local-sr2-sysy; return; }
	rm -rf /usr/ports/sysroots/sr2x.conf /usr/ports/sysroots/sr2y.conf /usr/local-sr2-sysx /usr/local-sr2-sysy
	t_pass
}
 
# a default-root package depending on a sysroot-routed one leaves the
# parent in the default root and only the dep goes to its sysroot.
test_default_parent_sysroot_dep() {
	t_begin "default_parent_sysroot_dep"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	echo 'MP_PREFIX=/usr/local-sr3-sys' > /usr/ports/sysroots/sr3.conf
	rm -rf /usr/local-sr3-sys "$WD/sysroots/sr3"
	mkdir -p /usr/local-sr3-sys
	mkport sr3dep <<'EOF'
pkg_name="sr3dep"
pkg_ver="1.0"
install:
	touch $MP_PREFIX/sr3dep-installed
remove:
	rm -f $MP_PREFIX/sr3dep-installed
EOF
	mkport sr3top <<'EOF'
pkg_name="sr3top"
pkg_ver="1.0"
pkg_deps="sr3dep"
install:
	touch $MP_PREFIX/sr3top-installed
remove:
	rm -f $MP_PREFIX/sr3top-installed
EOF
	cat >> "$CONF" <<'EOF'
sr3dep:
	SYSROOT=sr3
EOF
	mp install sr3top >/tmp/sr3.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr3.conf /usr/local-sr3-sys; return; }
	assert_file_exists "$MP_PREFIX/sr3top-installed" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr3.conf /usr/local-sr3-sys; return; }
	assert_file_exists /usr/local-sr3-sys/sr3dep-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr3.conf /usr/local-sr3-sys; return; }
	defdb=$(cat "$WD/db")
	assert_contains "$defdb" "sr3top" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr3.conf /usr/local-sr3-sys; return; }
	assert_not_contains "$defdb" "sr3dep" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr3.conf /usr/local-sr3-sys; return; }
	rm -rf /usr/ports/sysroots/sr3.conf /usr/local-sr3-sys
	t_pass
}
 
# the whole-invocation "mp install --sysroot=<name>" flag routes
# everything (package AND deps) into the named root, db included.
test_cli_sysroot_flag() {
	t_begin "cli_sysroot_flag"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	echo 'MP_PREFIX=/usr/local-sr4-sys' > /usr/ports/sysroots/sr4.conf
	rm -rf /usr/local-sr4-sys "$WD/sysroots/sr4"
	mkdir -p /usr/local-sr4-sys
	mkport sr4dep <<'EOF'
pkg_name="sr4dep"
pkg_ver="1.0"
install:
	touch $MP_PREFIX/sr4dep-installed
remove:
	rm -f $MP_PREFIX/sr4dep-installed
EOF
	mkport sr4top <<'EOF'
pkg_name="sr4top"
pkg_ver="1.0"
pkg_deps="sr4dep"
install:
	touch $MP_PREFIX/sr4top-installed
remove:
	rm -f $MP_PREFIX/sr4top-installed
EOF
	mp install --sysroot=sr4 sr4top >/tmp/sr4.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr4.conf /usr/local-sr4-sys; return; }
	assert_file_exists /usr/local-sr4-sys/sr4top-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr4.conf /usr/local-sr4-sys; return; }
	assert_file_exists /usr/local-sr4-sys/sr4dep-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr4.conf /usr/local-sr4-sys; return; }
	sysdb=$(cat "$WD/sysroots/sr4/db")
	defdb=$(cat "$WD/db")
	assert_contains "$sysdb" "sr4top" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr4.conf /usr/local-sr4-sys; return; }
	assert_not_contains "$defdb" "sr4top" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr4.conf /usr/local-sr4-sys; return; }
	rm -rf /usr/ports/sysroots/sr4.conf /usr/local-sr4-sys
	t_pass
}
 
# %tag resolution inside a sysroot reads the sysroot's own db: a
# provider already installed in the DEFAULT root is invisible there, so
# the sysroot installs its own copy instead of reusing the default one.
test_sysroot_tag_resolution_isolated() {
	t_begin "sysroot_tag_resolution_isolated"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	echo 'MP_PREFIX=/usr/local-sr5-sys' > /usr/ports/sysroots/sr5.conf
	rm -rf /usr/local-sr5-sys "$WD/sysroots/sr5"
	mkdir -p /usr/local-sr5-sys
	mkport sr5prov <<'EOF'
pkg_name="sr5prov"
pkg_ver="1.0"
pkg_tags="sr5tag"
install:
	touch $MP_PREFIX/sr5prov-installed
remove:
	rm -f $MP_PREFIX/sr5prov-installed
EOF
	mkport sr5need <<'EOF'
pkg_name="sr5need"
pkg_ver="1.0"
pkg_deps="%sr5tag"
install:
	touch $MP_PREFIX/sr5need-installed
remove:
	rm -f $MP_PREFIX/sr5need-installed
EOF
	mp install sr5prov >/tmp/sr5.out 2>&1
	cat >> "$CONF" <<'EOF'
sr5need:
	SYSROOT=sr5
EOF
	mp install sr5need >>/tmp/sr5.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr5.conf /usr/local-sr5-sys; return; }
	assert_file_exists "$MP_PREFIX/sr5prov-installed" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr5.conf /usr/local-sr5-sys; return; }
	assert_file_exists /usr/local-sr5-sys/sr5prov-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr5.conf /usr/local-sr5-sys; return; }
	sysdb=$(cat "$WD/sysroots/sr5/db")
	assert_contains "$sysdb" "sr5prov" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr5.conf /usr/local-sr5-sys; return; }
	rm -rf /usr/ports/sysroots/sr5.conf /usr/local-sr5-sys
	t_pass
}
 
# hold state is per-root: holding a name in the default root must not
# block installing it inside a sysroot, and vice versa.
test_sysroot_hold_independent() {
	t_begin "sysroot_hold_independent"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	echo 'MP_PREFIX=/usr/local-sr6-sys' > /usr/ports/sysroots/sr6.conf
	rm -rf /usr/local-sr6-sys "$WD/sysroots/sr6"
	mkdir -p /usr/local-sr6-sys
	mkport sr6p <<'EOF'
pkg_name="sr6p"
pkg_ver="1.0"
install:
	touch $MP_PREFIX/sr6p-installed
remove:
	rm -f $MP_PREFIX/sr6p-installed
EOF
	mp hold sr6p >/tmp/sr6.out 2>&1
	out=$(mp install sr6p 2>&1)
	assert_contains "$out" "held" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr6.conf /usr/local-sr6-sys; return; }
	cat >> "$CONF" <<'EOF'
sr6p:
	SYSROOT=sr6
EOF
	mp install sr6p >/tmp/sr6.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr6.conf /usr/local-sr6-sys; return; }
	assert_file_exists /usr/local-sr6-sys/sr6p-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr6.conf /usr/local-sr6-sys; return; }
	rm -rf /usr/ports/sysroots/sr6.conf /usr/local-sr6-sys
	t_pass
}
 
# the same name installed in two different roots is tracked and removed
# independently: while SYSROOT=<name> is configured, "mp remove" routes
# to the sysroot copy; dropping the section re-routes it to the default
# copy -- each removal leaves the other root's install untouched.
test_same_name_two_roots() {
	t_begin "same_name_two_roots"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	echo 'MP_PREFIX=/usr/local-sr7-sys' > /usr/ports/sysroots/sr7.conf
	rm -rf /usr/local-sr7-sys "$WD/sysroots/sr7"
	mkdir -p /usr/local-sr7-sys
	mkport sr7p <<'EOF'
pkg_name="sr7p"
pkg_ver="1.0"
install:
	touch $MP_PREFIX/sr7p-installed
remove:
	rm -f $MP_PREFIX/sr7p-installed
EOF
	mp install sr7p >/tmp/sr7.out 2>&1
	cat >> "$CONF" <<'EOF'
sr7p:
	SYSROOT=sr7
EOF
	mp install sr7p >>/tmp/sr7.out 2>&1
	assert_file_exists "$MP_PREFIX/sr7p-installed" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr7.conf /usr/local-sr7-sys; return; }
	assert_file_exists /usr/local-sr7-sys/sr7p-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr7.conf /usr/local-sr7-sys; return; }
	mp remove sr7p >>/tmp/sr7.out 2>&1
	assert_file_absent /usr/local-sr7-sys/sr7p-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr7.conf /usr/local-sr7-sys; return; }
	assert_file_exists "$MP_PREFIX/sr7p-installed" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr7.conf /usr/local-sr7-sys; return; }
	defdb=$(cat "$WD/db")
	sysdb=$(cat "$WD/sysroots/sr7/db")
	assert_contains "$defdb" "sr7p" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr7.conf /usr/local-sr7-sys; return; }
	assert_not_contains "$sysdb" "sr7p" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr7.conf /usr/local-sr7-sys; return; }
	sed -i '/sr7p:/,+1d' "$CONF"
	mp remove sr7p >>/tmp/sr7.out 2>&1
	assert_file_absent "$MP_PREFIX/sr7p-installed" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr7.conf /usr/local-sr7-sys; return; }
	rm -rf /usr/ports/sysroots/sr7.conf /usr/local-sr7-sys
	t_pass
}
 
# a sysroot's own mp.conf-style overlay (sysroots/<name>.conf) supplies
# per-package USE= that drives pkg_slot_use composition inside that
# root, independently of the default root's USE state.
test_sysroot_use_drives_slot() {
	t_begin "sysroot_use_drives_slot"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	printf 'MP_PREFIX=/usr/local-sr8-sys\nsr8p:\n\tUSE=v\n' > /usr/ports/sysroots/sr8.conf
	rm -rf /usr/local-sr8-sys "$WD/sysroots/sr8"
	mkdir -p /usr/local-sr8-sys
	mkport sr8p <<'EOF'
pkg_name="sr8p"
pkg_ver="1.0"
pkg_slot_use="v"
pkg_use="v"
install:
	touch $MP_PREFIX/sr8p-installed
remove:
	rm -f $MP_PREFIX/sr8p-installed
EOF
	cat >> "$CONF" <<'EOF'
sr8p:
	SYSROOT=sr8
EOF
	mp install sr8p >/tmp/sr8.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr8.conf /usr/local-sr8-sys; return; }
	sysdb=$(cat "$WD/sysroots/sr8/db")
	assert_contains "$sysdb" "sr8p:v" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr8.conf /usr/local-sr8-sys; return; }
	assert_file_exists /usr/local-sr8-sys/sr8p-v/sr8p-installed "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr8.conf /usr/local-sr8-sys; return; }
	rm -rf /usr/ports/sysroots/sr8.conf /usr/local-sr8-sys
	t_pass
}
 
# buildlink edges are recorded in the sysroot's own linkdeps.db, so a
# sysroot revdep sees only its own consumers.
test_sysroot_linkdeps_scoped() {
	t_begin "sysroot_linkdeps_scoped"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	echo 'MP_PREFIX=/usr/local-sr9-sys' > /usr/ports/sysroots/sr9.conf
	rm -rf /usr/local-sr9-sys "$WD/sysroots/sr9"
	mkdir -p /usr/local-sr9-sys
	mkport sr9prov <<'EOF'
pkg_name="sr9prov"
pkg_ver="1.0"
pkg_slot="s9"
pkg_tags="sr9tag"
install:
	touch $MP_PREFIX/sr9prov-installed
remove:
	rm -f $MP_PREFIX/sr9prov-installed
EOF
	mkport sr9cons <<'EOF'
pkg_name="sr9cons"
pkg_ver="1.0"
pkg_deps="%sr9tag"
install:
	touch $MP_PREFIX/sr9cons-installed
remove:
	rm -f $MP_PREFIX/sr9cons-installed
EOF
	cat >> "$CONF" <<'EOF'
sr9cons:
	SYSROOT=sr9
EOF
	mp install sr9cons >/tmp/sr9.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr9.conf /usr/local-sr9-sys; return; }
	linkdeps=$(cat "$WD/sysroots/sr9/linkdeps.db" 2>/dev/null)
	assert_contains "$linkdeps" "sr9cons" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr9.conf /usr/local-sr9-sys; return; }
	assert_contains "$linkdeps" "sr9prov:s9" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr9.conf /usr/local-sr9-sys; return; }
	assert_file_absent "$WD/linkdeps.db" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr9.conf /usr/local-sr9-sys; return; }
	out=$(mp revdep --sysroot=sr9 sr9prov 2>&1)
	assert_contains "$out" "sr9cons" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr9.conf /usr/local-sr9-sys; return; }
	rm -rf /usr/ports/sysroots/sr9.conf /usr/local-sr9-sys
	t_pass
}
 
# a per-sysroot mpx.conf JOBS override reaches the phase env of a
# sysroot-scoped build while the default root's build is unaffected.
test_sysroot_mpxconf_jobs() {
	t_begin "sysroot_mpxconf_jobs"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots "$WD/sysroots/sr10"
	echo 'MP_PREFIX=/usr/local-sr10-sys' > /usr/ports/sysroots/sr10.conf
	rm -rf /usr/local-sr10-sys
	mkdir -p /usr/local-sr10-sys
	cat > "$WD/sysroots/sr10/mpx.conf" <<'EOF'
sr10p:
	JOBS="7"
EOF
	mkport sr10p <<'EOF'
pkg_name="sr10p"
pkg_ver="1.0"
install:
	echo "JOBS=[$MP_JOBS]" > $MP_PREFIX/sr10-jobs
	touch $MP_PREFIX/sr10p-installed
remove:
	rm -f $MP_PREFIX/sr10p-installed $MP_PREFIX/sr10-jobs
EOF
	cat >> "$CONF" <<'EOF'
sr10p:
	SYSROOT=sr10
EOF
	mp install sr10p >/tmp/sr10.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr10.conf /usr/local-sr10-sys; return; }
	jobs=$(cat /usr/local-sr10-sys/sr10-jobs 2>/dev/null)
	assert_contains "$jobs" "JOBS=[7]" "$CUR_TEST" || { rm -rf /usr/ports/sysroots/sr10.conf /usr/local-sr10-sys; return; }
	rm -rf /usr/ports/sysroots/sr10.conf /usr/local-sr10-sys
	t_pass
}
 
# "mp sysroot install <name>" (the fold-onto-live-root primitive) with
# a package whose own manifest includes a directory entry (fstree.c's
# own "path\tdir" marker, tracking an otherwise-empty subdirectory) --
# merge.c's own merge_one only ever handled regular files and symlinks
# until this was hit for real folding druid520's own sbase, dying
# outright ("manifest entry is neither a regular file nor a symlink")
# on the very first directory-tracked package in any real fold.
test_sysroot_fold_directory_entry() {
	t_begin "sysroot_fold_directory_entry"
	reset_state
	printf 'GLOBAL_DEPS=" "\n' >> "$CONF"
	mkdir -p /usr/ports/sysroots
	echo 'MP_PREFIX=/usr/local-sr11-sys' > /usr/ports/sysroots/sr11.conf
	rm -rf /usr/local-sr11-sys "$WD/sysroots/sr11"
	mkdir -p /usr/local-sr11-sys
	mkport sr11p <<'EOF'
pkg_name="sr11p"
pkg_ver="1.0"
install:
	mkdir -p $MP_PREFIX/sr11dir/empty-subdir
	echo x > $MP_PREFIX/sr11dir/file.txt
remove:
	rm -rf $MP_PREFIX/sr11dir
EOF
	mp install --sysroot=sr11 sr11p >/tmp/sr11.out 2>&1
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST (install into sysroot)" || { rm -rf /usr/ports/sysroots/sr11.conf /usr/local-sr11-sys; return; }
	out=$(mp sysroot install sr11 2>&1)
	rc=$?
	assert_exit0 "$rc" "$CUR_TEST (fold onto live root)" || { rm -rf /usr/ports/sysroots/sr11.conf /usr/local-sr11-sys; return; }
	assert_file_exists "$MP_PREFIX/sr11dir/empty-subdir" "$CUR_TEST (empty subdir merged)" || { rm -rf /usr/ports/sysroots/sr11.conf /usr/local-sr11-sys; return; }
	assert_contains "$(cat "$MP_PREFIX/sr11dir/file.txt" 2>&1)" "x" "$CUR_TEST (real file merged too)" || { rm -rf /usr/ports/sysroots/sr11.conf /usr/local-sr11-sys; return; }
	rm -rf /usr/ports/sysroots/sr11.conf /usr/local-sr11-sys
	t_pass
}
 
run_sysroots_suite() {
	test_dep_inherits_parent_sysroot
	test_dep_own_sysroot_overrides_parent
	test_default_parent_sysroot_dep
	test_cli_sysroot_flag
	test_sysroot_fold_directory_entry
	test_sysroot_tag_resolution_isolated
	test_sysroot_hold_independent
	test_same_name_two_roots
	test_sysroot_use_drives_slot
	test_sysroot_linkdeps_scoped
	test_sysroot_mpxconf_jobs
}
powered by btf.