Skip to content

Commit 3eedaad

Browse files
ci: Re-enable zero-copy tests (solana-foundation#4201)
1 parent 78dfb37 commit 3eedaad

File tree

4 files changed

+12
-27
lines changed

4 files changed

+12
-27
lines changed

.github/workflows/reusable-tests.yaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -428,12 +428,8 @@ jobs:
428428
path: tests/typescript
429429
- cmd: cd tests/duplicate-mutable-accounts && anchor test --skip-lint
430430
path: tests/duplicate-mutable-accounts
431-
# zero-copy tests cause `/usr/bin/ld: final link failed: No space left on device`
432-
# on GitHub runners. It is likely caused by `cargo test-sbf` since all other tests
433-
# don't have this problem.
434-
# TODO: Find a fix.
435-
# - cmd: cd tests/zero-copy && anchor test --skip-lint && cd programs/zero-copy && cargo test-sbf
436-
# path: tests/zero-copy
431+
- cmd: cd tests/zero-copy && anchor test --skip-lint && cd programs/zero-copy && cargo test-sbf
432+
path: tests/zero-copy
437433
- cmd: cd tests/chat && anchor test --skip-lint
438434
path: tests/chat
439435
- cmd: cd tests/ido-pool && anchor test --skip-lint

tests/zero-copy/programs/zero-copy/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ bytemuck = {version = "1.4.0", features = ["derive", "min_const_generics"]}
2222

2323
[dev-dependencies]
2424
anchor-client = { path = "../../../../client", features = ["debug", "async"] }
25-
solana-program-test = "2"
25+
solana-program-test = "3.1"
26+
solana-sdk = "3.0"

tests/zero-copy/programs/zero-copy/tests/compute_unit_test.rs

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
11
#![cfg(feature = "test-sbf")]
22

33
use {
4-
anchor_client::{
5-
anchor_lang::Discriminator,
6-
solana_account::Account,
7-
solana_sdk::{
8-
commitment_config::CommitmentConfig,
9-
pubkey::Pubkey,
10-
signature::Keypair,
11-
transaction::Transaction,
12-
},
13-
solana_signer::Signer,
14-
Client, Cluster,
15-
},
4+
anchor_client::{anchor_lang::Discriminator, Client, Cluster},
165
solana_program_test::{tokio, ProgramTest},
6+
solana_sdk::{
7+
account::Account, pubkey::Pubkey, signature::Keypair, signer::Signer,
8+
transaction::Transaction,
9+
},
1710
std::rc::Rc,
1811
};
1912

@@ -40,13 +33,9 @@ async fn update_foo() {
4033
let mut pt = ProgramTest::new("zero_copy", zero_copy::id(), None);
4134
pt.add_account(foo_pubkey, foo_account);
4235
pt.set_compute_max_units(4157);
43-
let (mut banks_client, payer, recent_blockhash) = pt.start().await;
36+
let (banks_client, payer, recent_blockhash) = pt.start().await;
4437

45-
let client = Client::new_with_options(
46-
Cluster::Debug,
47-
Rc::new(Keypair::new()),
48-
CommitmentConfig::processed(),
49-
);
38+
let client = Client::new(Cluster::Debug, Rc::new(Keypair::new()));
5039
let program = client.program(zero_copy::id()).unwrap();
5140
let update_ix = program
5241
.request()
@@ -56,7 +45,6 @@ async fn update_foo() {
5645
})
5746
.args(zero_copy::instruction::UpdateFoo { data: 1u64 })
5847
.instructions()
59-
.unwrap()
6048
.pop()
6149
.unwrap();
6250

tests/zero-copy/programs/zero-cpi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub mod zero_cpi {
1414
bar: ctx.accounts.bar.to_account_info(),
1515
foo: ctx.accounts.foo.to_account_info(),
1616
};
17-
let cpi_ctx = CpiContext::new(cpi_accounts);
17+
let cpi_ctx = CpiContext::new(ctx.accounts.zero_copy_program.key(), cpi_accounts);
1818
zero_copy::cpi::update_bar(cpi_ctx, data)?;
1919
Ok(())
2020
}

0 commit comments

Comments
 (0)