-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit adds a `CpuTctl` variant to the `MeasurementKind` enum. This is intended to be used to represent AMD CPU T<sub>ctl</sub> thermal values, which are a unitless value from 0-100 representing a kind of "abstract thermal throttling danger level" --- see oxidecomputer/hubris#1881 for details on why we need to differentiate this from other temperature measurements.
- Loading branch information
Showing
4 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,4 +67,5 @@ pub enum MeasurementKind { | |
InputCurrent, | ||
InputVoltage, | ||
Speed, | ||
CpuTctl, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ mod v12; | |
mod v13; | ||
mod v14; | ||
mod v15; | ||
mod v16; | ||
|
||
pub fn assert_serialized( | ||
out: &mut [u8], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this | ||
// file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
//! This source file is named after the protocol version being tested, | ||
//! e.g. v01.rs implements tests for protocol version 1. | ||
//! The tested protocol version is represented by "$VERSION" below. | ||
//! | ||
//! The tests in this module check that the serialized form of messages from MGS | ||
//! protocol version $VERSION have not changed. | ||
//! | ||
//! If a test in this module fails, _do not change the test_! This means you | ||
//! have changed, deleted, or reordered an existing message type or enum | ||
//! variant, and you should revert that change. This will remain true until we | ||
//! bump the `version::MIN` to a value higher than $VERSION, at which point these | ||
//! tests can be removed as we will stop supporting $VERSION. | ||
|
||
use super::assert_serialized; | ||
use gateway_messages::measurement::MeasurementKind; | ||
use gateway_messages::SerializedSize; | ||
use gateway_messages::SpResponse; | ||
|
||
#[test] | ||
fn measurement_kinds() { | ||
let mut out = [0; SpResponse::MAX_SIZE]; | ||
|
||
for (kind, serialized) in [ | ||
(MeasurementKind::Temperature, &[0]), | ||
(MeasurementKind::Power, &[1]), | ||
(MeasurementKind::Current, &[2]), | ||
(MeasurementKind::Voltage, &[3]), | ||
(MeasurementKind::InputCurrent, &[4]), | ||
(MeasurementKind::InputVoltage, &[5]), | ||
(MeasurementKind::Speed, &[6]), | ||
(MeasurementKind::CpuTctl, &[7]), | ||
] { | ||
assert_serialized(&mut out, serialized, &kind); | ||
} | ||
} |