@@ -54,9 +54,9 @@ test_exp "$(norm_dirname "$cache_art")" = "$CACHE_DIR/artifacts"
5454test_exp " $cache_art " ! = " $local_art "
5555test_cmd cmp -s " $cache_art " " $local_art "
5656
57- # Verify supported artifacts end up in the cache directory
58- test_run build \
59- test:exe Test:static Test:shared +Test:o.export +Test:o.noexport +Module
57+ # Verify supported artifacts use the cache directory
58+ test_run build test:exe Test:static Test:shared \
59+ + Test:dynlib +Test:o.export +Test:o.noexport +Module
6060test_cached () {
6161 target=" $1 " ; shift
6262 art=" $( $LAKE query $target ) "
@@ -145,7 +145,7 @@ test_out "Fetched Test:c.o" build +Test:o -v --no-build
145145test_cmd rm -rf " $CACHE_DIR /outputs" .lake/build/ir/Test.c
146146test_run -v build +Test:c --no-build
147147
148- # Verify that the olean does need to be present in the build directory
148+ # Verify that the olean does not need to be present in the build directory
149149test_cmd rm -f .lake/build/lib/lean/Test.olean .lake/build/lib/lean/Test/Imported.olean
150150test_run -v build +Test.Imported --no-build --wfail
151151test_run -v build +Test
@@ -168,16 +168,22 @@ test_lines 3 .lake/outputs.jsonl
168168test_run build Test:static -o .lake/outputs.jsonl
169169test_lines 6 .lake/outputs.jsonl
170170
171- # Verify all artifacts end up in the cache directory with `restoreAllArtifacts`
171+ # Verify all artifacts restore from the cache and
172+ # use the build directory with `restoreAllArtifacts`
172173test_cmd cp -r " $CACHE_DIR " .lake/cache-backup
173174test_cmd rm -rf " $CACHE_DIR " .lake/build
174- test_run build -R -KrestoreAll=true \
175- test:exe Test:static Test:shared +Test:o.export +Test:o.noexport +Module
175+ test_run build -R -KrestoreAll=true test:exe Test:static Test:shared \
176+ +Test:dynlib +Test:o.export +Test:o.noexport +Module
177+ test_cmd rm -rf .lake/build
178+ test_run build -v --no-build test:exe Test:static Test:shared \
179+ +Test:dynlib +Test:o.export +Test:o.noexport +Module
176180test_restored () {
177181 target=" $1 " ; shift
178182 art=" $( $LAKE query $target ) "
179- echo " ! artifact cached: $target -> $art "
183+ hardlinks=" $( stat -c %h " $art " ) "
184+ echo " ! artifact cached (links: $hardlinks ): $target -> $art "
180185 test ! " $( norm_dirname " $art " ) " = " $CACHE_DIR /artifacts"
186+ test $hardlinks -gt 1 # check that the restored artifact is hard linked
181187 if [ -n " ${1:- } " ]; then
182188 test " $( basename " $art " ) " = " $1 "
183189 fi
0 commit comments