mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-13 10:37:58 +00:00
fuzz: adapt to API changes of rand
This commit is contained in:
parent
527602248f
commit
9aec9dc454
13 changed files with 115 additions and 115 deletions
|
@ -19,32 +19,32 @@ use rand::Rng;
|
|||
static CMD_PATH: &str = "env";
|
||||
|
||||
fn generate_env_args() -> Vec<String> {
|
||||
let mut rng = rand::thread_rng();
|
||||
let mut rng = rand::rng();
|
||||
let mut args = Vec::new();
|
||||
|
||||
let opts = ["-i", "-0", "-v", "-vv"];
|
||||
for opt in &opts {
|
||||
if rng.gen_bool(0.2) {
|
||||
if rng.random_bool(0.2) {
|
||||
args.push(opt.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
if rng.gen_bool(0.3) {
|
||||
if rng.random_bool(0.3) {
|
||||
args.push(format!(
|
||||
"-u={}",
|
||||
generate_random_string(rng.gen_range(3..10))
|
||||
generate_random_string(rng.random_range(3..10))
|
||||
));
|
||||
}
|
||||
|
||||
if rng.gen_bool(0.2) {
|
||||
if rng.random_bool(0.2) {
|
||||
args.push(format!("--chdir={}", "/tmp")); // Simplified example
|
||||
}
|
||||
|
||||
/*
|
||||
Options not implemented for now
|
||||
if rng.gen_bool(0.15) {
|
||||
if rng.random_bool(0.15) {
|
||||
let sig_opts = ["--block-signal"];//, /*"--default-signal",*/ "--ignore-signal"];
|
||||
let chosen_sig_opt = sig_opts[rng.gen_range(0..sig_opts.len())];
|
||||
let chosen_sig_opt = sig_opts[rng.random_range(0..sig_opts.len())];
|
||||
args.push(chosen_sig_opt.to_string());
|
||||
// Simplify by assuming SIGPIPE for demonstration
|
||||
if !chosen_sig_opt.ends_with("list-signal-handling") {
|
||||
|
@ -53,7 +53,7 @@ fn generate_env_args() -> Vec<String> {
|
|||
}*/
|
||||
|
||||
// Adding a few random NAME=VALUE pairs
|
||||
for _ in 0..rng.gen_range(0..3) {
|
||||
for _ in 0..rng.random_range(0..3) {
|
||||
args.push(format!(
|
||||
"{}={}",
|
||||
generate_random_string(5),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue