add additional cli options to disable other properties

This commit is contained in:
pedrocarlo
2025-06-08 02:41:02 -03:00
parent edc1c6fbc6
commit e19fa9f951
3 changed files with 54 additions and 6 deletions

View File

@@ -715,24 +715,44 @@ impl ArbitraryFrom<(&SimulatorEnv, &InteractionStats)> for Property {
frequency(
vec![
(
f64::min(remaining_.read, remaining_.write),
if !env.opts.disable_insert_values_select {
f64::min(remaining_.read, remaining_.write)
} else {
0.0
},
Box::new(|rng: &mut R| property_insert_values_select(rng, env, &remaining_)),
),
(
remaining_.create / 2.0,
if !env.opts.disable_double_create_failure {
remaining_.create / 2.0
} else {
0.0
},
Box::new(|rng: &mut R| property_double_create_failure(rng, env, &remaining_)),
),
(
remaining_.read,
if !env.opts.disable_select_limit {
remaining_.read
} else {
0.0
},
Box::new(|rng: &mut R| property_select_limit(rng, env)),
),
(
f64::min(remaining_.read, remaining_.write).min(remaining_.delete),
if !env.opts.disable_delete_select {
f64::min(remaining_.read, remaining_.write).min(remaining_.delete)
} else {
0.0
},
Box::new(|rng: &mut R| property_delete_select(rng, env, &remaining_)),
),
(
// remaining_.drop,
0.0,
if !env.opts.disable_drop_select {
// remaining_.drop
0.0
} else {
0.0
},
Box::new(|rng: &mut R| property_drop_select(rng, env, &remaining_)),
),
(

View File

@@ -58,6 +58,24 @@ pub struct SimulatorCLI {
pub disable_create_index: bool,
#[clap(long, help = "disable DROP Statement", default_value_t = false)]
pub disable_drop: bool,
#[clap(
long,
help = "disable Insert-Values-Select Property",
default_value_t = false
)]
pub disable_insert_values_select: bool,
#[clap(
long,
help = "disable Double-Create-Failure Property",
default_value_t = false
)]
pub disable_double_create_failure: bool,
#[clap(long, help = "disable Select-Limit Property", default_value_t = false)]
pub disable_select_limit: bool,
#[clap(long, help = "disable Delete-Select Property", default_value_t = false)]
pub disable_delete_select: bool,
#[clap(long, help = "disable Drop-Select Property", default_value_t = false)]
pub disable_drop_select: bool,
#[clap(
long,
help = "disable Select-Select-Optimizer Property",

View File

@@ -111,6 +111,11 @@ impl SimulatorEnv {
drop_percent,
update_percent,
disable_select_optimizer: cli_opts.disable_select_optimizer,
disable_insert_values_select: cli_opts.disable_insert_values_select,
disable_double_create_failure: cli_opts.disable_double_create_failure,
disable_select_limit: cli_opts.disable_select_limit,
disable_delete_select: cli_opts.disable_delete_select,
disable_drop_select: cli_opts.disable_drop_select,
page_size: 4096, // TODO: randomize this too
max_interactions: rng.gen_range(cli_opts.minimum_tests..=cli_opts.maximum_tests),
max_time_simulation: cli_opts.maximum_time,
@@ -218,6 +223,11 @@ pub(crate) struct SimulatorOpts {
pub(crate) drop_percent: f64,
pub(crate) disable_select_optimizer: bool,
pub(crate) disable_insert_values_select: bool,
pub(crate) disable_double_create_failure: bool,
pub(crate) disable_select_limit: bool,
pub(crate) disable_delete_select: bool,
pub(crate) disable_drop_select: bool,
pub(crate) max_interactions: usize,
pub(crate) page_size: usize,