Skip to content

Commit b622ffe

Browse files
committed
run_parser
1 parent cbeec1a commit b622ffe

File tree

31 files changed

+248
-246
lines changed

31 files changed

+248
-246
lines changed

services/cli/src/bencher/sub/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ mod docker;
44
mod mock;
55
mod organization;
66
mod project;
7+
mod run;
78
mod sub_cmd;
89
mod system;
910
mod user;
@@ -24,15 +25,12 @@ use project::{
2425
plot::Plot,
2526
project::Project,
2627
report::Report,
27-
run::Run,
2828
testbed::Testbed,
2929
threshold::Threshold,
3030
};
31-
pub use project::{
32-
archive::ArchiveError,
33-
run::{runner::output::Output, thresholds::ThresholdsError, RunError},
34-
threshold::ThresholdError,
35-
};
31+
pub use project::{archive::ArchiveError, report::ThresholdsError, threshold::ThresholdError};
32+
use run::Run;
33+
pub use run::{runner::output::Output, RunError};
3634
pub use sub_cmd::SubCmd;
3735
use system::{auth::Auth, server::Server};
3836
use user::{token::Token, user::User};

services/cli/src/bencher/sub/project/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,5 @@ pub mod plot;
99
#[allow(clippy::module_inception)]
1010
pub mod project;
1111
pub mod report;
12-
pub mod run;
1312
pub mod testbed;
1413
pub mod threshold;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
use bencher_client::types::Adapter;
2+
3+
use crate::parser::project::report::CliReportAdapter;
4+
5+
impl From<CliReportAdapter> for Adapter {
6+
fn from(adapter: CliReportAdapter) -> Self {
7+
match adapter {
8+
CliReportAdapter::Magic => Self::Magic,
9+
CliReportAdapter::Json => Self::Json,
10+
CliReportAdapter::CSharp => Self::CSharp,
11+
CliReportAdapter::CSharpDotNet => Self::CSharpDotNet,
12+
CliReportAdapter::Cpp => Self::Cpp,
13+
CliReportAdapter::CppCatch2 => Self::CppCatch2,
14+
CliReportAdapter::CppGoogle => Self::CppGoogle,
15+
CliReportAdapter::Go => Self::Go,
16+
CliReportAdapter::GoBench => Self::GoBench,
17+
CliReportAdapter::Java => Self::Java,
18+
CliReportAdapter::JavaJmh => Self::JavaJmh,
19+
CliReportAdapter::Js => Self::Js,
20+
CliReportAdapter::JsBenchmark => Self::JsBenchmark,
21+
CliReportAdapter::JsTime => Self::JsTime,
22+
CliReportAdapter::Python => Self::Python,
23+
CliReportAdapter::PythonAsv => Self::PythonAsv,
24+
CliReportAdapter::PythonPytest => Self::PythonPytest,
25+
CliReportAdapter::Ruby => Self::Ruby,
26+
CliReportAdapter::RubyBenchmark => Self::RubyBenchmark,
27+
CliReportAdapter::Rust => Self::Rust,
28+
CliReportAdapter::RustBench => Self::RustBench,
29+
CliReportAdapter::RustCriterion => Self::RustCriterion,
30+
CliReportAdapter::RustIai => Self::RustIai,
31+
CliReportAdapter::RustIaiCallgrind => Self::RustIaiCallgrind,
32+
CliReportAdapter::Shell => Self::Shell,
33+
CliReportAdapter::ShellHyperfine => Self::ShellHyperfine,
34+
}
35+
}
36+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use bencher_client::types::JsonAverage;
2+
3+
use crate::parser::project::report::CliReportAverage;
4+
5+
impl From<CliReportAverage> for JsonAverage {
6+
fn from(average: CliReportAverage) -> Self {
7+
match average {
8+
CliReportAverage::Mean => Self::Mean,
9+
CliReportAverage::Median => Self::Median,
10+
}
11+
}
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use bencher_client::types::JsonFold;
2+
3+
use crate::parser::project::report::CliReportFold;
4+
5+
impl From<CliReportFold> for JsonFold {
6+
fn from(fold: CliReportFold) -> Self {
7+
match fold {
8+
CliReportFold::Min => Self::Min,
9+
CliReportFold::Max => Self::Max,
10+
CliReportFold::Mean => Self::Mean,
11+
CliReportFold::Median => Self::Median,
12+
}
13+
}
14+
}

services/cli/src/bencher/sub/project/report/create.rs renamed to services/cli/src/bencher/sub/project/report/create/mod.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,19 @@ use bencher_json::ResourceId;
77
use crate::{
88
bencher::{
99
backend::AuthBackend,
10-
sub::{
11-
project::{branch::start_point::StartPoint, run::thresholds::Thresholds},
12-
SubCmd,
13-
},
10+
sub::{project::branch::start_point::StartPoint, SubCmd},
1411
},
1512
parser::project::report::CliReportCreate,
1613
CliError,
1714
};
1815

16+
mod adapter;
17+
mod average;
18+
mod fold;
19+
mod thresholds;
20+
21+
pub use thresholds::{Thresholds, ThresholdsError};
22+
1923
#[derive(Debug, Clone)]
2024
pub struct Create {
2125
pub project: ResourceId,

services/cli/src/bencher/sub/project/run/thresholds.rs renamed to services/cli/src/bencher/sub/project/report/create/thresholds.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
bencher::sub::project::threshold::model::Model,
88
parser::{
99
project::{
10-
run::CliRunThresholds,
10+
report::CliReportThresholds,
1111
threshold::{CliModel, CliModelTest},
1212
},
1313
ElidedOption,
@@ -44,11 +44,11 @@ pub enum ThresholdsError {
4444
ExtraUpperBoundaries(Vec<ElidedOption<Boundary>>),
4545
}
4646

47-
impl TryFrom<CliRunThresholds> for Thresholds {
47+
impl TryFrom<CliReportThresholds> for Thresholds {
4848
type Error = ThresholdsError;
4949

50-
fn try_from(thresholds: CliRunThresholds) -> Result<Self, Self::Error> {
51-
let CliRunThresholds {
50+
fn try_from(thresholds: CliReportThresholds) -> Result<Self, Self::Error> {
51+
let CliReportThresholds {
5252
threshold_measure,
5353
threshold_test,
5454
threshold_min_sample_size,

services/cli/src/bencher/sub/project/report/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ mod delete;
55
mod list;
66
mod view;
77

8+
pub use create::{Thresholds, ThresholdsError};
9+
810
#[derive(Debug)]
911
pub enum Report {
1012
List(list::List),

services/cli/src/bencher/sub/project/run/adapter.rs

Lines changed: 0 additions & 36 deletions
This file was deleted.

services/cli/src/bencher/sub/project/run/average.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)