tests: amdgpu: missing file and reserved throttle bits
@@ -13,9 +13,10 @@ extern "C" {
static void test_amdgpu_verify_metrics(void **state) {
UNUSED(state);
- assert_false(amdgpu_verify_metrics(""));
- assert_false(amdgpu_verify_metrics("gpu_metrics_invalid"));
- assert_true (amdgpu_verify_metrics("gpu_metrics"));
+ assert_false(amdgpu_verify_metrics("./missing_file"));
+ // unsupported struct size, format and content revision
+ assert_false(amdgpu_verify_metrics("./gpu_metrics_invalid"));
+ assert_true (amdgpu_verify_metrics("./gpu_metrics"));
}
static void test_amdgpu_get_instant_metrics(void **state){
@@ -23,11 +24,11 @@ static void test_amdgpu_get_instant_metrics(void **state){
struct amdgpu_common_metrics metrics;
// fail fetch gpu_metrics file
- metrics_path = "";
+ metrics_path = "./missing_file";
amdgpu_get_instant_metrics(&metrics);
// DGPU
- metrics_path = "gpu_metrics";
+ metrics_path = "./gpu_metrics";
metrics = {};
amdgpu_get_instant_metrics(&metrics);
assert_int_equal(metrics.gpu_load_percent, 64);
@@ -40,7 +41,16 @@ static void test_amdgpu_get_instant_metrics(void **state){
assert_false(metrics.is_temp_throttled);
assert_false(metrics.is_other_throttled);
- metrics_path = "gpu_metrics_apu";
+ // DGPU
+ metrics_path = "./gpu_metrics_reserved_throttle_bits";
+ metrics = {};
+ amdgpu_get_instant_metrics(&metrics);
+ assert_false(metrics.is_power_throttled);
+ assert_false(metrics.is_current_throttled);
+ assert_false(metrics.is_temp_throttled);
+ assert_false(metrics.is_other_throttled);
+
+ metrics_path = "./gpu_metrics_apu";
metrics = {};
amdgpu_get_instant_metrics(&metrics);
assert_int_equal(metrics.gpu_load_percent, 100);
@@ -54,6 +64,7 @@ static void test_amdgpu_get_instant_metrics(void **state){
assert_false(metrics.is_current_throttled);
assert_false(metrics.is_temp_throttled);
assert_false(metrics.is_other_throttled);
+ // amdgpu binary with everything throttled
}
static void test_amdgpu_get_samples_and_copy(void **state){
