Skip to content

Commit dea76f6

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 eb3d7cb commit dea76f6

3 files changed

Lines changed: 16 additions & 21 deletions

File tree

test/blackbox-tests/setup-script.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ write_cross_compilation_repro_project() {
573573
(rule
574574
(with-stdout-to
575575
gen.ml
576-
(echo "let () = Format.printf \"let x = 1\"")))
576+
(echo "let () = Format.printf "let x = 1"")))
577577
(library
578578
(name repro)
579579
(public_name repro)
@@ -589,6 +589,19 @@ write_cross_compilation_repro_project() {
589589
fi
590590
}
591591

592+
make_dune_cache_copy_project() {
593+
make_dune_project 2.1
594+
cat > dune <<-'EOF'
595+
(rule
596+
(deps source)
597+
(targets target)
598+
(action (copy source target)))
599+
EOF
600+
cat > source <<-'EOF'
601+
\_o< COIN
602+
EOF
603+
}
604+
592605
make_two_context_workspace() {
593606
local version="${1:-3.13}"
594607
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)