anchor build
and anchor test
nuke each other's target build caches
#3460
Labels
anchor build
and anchor test
nuke each other's target build caches
#3460
Description
There is a significant problem when switching between
anchor build
andanchor test
. Each time you switch from one command to the other, the build is nuked.Also, if you run
$ anchor test --skip-local-validator
again and again, since internally it builds the main program, then deploys it, then compiles the test, each time it manages to do a full recompile.Operating system checked:
Versions checked:
Steps to see the bug
Starting from the default
anchor init --test-template rust
code and running some build & test commands:anchor build
#1
(256 packages) = 15sanchor build
#2
(4 packages) = 1sanchor test
#1
= 15s (anchor build 256 packages) + 3s deploy + 1min (anchor test build 590 packages)anchor test
#2
= 15s (anchor build 256 packages) + 3s deploy + 1min (anchor test build 590 packages)anchor build
#3
(256 packages) = 28scargo test-sbf
andcargo build-sbf
This bug is not present when following native rust tutorial - after initial compilation, both
cargo build-sbf
andcargo test-sbf
take 1s each, even if they are alternatedWorkaround?
First idea is to manually set
CARGO_TARGET_DIR
tofolder1
when runninganchor build
and tofolder2
when runninganchor test
.Does NOT work, since
anchor
does not listen toCARGO_TARGET_DIR
when placing so/idl files (#958 #2402). Faking it with a symlink works, but then, theanchor test
command somehow invalidates its own folder between itsbuild program
andbuild tests
runs.At this point I believe anchor to be unusable because of this bug - you can't run the tests without waiting 2min every time.
Any ideas/suggestions?
The text was updated successfully, but these errors were encountered: