Skip to content

Commit

Permalink
feat(android): profiling (#64)
Browse files Browse the repository at this point in the history
* feat(android): profiling
  • Loading branch information
Malinskiy authored Nov 18, 2024
1 parent d294c61 commit 366b85d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub trait RapiClient {
retry_quota_test_preventive: Option<u32>,
retry_quota_test_reactive: Option<u32>,
analytics_read_only: Option<bool>,
profiling: bool,
filtering_configuration: Option<SparseMarathonfile>,
no_progress_bar: bool,
flavor: Option<String>,
Expand Down Expand Up @@ -142,6 +143,7 @@ impl RapiClient for RapiReqwestClient {
retry_quota_test_preventive: Option<u32>,
retry_quota_test_reactive: Option<u32>,
analytics_read_only: Option<bool>,
profiling: bool,
filtering_configuration: Option<SparseMarathonfile>,
no_progress_bar: bool,
flavor: Option<String>,
Expand Down Expand Up @@ -251,6 +253,7 @@ impl RapiClient for RapiReqwestClient {
platform: platform.clone(),
s3_app_path: s3_app_path.clone(),
analytics_read_only: analytics_read_only.clone(),
profiling: profiling,
code_coverage: code_coverage.clone(),
concurrency_limit: concurrency_limit.clone(),
country: None,
Expand Down Expand Up @@ -278,7 +281,7 @@ impl RapiClient for RapiReqwestClient {
test_timeout_max: test_timeout_max.clone(),
env_args: env_args_map,
test_env_args: test_env_args_map,
bundles: bundles,
bundles,
};

let response = self.client.post(url).json(&create_request).send().await?;
Expand Down Expand Up @@ -559,6 +562,8 @@ struct CreateRunRequest {
s3_app_path: Option<String>,
#[serde(rename = "analytics_read_only", default)]
analytics_read_only: Option<bool>,
#[serde(rename = "profiling", default)]
profiling: bool,
#[serde(rename = "code_coverage", default)]
code_coverage: Option<bool>,
#[serde(rename = "concurrency_limit", default)]
Expand Down
4 changes: 4 additions & 0 deletions src/cli/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use crate::{
pull::PullFileConfig,
};

use super::ProfilingArgs;

#[derive(Debug, clap::ValueEnum, Clone)]
pub enum SystemImage {
#[clap(name = "default")]
Expand Down Expand Up @@ -89,6 +91,7 @@ pub(crate) async fn run(
instrumentation_arg: Option<Vec<String>>,
retry_args: RetryArgs,
analytics_args: AnalyticsArgs,
profiling_args: ProfilingArgs,
pull_files: Option<Vec<String>>,
application_bundle: Option<Vec<String>>,
library_bundle: Option<Vec<PathBuf>>,
Expand Down Expand Up @@ -263,6 +266,7 @@ If you are interesting in library testing then please use advance mode with --li
retry_args.retry_quota_test_preventive,
retry_args.retry_quota_test_reactive,
analytics_args.analytics_read_only,
profiling_args.profiling,
filtering_configuration,
&common.output,
application,
Expand Down
1 change: 1 addition & 0 deletions src/cli/ios/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ Second example: If you choose --xcode-version 15.4 --os-version 17.5 then you wi
retry_args.retry_quota_test_preventive,
retry_args.retry_quota_test_reactive,
analytics_args.analytics_read_only,
false,
filtering_configuration,
&common.output,
Some(application),
Expand Down
12 changes: 12 additions & 0 deletions src/cli/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl Cli {
pull_files,
application_bundle,
library_bundle,
profiling_args,
} => {
android::run(
application,
Expand All @@ -69,6 +70,7 @@ impl Cli {
instrumentation_arg,
retry_args,
analytics_args,
profiling_args,
pull_files,
application_bundle,
library_bundle,
Expand Down Expand Up @@ -373,6 +375,13 @@ struct AnalyticsArgs {
analytics_read_only: Option<bool>,
}

#[derive(Debug, Args)]
#[command(args_conflicts_with_subcommands = true)]
struct ProfilingArgs {
#[arg(long, default_value_t = false, help = "Profile tests")]
profiling: bool,
}

#[derive(Debug, Args, Clone)]
#[command(args_conflicts_with_subcommands = true)]
struct ProgressArgs {
Expand Down Expand Up @@ -436,6 +445,9 @@ enum RunCommands {
#[command(flatten)]
analytics_args: AnalyticsArgs,

#[command(flatten)]
profiling_args: ProfilingArgs,

#[arg(long, help = "Instrumentation arguments, example: FOO=BAR")]
instrumentation_arg: Option<Vec<String>>,

Expand Down
2 changes: 2 additions & 0 deletions src/interactor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ impl TriggerTestRunInteractor {
retry_quota_test_preventive: Option<u32>,
retry_quota_test_reactive: Option<u32>,
analytics_read_only: Option<bool>,
profiling: bool,
filtering_configuration: Option<SparseMarathonfile>,
output: &Option<PathBuf>,
application: Option<PathBuf>,
Expand Down Expand Up @@ -164,6 +165,7 @@ impl TriggerTestRunInteractor {
retry_quota_test_preventive,
retry_quota_test_reactive,
analytics_read_only,
profiling,
filtering_configuration,
no_progress_bars,
flavor,
Expand Down

0 comments on commit 366b85d

Please sign in to comment.