Skip to content

Commit 6661d96

Browse files
committed
Add a basic test for config files involving hardlinks
This is pretty simplistic for now and should be expanded.
1 parent 1db47cb commit 6661d96

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

tests/frontend/configmerge.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ tests_init \
55
config \
66
config_fileexist \
77
config_fileexist_notinpkg \
8+
config_hardlink \
89
config_morecomplicated
910

1011
config_body()
@@ -84,6 +85,57 @@ config_fileexist_body()
8485
test -f ${TMPDIR}/target/${TMPDIR}/a.pkgnew || atf_fail "file overwritten when it should not have"
8586
}
8687

88+
config_hardlink_body()
89+
{
90+
# Create a pkg
91+
atf_check -s exit:0 ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1.0"
92+
echo "line 1" > a
93+
echo "line 2" >> a
94+
ln a b
95+
echo "@config /a" > plist
96+
echo "/b" >> plist
97+
atf_check \
98+
-o empty \
99+
-e empty \
100+
pkg create -M test.ucl -p plist -r .
101+
atf_check -o ignore pkg repo .
102+
echo "local: { url: file://${TMPDIR} }" > local.conf
103+
mkdir ${TMPDIR}/target
104+
105+
# Install the pkg
106+
atf_check \
107+
-e match:".*load error: access repo file.*" \
108+
pkg -o REPOS_DIR=${TMPDIR} -r ${TMPDIR}/target install -qy test
109+
rm *.txz
110+
111+
# Modify the local config
112+
echo "line 1a" > target/a
113+
echo "line 2" >> target/a
114+
115+
# Create an updated pkg
116+
atf_check -s exit:0 ${RESOURCEDIR}/test_subr.sh new_pkg "test" "test" "1.1"
117+
echo "line 1" > a
118+
echo "line 2" >> a
119+
echo "@config /a" > plist
120+
echo "/b" >> plist
121+
atf_check \
122+
-o empty \
123+
-e empty \
124+
pkg create -M test.ucl -p plist -r .
125+
atf_check -o ignore pkg repo .
126+
atf_check -e ignore -o ignore pkg -o REPOS_DIR=${TMPDIR} update -f
127+
128+
# Upgrade
129+
atf_check \
130+
-o ignore \
131+
pkg -o REPOS_DIR=${TMPDIR} -r ${TMPDIR}/target upgrade -y
132+
133+
atf_check \
134+
-o match:"test-1.1*" \
135+
pkg -r ${TMPDIR}/target info
136+
137+
}
138+
87139
config_fileexist_notinpkg_body()
88140
{
89141
mkdir -p ${TMPDIR}/target/${TMPDIR}

0 commit comments

Comments
 (0)