Skip to content

Commit bad3d84

Browse files
committed
default_testbed
1 parent 51a4918 commit bad3d84

File tree

24 files changed

+116
-64
lines changed

24 files changed

+116
-64
lines changed

lib/bencher_context/src/client/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,9 @@ fn git_context(context: &mut RunContext) {
5757
}
5858

5959
fn platform_context(context: &mut RunContext) {
60-
context.insert(
61-
ContextPath::TESTBED_OS,
62-
OperatingSystem::current().to_string(),
63-
);
60+
if let Some(os) = OperatingSystem::current() {
61+
context.insert(ContextPath::TESTBED_OS, os.to_string());
62+
}
6463

6564
if let Some(fingerprint) = Fingerprint::current() {
6665
context.insert(ContextPath::TESTBED_FINGERPRINT, fingerprint.to_string());

lib/bencher_context/src/client/platform/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,15 @@ impl fmt::Display for OperatingSystem {
3434
)
3535
}
3636
}
37+
38+
#[cfg(all(
39+
not(target_os = "linux"),
40+
not(target_os = "macos"),
41+
not(target_os = "windows")
42+
))]
43+
impl OperatingSystem {
44+
#[allow(clippy::unnecessary_wraps)]
45+
pub fn current() -> Option<Self> {
46+
None
47+
}
48+
}

lib/bencher_context/src/client/platform/target_os/linux.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ fn parse_machine_id(path: &str) -> Option<Uuid> {
2222
}
2323

2424
impl OperatingSystem {
25-
pub fn current() -> Self {
26-
Self::Linux
25+
#[allow(clippy::unnecessary_wraps)]
26+
pub fn current() -> Option<Self> {
27+
Some(Self::Linux)
2728
}
2829
}

lib/bencher_context/src/client/platform/target_os/macos.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ impl crate::Fingerprint {
2828
}
2929

3030
impl OperatingSystem {
31-
pub fn current() -> Self {
32-
Self::MacOS
31+
#[allow(clippy::unnecessary_wraps)]
32+
pub fn current() -> Option<Self> {
33+
Some(Self::MacOS)
3334
}
3435
}

lib/bencher_context/src/client/platform/target_os/windows.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ fn digital_product_id() -> Option<Uuid> {
6060
}
6161

6262
impl OperatingSystem {
63-
pub fn current() -> Self {
64-
Self::Windows
63+
#[allow(clippy::unnecessary_wraps)]
64+
pub fn current() -> Option<Self> {
65+
Some(Self::Windows)
6566
}
6667
}

services/console/src/chunks/docs-explanation/bencher-run/de/testbed.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<br />
44

5-
Optional: Entweder die Option `--testbed` oder die Umgebungsvariable `BENCHER_TESTBED`
6-
kann auf den Slug oder UUID einer bereits existierenden Testplattform gesetzt werden.
7-
Wenn beide definiert sind, hat die Option `--testbed` Vorrang vor der Umgebungsvariable `BENCHER_TESTBED`.
8-
Wenn keine definiert sind, dann wird `localhost` als Standard-Testplattform verwendet.
5+
Optional: Entweder die Option `--testbed` oder die Umgebungsvariable `BENCHER_TESTBED` kann auf den Namen, den Slug oder die UUID für ein [Testbed][testbed] gesetzt werden. Wenn der angegebene Wert ein Name oder Slug ist und das Testbed noch nicht existiert, wird es für Sie erstellt. Wenn der angegebene Wert jedoch eine UUID ist, muss das Testbed bereits existieren. Wenn beide angegeben sind, hat die `--testbed` Option Vorrang vor der Umgebungsvariable `BENCHER_TESTBED`. Wenn keiner angegeben ist, wird `Linux`, `macOS` oder `Windows` verwendet, abhängig vom Host-Betriebssystem. Wenn das `bencher` CLI für ein anderes Betriebssystem kompiliert wurde, wird `localhost` als Standard-Testbed verwendet.
6+
7+
[testbed]: /de/docs/explanation/benchmarking/#testbed

services/console/src/chunks/docs-explanation/bencher-run/en/testbed.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ may be set to the name, slug, or UUID for a [Testbed][testbed].
77
If the value specified is a name or slug and the Testbed does not already exist, it will be created for you.
88
However, if the value specified is a UUID then the Testbed must already exist.
99
If both are specified, the `--testbed` option takes precedence over the `BENCHER_TESTBED` environment variable.
10-
If neither are specified then `localhost` is used as the default testbed.
10+
If neither are specified then `Linux`, `macOS`, or `Windows` is used,
11+
based on the host operating system.
12+
If the `bencher` CLI has been compiled for a different operating system,
13+
then `localhost` is used as the default Testbed.
1114

1215
[testbed]: /docs/explanation/benchmarking/#testbed

services/console/src/chunks/docs-explanation/bencher-run/es/testbed.mdx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22

33
<br />
44

5-
Opcional: La opción `--testbed` o la variable de entorno `BENCHER_TESTBED`
6-
pueden estar configuradas con el slug o UUID de un banco de pruebas ya existente.
7-
Si ambas están definidas, la opción `--testbed` tiene prioridad sobre la variable de entorno `BENCHER_TESTBED`.
8-
Si ninguna está definida, entonces `localhost` se usa como banco de pruebas predeterminado.
5+
Opcional: Se puede establecer la opción `--testbed` o la variable de entorno `BENCHER_TESTBED` al nombre, slug o UUID de un [Testbed][testbed].
6+
Si el valor especificado es un nombre o slug y el Testbed no existe ya, se creará para usted.
7+
Sin embargo, si el valor especificado es un UUID, entonces el Testbed debe existir ya.
8+
Si ambos son especificados, la opción `--testbed` tiene prioridad sobre la variable de entorno `BENCHER_TESTBED`.
9+
Si ninguno es especificado, entonces se usa `Linux`, `macOS` o `Windows`,
10+
basado en el sistema operativo del host.
11+
Si el CLI de `bencher` ha sido compilado para un sistema operativo diferente,
12+
entonces se usa `localhost` como el Testbed predeterminado.
13+
14+
[testbed]: /es/docs/explanation/benchmarking/#testbed

services/console/src/chunks/docs-explanation/bencher-run/fr/testbed.mdx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22

33
<br />
44

5-
Optionnel : Soit l'option `--testbed` soit la variable d'environnement `BENCHER_TESTBED`
6-
peut être définie sur le slug ou UUID d'un banc d'essai déjà existant.
7-
Si les deux sont définis, l'option `--testbed` a la priorité sur la variable d'environnement `BENCHER_TESTBED`.
8-
Si aucun n'est défini, alors `localhost` est utilisé comme banc d'essai par défaut.
5+
Optionnel : Soit l'option `--testbed`, soit la variable d'environnement `BENCHER_TESTBED`
6+
peut être définie sur le nom, le slug ou l'UUID d'un [Testbed][testbed].
7+
Si la valeur spécifiée est un nom ou un slug et que le Testbed n'existe pas déjà, il sera créé pour vous.
8+
Cependant, si la valeur spécifiée est un UUID, alors le Testbed doit déjà exister.
9+
Si les deux sont spécifiés, l'option `--testbed` prévaut sur la variable d'environnement `BENCHER_TESTBED`.
10+
Si aucun n'est spécifié, alors `Linux`, `macOS`, ou `Windows` est utilisé,
11+
en fonction du système d'exploitation hôte.
12+
Si le CLI `bencher` a été compilé pour un système d'exploitation différent,
13+
alors `localhost` est utilisé comme Testbed par défaut.
14+
15+
[testbed]: /fr/docs/explanation/benchmarking/#testbed

services/console/src/chunks/docs-explanation/bencher-run/ja/testbed.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
<br />
44

5-
オプション:`--testbed`オプションまたは`BENCHER_TESTBED`環境変数のいずれかを既存のテストベッドのスラグまたはUUIDに設定することができます。
6-
両方が定義されている場合、`--testbed`オプションは`BENCHER_TESTBED`環境変数に優先します。
7-
どちらも定義されていない場合、デフォルトのテストベッドとして`localhost`が使用されます。
5+
オプション: `--testbed` オプションまたは `BENCHER_TESTBED` 環境変数のいずれかを、[テストベッド][testbed]の名前、スラグ、またはUUIDに設定できます。
6+
指定された値が名前またはスラグであり、テストベッドがまだ存在しない場合は、自動的に作成されます。
7+
ただし、指定された値がUUIDの場合は、テストベッドが既に存在している必要があります。
8+
両方が指定されている場合は、`--testbed` オプションが `BENCHER_TESTBED` 環境変数より優先されます。
9+
どちらも指定されていない場合は、ホストのオペレーティングシステムに基づいて `Linux``macOS`、または `Windows` が使用されます。
10+
`bencher` CLIが異なるオペレーティングシステム用にコンパイルされている場合、デフォルトのテストベッドとして `localhost` が使用されます。
11+
12+
[testbed]: /ja/docs/explanation/benchmarking/#testbed

0 commit comments

Comments
 (0)