Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve init #129

Merged
merged 8 commits into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/cli/src/command/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub async fn fuzz(root: Option<String>, subcmd: FuzzCommand) {
// generate generator with root so that we do not need to again
// look for root within the generator
let mut generator = TestGenerator::new_with_root(root);
generator.add_new_fuzz_test().await?;
generator.add_fuzz_test().await?;
}
};
}
1 change: 1 addition & 0 deletions crates/cli/src/command/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ pub async fn test(root: Option<String>) {
}
};
let commander = Commander::with_root(root);
commander.build_anchor_project().await?;
commander.run_tests().await?;
}
11 changes: 6 additions & 5 deletions crates/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ pretty_assertions = "1.1.0"
macrotest = "1.0.9"

[dependencies]
trdelnik-derive-displayix = { path = "./derive/display_ix" }
trdelnik-derive-fuzz-deserialize = { path = "./derive/fuzz_deserialize" }
trdelnik-derive-fuzz-test-executor = { path = "./derive/fuzz_test_executor" }
trdelnik-test = { workspace = true }
anchor-lang = { version = "0.29.0", features = ["idl-build"] }
# INFO: This is a hack! Anchor-spl is here as dependency only to activate the idl-build feature, so that
# users do not have to do it manually in their program's Cargo.toml
anchor-spl = { version = "0.29.0", features = ["idl-build"] }
anchor-lang = { version = "0.29.0", features = ["idl-build"] }
solana-sdk = { workspace = true }
solana-cli-output = { workspace = true }
solana-transaction-status = { workspace = true }
Expand Down Expand Up @@ -59,13 +62,11 @@ lazy_static = { workspace = true }
proc-macro2 = { workspace = true }
honggfuzz = { version = "0.5.55", optional = true }
arbitrary = { version = "1.3.0", features = ["derive"] }
# solana-program-test = { version = "=1.17.16", optional = true }
solana-program-test-anchor-fix = { version = "1.17.9", optional = true }
# solana-program-test = { version = "=1.17.16", optional = true }
quinn-proto = { version = "0.10.6", optional = true }
solana-program-runtime = { version = "<1.18", optional = true }
shellexpand = { workspace = true }
trdelnik-derive-displayix = { path = "./derive/display_ix" }
trdelnik-derive-fuzz-deserialize = { path = "./derive/fuzz_deserialize" }
trdelnik-derive-fuzz-test-executor = { path = "./derive/fuzz_test_executor" }
pathdiff = "0.2.1"
solana-banks-client = "<1.18"
indicatif = "0.17.8"
15 changes: 7 additions & 8 deletions crates/client/src/cleaner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ use std::{
use thiserror::Error;
use tokio::{fs, process::Command};

use crate::constants::*;

#[derive(Error, Debug)]
pub enum Error {
#[error("{0:?}")]
Expand Down Expand Up @@ -44,19 +46,16 @@ impl Cleaner {
#[throws]
async fn clean_hfuzz_target(&self, root: &PathBuf) {
let hfuzz_target_path = Path::new(root)
.join(crate::test_generator::TESTS_WORKSPACE)
.join(crate::test_generator::FUZZ_TEST_DIRECTORY)
.join(crate::test_generator::FUZZING)
.join(crate::test_generator::HFUZZ_TARGET);
.join(TESTS_WORKSPACE_DIRECTORY)
.join(FUZZ_TEST_DIRECTORY)
.join(FUZZING)
.join(HFUZZ_TARGET);
if hfuzz_target_path.exists() {
fs::remove_dir_all(hfuzz_target_path).await?;
} else {
println!(
"skipping {}/{}/{}/{} directory: not found",
crate::test_generator::TESTS_WORKSPACE,
crate::test_generator::FUZZ_TEST_DIRECTORY,
crate::test_generator::FUZZING,
crate::test_generator::HFUZZ_TARGET
TESTS_WORKSPACE_DIRECTORY, FUZZ_TEST_DIRECTORY, FUZZING, HFUZZ_TARGET
)
}
}
Expand Down
3 changes: 1 addition & 2 deletions crates/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ use std::{thread::sleep, time::Duration};
// @TODO: Make compatible with the latest Anchor deps.
// https://github.com/project-serum/anchor/pull/1307#issuecomment-1022592683

const RETRY_LOCALNET_EVERY_MILLIS: u64 = 500;
const DEFAULT_KEYPAIR_PATH: &str = "~/.config/solana/id.json";
use crate::constants::*;

type Payer = Rc<Keypair>;

Expand Down
Loading
Loading