@@ -65,6 +65,10 @@ vcpkg_consumer() {
6565 " $MCPP " run | tee target/ci/run.log
6666 grep -qE ' ^vcpkg-consumer: fmt [0-9]+ says 42$' target/ci/run.log || fail " the program did not print through fmt"
6767 assert_not_rerun " $( stamp_of deps-vcpkg) "
68+ # A file of the prefix the build program named in options::deploy.
69+ find target -path ' */bin/licenses/fmt/copyright' | grep -q . ||
70+ fail " share/fmt/copyright was not deployed beside the program"
71+ echo " ok: a file of the prefix is deployed beside the program"
6872
6973 if is_windows; then
7074 # The pack collects it from the runtime search directory.
@@ -74,6 +78,7 @@ vcpkg_consumer() {
7478 fail " started from the build directory, the program did not find fmt.dll"
7579 " $MCPP " pack --format dir | tee target/ci/pack.log
7680 find target/dist -iname ' fmt.dll' | grep -q . || fail " the packed tree carries no fmt.dll"
81+ find target/dist -path ' */licenses/fmt/copyright' | grep -q . || fail " the packed tree carries no deployed copyright"
7782 echo " ok: the packed tree carries fmt.dll"
7883 fi
7984}
@@ -128,6 +133,58 @@ cmake_consumer() {
128133 echo " ok: a file added to the subproject re-ran its installation"
129134}
130135
136+ archive_consumer () {
137+ cd " $ROOT /tests/archive-consumer"
138+ rm -rf target
139+ mkdir -p target/ci
140+ # PLANNING EXTRACTS NOTHING. The listing is read from the archive's central
141+ # directory; the extraction is an action.
142+ " $MCPP " emit build-database --format json > target/ci/db.json 2> target/ci/emit.log ||
143+ { cat target/ci/emit.log; fail " emit build-database failed before any extraction" ; }
144+ [ -z " $( find target -path ' *deps-archive*' -type f) " ] || fail " emit build-database extracted something"
145+ echo " ok: emit planned the archive and extracted nothing"
146+
147+ " $MCPP " build 2>&1 | tee target/ci/build.log
148+ " $MCPP " run | tee target/ci/run.log
149+ grep -q " ^archive-consumer: 'greetings from the archive', 'a file two levels down'$" target/ci/run.log ||
150+ fail " the program did not read the archive's files from beside itself"
151+ # The C++ file among the data `#error`s if compiled; the build succeeded,
152+ # and the file is beside the program as data.
153+ find target -path ' */bin/runtime/bundle/not-compiled.cpp' | grep -q . ||
154+ fail " an archive member was not deployed beside the program"
155+ echo " ok: the archive's tree is beside the program, a C++ member included, as data"
156+
157+ local copy
158+ copy=$( find target -path ' *deps-archive/bundle/bundle/greeting.txt' | head -1)
159+ [ -n " $copy " ] || fail " no extracted copy under target/"
160+ touch -r " $copy " target/ci/before-second-build
161+ sleep 1
162+ " $MCPP " build --profile dev > target/ci/second-build.log 2>&1 ||
163+ { cat target/ci/second-build.log; fail " the second build failed" ; }
164+ [ -z " $( find " $copy " -newer target/ci/before-second-build) " ] ||
165+ fail " a second build with nothing changed extracted the archive again"
166+ echo " ok: a second build with nothing changed did not extract the archive again"
167+
168+ touch assets/bundle.zip
169+ " $MCPP " build --profile dev > target/ci/third-build.log 2>&1 ||
170+ { cat target/ci/third-build.log; fail " the build after touching the archive failed" ; }
171+ [ -n " $( find " $copy " -newer target/ci/before-second-build) " ] ||
172+ fail " a changed archive was not extracted again"
173+ echo " ok: a changed archive was extracted again"
174+
175+ " $MCPP " pack --format dir > target/ci/pack.log 2>&1 || { cat target/ci/pack.log; fail " mcpp pack failed" ; }
176+ find target/dist -path ' */runtime/bundle/nested/deep.txt' | grep -q . ||
177+ fail " the packed tree does not carry the archive's files"
178+ # A PE program sits at the root of the packed tree, an ELF or Mach-O one
179+ # under bin/; the deployed files are beside it either way.
180+ local packed
181+ packed=$( find target/dist -type f \( -name archive-consumer -o -name archive-consumer.exe \) | head -1 || true)
182+ [ -n " $packed " ] || fail " no packed program under target/dist"
183+ " $packed " | grep -q " ^archive-consumer: 'greetings from the archive'" ||
184+ fail " the packed program did not read the archive's files"
185+ echo " ok: the packed tree carries the archive's files, and the packed program reads them"
186+ }
187+
131188qt_consumer () {
132189 cd " $ROOT /tests/qt-consumer"
133190 rm -rf target
@@ -146,6 +203,9 @@ qt_consumer() {
146203 fail " moc, rcc or lrelease did not reach the program"
147204 find target -name ' qt_consumer_de.qm' | grep -q . || fail " no .qm was produced"
148205 echo " ok: moc (header and inline), rcc and lrelease reached the program"
206+ grep -q " Qt's own 'Abbrechen'$" target/ci/run.log ||
207+ fail " Qt's own strings were not translated from the combined qt_de.qm"
208+ echo " ok: lconvert combined Qt's catalogs into qt_de.qm, and the program loads it"
149209 " $MCPP " build --profile dev -v > target/ci/second-build.log 2>&1 ||
150210 { cat target/ci/second-build.log; fail " the second build failed" ; }
151211 ! grep -qE ' /(lupdate|lrelease)[^ ]* ' target/ci/second-build.log ||
@@ -179,9 +239,10 @@ qt_widgets_consumer() {
179239
180240case " ${1:- } " in
181241 vcpkg-consumer) vcpkg_consumer ;;
242+ archive-consumer) archive_consumer ;;
182243 vcpkg-workspace) vcpkg_workspace ;;
183244 cmake-consumer) cmake_consumer ;;
184245 qt-consumer) qt_consumer ;;
185246 qt-widgets-consumer) qt_widgets_consumer ;;
186- * ) echo " usage: $0 vcpkg-consumer|vcpkg-workspace|cmake-consumer|qt-consumer|qt-widgets-consumer" ; exit 2 ;;
247+ * ) echo " usage: $0 vcpkg-consumer|archive-consumer| vcpkg-workspace|cmake-consumer|qt-consumer|qt-widgets-consumer" ; exit 2 ;;
187248esac
0 commit comments