diff --git a/database/src/lib.rs b/database/src/lib.rs index 711ca24fd..9c0d74030 100644 --- a/database/src/lib.rs +++ b/database/src/lib.rs @@ -406,6 +406,10 @@ impl CodegenBackend { CodegenBackend::Cranelift => "cranelift", } } + + pub fn all_values() -> &'static [Self] { + &[Self::Llvm, Self::Cranelift] + } } impl FromStr for CodegenBackend { @@ -1009,12 +1013,7 @@ impl BenchmarkRequest { return Ok(vec![CodegenBackend::Llvm]); } - self.backends - .split(',') - .map(|s| { - CodegenBackend::from_str(s).map_err(|_| anyhow::anyhow!("Invalid backend: {s}")) - }) - .collect() + parse_backends(&self.backends).map_err(|e| anyhow::anyhow!("{e}")) } /// Get the profiles for the request @@ -1040,6 +1039,13 @@ impl BenchmarkRequest { } } +pub fn parse_backends(backends: &str) -> Result, String> { + backends + .split(',') + .map(|s| CodegenBackend::from_str(s).map_err(|_| format!("Invalid backend: {s}"))) + .collect() +} + /// Cached information about benchmark requests in the DB pub struct BenchmarkRequestIndex { /// Tags (SHA or release name) of all known benchmark requests diff --git a/site/frontend/templates/pages/help.html b/site/frontend/templates/pages/help.html index 06b184c9c..2256c450c 100644 --- a/site/frontend/templates/pages/help.html +++ b/site/frontend/templates/pages/help.html @@ -1,18 +1,18 @@ {% extends "layout.html" %} {% block head %} {% endblock %} @@ -20,29 +20,42 @@

@rust-timer commands

@rust-timer supports several commands, the most common (and simple) being - @rust-timer queue. This command is usually invoked as @bors try @rust-timer queue, - which starts a bors "try" run (not a merge). @rust-timer will wait for the try run to finish, + @rust-timer queue. This command is usually invoked as @bors try @rust-timer + queue, + which starts a bors "try" run (not a merge). @rust-timer will wait for the try run + to finish, and if it succeeds will then queue a perf run.

@rust-timer queue has a few extra options that can be useful:

-

@rust-timer build $commit will queue a perf run for the given commit $commit. +

@rust-timer build $commit will queue a perf run for the given commit + $commit. It is usually invoked with the commit from a successful "try" run. (The queue command can be seen as a shortcut that automatically selects the "try" run's commit for the build command) - This command also supports the same include, exclude, and runs options - as @rust-timer queue. + This command also supports the same options as @rust-timer queue.

{% endblock %} diff --git a/site/src/request_handlers/github.rs b/site/src/request_handlers/github.rs index 85ed7ae21..905e90b77 100644 --- a/site/src/request_handlers/github.rs +++ b/site/src/request_handlers/github.rs @@ -6,7 +6,7 @@ use crate::github::{ use crate::job_queue::should_use_job_queue; use crate::load::SiteCtxt; -use database::BenchmarkRequest; +use database::{parse_backends, BenchmarkRequest, CodegenBackend}; use hashbrown::HashMap; use std::sync::Arc; @@ -265,6 +265,19 @@ fn parse_benchmark_parameters<'a>( }; params.runs = Some(runs as i32); } + if let Some(backends) = ¶ms.backends { + // Make sure that the backends are correct + parse_backends(backends).map_err(|e| { + format!( + "Cannot parse backends: {e}. Valid values are: {}", + CodegenBackend::all_values() + .iter() + .map(|b| b.as_str()) + .collect::>() + .join(", ") + ) + })?; + } if !args.is_empty() { Err(format!(