Skip to content

Commit 48a8169

Browse files
committed
test(cache): share copy rule project fixture
Extract the repeated Dune cache test project with a copy rule and source file into a shared blackbox-test helper. Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
1 parent bdf4182 commit 48a8169

3 files changed

Lines changed: 15 additions & 20 deletions

File tree

test/blackbox-tests/setup-script.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,19 @@ write_cross_compilation_repro_project() {
825825
fi
826826
}
827827

828+
make_dune_cache_copy_project() {
829+
make_dune_project 2.1
830+
cat > dune <<-'EOF'
831+
(rule
832+
(deps source)
833+
(targets target)
834+
(action (copy source target)))
835+
EOF
836+
cat > source <<-'EOF'
837+
\_o< COIN
838+
EOF
839+
}
840+
828841
make_two_context_workspace() {
829842
local version="${1:-3.13}"
830843
local name="${2:-alt-context}"

test/blackbox-tests/test-cases/dune-cache/config.t

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,7 @@ Check that old cache configuration format works fine with an old language
1010
> (cache-trim-period 1h)
1111
> (cache-trim-size 1GB)
1212
> EOF
13-
$ make_dune_project 2.1
14-
$ cat > dune <<EOF
15-
> (rule
16-
> (deps source)
17-
> (targets target)
18-
> (action (copy source target)))
19-
> EOF
20-
$ cat > source <<EOF
21-
> \_o< COIN
22-
> EOF
13+
$ make_dune_cache_copy_project
2314

2415
Test that DUNE_CACHE_ROOT can be used to control the cache location
2516

test/blackbox-tests/test-cases/dune-cache/dedup.t

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,7 @@ Test deduplication of build artifacts when using Dune cache with hard links.
33
$ export DUNE_CACHE=enabled
44
$ export DUNE_CACHE_ROOT=$(dune_cmd native-path $PWD/.cache)
55

6-
$ make_dune_project 2.1
7-
$ cat > dune <<EOF
8-
> (rule
9-
> (deps source)
10-
> (targets target)
11-
> (action (copy source target)))
12-
> EOF
13-
$ cat > source <<EOF
14-
> \_o< COIN
15-
> EOF
6+
$ make_dune_cache_copy_project
167

178
Here we build [target], which is a copy of [source]. After the build, the same
189
file will appear in the build directory twice: (i) as [_build/default/source],

0 commit comments

Comments
 (0)