test/cxl-topology.sh: verify dax device creation for auto region
Alison Schofield
maintainerPATCH 1/1 test/cxl-topology.sh: verify dax device creation for auto region
The auto-discovered CXL region should create a dax device with matching size and resource mapping. A recent regression in the no-soft-reserved case broke this behavior without test coverage.
Expand the existing auto-region check to validate the dax device.
--- test/cxl-topology.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
test/cxl-topology.sh +17 -5
@@ -22,12 +22,24 @@ rc=1 # paired update must be made to this test. # validate the autodiscovered region -region=$("$CXL" list -R | jq -r ".[] | .region") -if [[ ! $region ]]; then - echo "failed to find autodiscovered region" - err "$LINENO" -fi +region_json=$("$CXL" list -R -u) +[ -n "$region_json" ] || err "$LINENO" +region=$(jq -r '.region // empty' <<<"$region_json") +region_size=$(jq -r '.size // empty' <<<"$region_json") +region_resource=$(jq -r '.resource // empty' <<<"$region_json") +[ -n "$region" ] || err "$LINENO" +[ -n "$region_size" ] || err "$LINENO" +[ -n "$region_resource" ] || err "$LINENO" +# validate the dax device created for the autodiscovered region +dax_json=$("$DAXCTL" list -r "$region" -DMu) +[ -n "$dax_json" ] || err "$LINENO" +dax_dev=$(jq -r '.chardev // empty' <<<"$dax_json") +dax_size=$(jq -r '.size // empty' <<<"$dax_json") +dax_start=$(jq -r '.mappings[0].start // empty' <<<"$dax_json") +[ -n "$dax_dev" ] || err "$LINENO" +[ "$dax_size" = "$region_size" ] || err "$LINENO" +[ "$dax_start" = "$region_resource" ] || err "$LINENO" # collect cxl_test root device id json=$($CXL list -b cxl_test)
base-commit: 99da468880dba2ec61ba2d9fdf8d48fc3bae085e
Signature · 1 line
2.37.3
Quoted 7 lines · Alison Schofield
The auto-discovered CXL region should create a dax device with matching size and resource mapping. A recent regression in the no-soft-reserved case broke this behavior without test coverage.
Expand the existing auto-region check to validate the dax device.
Signed-off-by Alison Schofield <[email protected]>
I'm terrible with Bash and jq. AFAICT LGTM.
Quoted 40 lines
--- test/cxl-topology.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)test/cxl-topology.sh +17
-5@@ -22,12 +22,24 @@ rc=1 # paired update must be made to this test. # validate the autodiscovered region -region=$("$CXL" list -R | jq -r ".[] | .region") -if [[ ! $region ]]; then - echo "failed to find autodiscovered region" - err "$LINENO" -fi +region_json=$("$CXL" list -R -u) +[ -n "$region_json" ] || err "$LINENO" +region=$(jq -r '.region // empty' <<<"$region_json") +region_size=$(jq -r '.size // empty' <<<"$region_json") +region_resource=$(jq -r '.resource // empty' <<<"$region_json") +[ -n "$region" ] || err "$LINENO" +[ -n "$region_size" ] || err "$LINENO" +[ -n "$region_resource" ] || err "$LINENO" +# validate the dax device created for the autodiscovered region +dax_json=$("$DAXCTL" list -r "$region" -DMu) +[ -n "$dax_json" ] || err "$LINENO" +dax_dev=$(jq -r '.chardev // empty' <<<"$dax_json") +dax_size=$(jq -r '.size // empty' <<<"$dax_json") +dax_start=$(jq -r '.mappings[0].start // empty' <<<"$dax_json") +[ -n "$dax_dev" ] || err "$LINENO" +[ "$dax_size" = "$region_size" ] || err "$LINENO" +[ "$dax_start" = "$region_resource" ] || err "$LINENO" # collect cxl_test root device id json=$($CXL list -b cxl_test)base-commit:
99da468880dba2ec61ba2d9fdf8d48fc3bae085e
Quoted 7 lines · Dave Jiang
Quoted 4 lines · Alison Schofield
The auto-discovered CXL region should create a dax device with matching size and resource mapping. A recent regression in the no-soft-reserved case broke this behavior without test coverage.
Quoted 7 lines
Quoted 3 lines
Expand the existing auto-region check to validate the dax device.
Signed-off-by Alison Schofield <[email protected]>I'm terrible with Bash and jq. AFAICT LGTM.
Reviewed-by Dave Jiang <[email protected]>
Thanks! Applied to pending:
https://github.com/pmem/ndctl/commit/38068a574696