diff mbox

[ndctl,2/2] ndctl, test: Update libndctl test for controller temperature valid

Message ID 152902243580.9861.7729384829710178825.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Williams June 15, 2018, 12:27 a.m. UTC
nfit_test is growing support for emitting the controller temperature.
Permit use of the flag, i.e. do not fail upon seeing 'CTEMP_VALID'.

Rather than add a kernel version gate, just be tolerant of any value of
the flag.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 test/libndctl.c |   20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
diff mbox

Patch

diff --git a/test/libndctl.c b/test/libndctl.c
index 8098c1c45051..edff0af33c7d 100644
--- a/test/libndctl.c
+++ b/test/libndctl.c
@@ -2177,8 +2177,8 @@  static int check_set_config_data(struct ndctl_bus *bus, struct ndctl_dimm *dimm,
 	return 0;
 }
 
-#define __check_smart(dimm, cmd, field) ({ \
-	if (ndctl_cmd_smart_get_##field(cmd) != smart_data.field) { \
+#define __check_smart(dimm, cmd, field, mask) ({ \
+	if ((ndctl_cmd_smart_get_##field(cmd) & mask) != smart_data.field) { \
 		fprintf(stderr, "%s dimm: %#x expected \'" #field \
 				"\' %#x got: %#x\n", __func__, \
 				ndctl_dimm_get_handle(dimm), \
@@ -2230,14 +2230,14 @@  static int check_smart(struct ndctl_bus *bus, struct ndctl_dimm *dimm,
 		return rc;
 	}
 
-	__check_smart(dimm, cmd, flags);
-	__check_smart(dimm, cmd, health);
-	__check_smart(dimm, cmd, temperature);
-	__check_smart(dimm, cmd, spares);
-	__check_smart(dimm, cmd, alarm_flags);
-	__check_smart(dimm, cmd, life_used);
-	__check_smart(dimm, cmd, shutdown_state);
-	__check_smart(dimm, cmd, vendor_size);
+	__check_smart(dimm, cmd, flags, ~ND_SMART_CTEMP_VALID);
+	__check_smart(dimm, cmd, health, -1);
+	__check_smart(dimm, cmd, temperature, -1);
+	__check_smart(dimm, cmd, spares, -1);
+	__check_smart(dimm, cmd, alarm_flags, -1);
+	__check_smart(dimm, cmd, life_used, -1);
+	__check_smart(dimm, cmd, shutdown_state, -1);
+	__check_smart(dimm, cmd, vendor_size, -1);
 
 	check->cmd = cmd;
 	return 0;