Skip to content

Negative numeric walltime durations are accepted #364

Description

@tusharhqq

What I observed

The walltime duration parser accepts a bare negative numeric duration such as -1 far enough that execution starts.

I expected a negative duration to be rejected as an invalid duration before benchmark execution begins.

Reproduction

I reproduced this against the exec harness walltime option from this checkout:

cargo run -p exec-harness -- --max-time -1 true

The command did not fail during duration parsing. It started running the benchmark and then failed later:

Executing: true
Completed 142 warmup rounds
Error: Unable to determine number of rounds to perform

I also checked the parser path directly with this local test:

#[test]
fn negative_numeric_duration_is_rejected() {
    assert!(parse_duration_to_ns("-1").is_err());
}

That assertion fails.

Expected behavior

Bare numeric durations should reject negative values.

Actual behavior

A bare numeric value like -1 is accepted by duration parsing and turns into a later execution error instead of an invalid-duration error.

I have not tried to fully classify every invalid numeric input here; the concrete case I observed is -1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions