@@ -4,7 +4,6 @@
rc=77
. $(dirname $0)/common
-bus="$NFIT_TEST_BUS0"
inj_val="42"
trap 'err $LINENO' ERR
@@ -152,14 +151,18 @@ do_tests()
$NDCTL inject-smart -b $bus --uninject-all $dimm
# start tests
- for field in "${fields_val[@]}"; do
- test_field $field $inj_val
- done
-
for field in "${fields_bool[@]}"; do
test_field $field
done
+ if [ $NDCTL_TEST_FAMILY == "PAPR" ]; then
+ return
+ fi
+
+ for field in "${fields_val[@]}"; do
+ test_field $field $inj_val
+ done
+
for field in "${fields_thresh[@]}"; do
test_field $field $inj_val "thresh"
done
@@ -168,6 +171,7 @@ do_tests()
check_min_kver "4.19" || do_skip "kernel $KVER may not support smart (un)injection"
check_prereq "jq"
_init
+bus="$NFIT_TEST_BUS0"
rc=1
jlist=$($TEST_PATH/list-smart-dimm -b $bus)
@@ -7,6 +7,7 @@
#include <ndctl/libndctl.h>
#include <util/parse-options.h>
+#include <test.h>
#include <ndctl/filter.h>
#include <ndctl/ndctl.h>
#include <ndctl/json.h>
@@ -28,6 +29,32 @@ static bool filter_region(struct ndctl_region *region,
return true;
}
+static void filter_ndtest_dimm(struct ndctl_dimm *dimm,
+ struct ndctl_filter_ctx *ctx)
+{
+ struct list_filter_arg *lfa = ctx->list;
+ struct json_object *jdimm;
+
+ if (!ndctl_dimm_is_cmd_supported(dimm, ND_CMD_SMART))
+ return;
+
+ if (!lfa->jdimms) {
+ lfa->jdimms = json_object_new_array();
+ if (!lfa->jdimms) {
+ fail("\n");
+ return;
+ }
+ }
+
+ jdimm = util_dimm_to_json(dimm, lfa->flags);
+ if (!jdimm) {
+ fail("\n");
+ return;
+ }
+
+ json_object_array_add(lfa->jdimms, jdimm);
+}
+
static void filter_dimm(struct ndctl_dimm *dimm, struct ndctl_filter_ctx *ctx)
{
struct list_filter_arg *lfa = ctx->list;
@@ -92,6 +119,7 @@ int main(int argc, const char *argv[])
struct ndctl_filter_ctx fctx = { 0 };
struct list_filter_arg lfa = { 0 };
+ init_env();
rc = ndctl_new(&ctx);
if (rc < 0)
return EXIT_FAILURE;
@@ -102,7 +130,10 @@ int main(int argc, const char *argv[])
usage_with_options(u, options);
fctx.filter_bus = filter_bus;
- fctx.filter_dimm = filter_dimm;
+ if (ndctl_test_family == NVDIMM_FAMILY_PAPR)
+ fctx.filter_dimm = filter_ndtest_dimm;
+ else
+ fctx.filter_dimm = filter_dimm;
fctx.filter_region = filter_region;
fctx.filter_namespace = NULL;
fctx.list = &lfa;
@@ -76,7 +76,7 @@ daxdev_errors = executable('daxdev-errors', [
include_directories : root_inc,
)
-list_smart_dimm = executable('list-smart-dimm', [
+list_smart_dimm = executable('list-smart-dimm', testcore + [
'list-smart-dimm.c',
'../ndctl/filter.c',
'../util/json.c',
@@ -25,8 +25,7 @@
"align.sh", // ""
"dm.sh", // ""
"mmap.sh", // ""
- "monitor.sh", // To be fixed
- "inject-smart.sh" // ""
+ "monitor.sh" // To be fixed
]
// NOTE: The libjson-c doesn't like comments in json files, so keep the file