You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a significant problem when switching between anchor build and anchor 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:
Debian Stable (on host),
Debian Stable (docker guest over linux host),
Debian Stable (docker guest over windows host) - bug shows in all
Versions checked:
anchor-cli 0.30.1
solana: both 1.18 and 2.1.6
Steps to see the bug
Starting from the default anchor init --test-template rust code and running some build & test commands:
$ anchor build
...
Building [=======> ] 83/256:
...
Finished `test` profile [unoptimized + debuginfo] target(s) in 15.76s
$ anchor build
...
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.82s
$ anchor test --skip-local-validator
...
Building [============> ] 134/256:
...
Finished `test` profile [unoptimized + debuginfo] target(s) in 15.76s
...
Building [===> ] 108/590:
...
Finished `test` profile [unoptimized + debuginfo] target(s) in 1m 14s
...
$ anchor test --skip-local-validator
... it recompiles everything again
$ anchor test --skip-local-validator
... and again.
cargo test-sbf and cargo build-sbf
This bug is not present when following native rust tutorial - after initial compilation, both cargo build-sbf and cargo test-sbf take 1s each, even if they are alternated
Workaround?
First idea is to manually set CARGO_TARGET_DIR to folder1 when running anchor build and to folder2 when running anchor test.
Does NOT work, since anchor does not listen to CARGO_TARGET_DIR when placing so/idl files (#958#2402). Faking it with a symlink works, but then, the anchor test command somehow invalidates its own folder between its build program and build 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:
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: