Vishal Verma wrote: > The daxctl-create.sh test had some hard-coded assumptions about what dax > device it expects to find, and what region number it will be under. This > usually worked when the unit test environment only had efi_fake_mem > devices as the sources of hmem memory. With CXL however, the region > numbering namespace is shared with CXL regions, often pushing the > efi_fake_mem region to something other than 'region0'. > > Remove any region and device number assumptions from this test so it > works regardless of how regions get enumerated. > > Cc: Joao Martins <[email protected]> > Cc: Dan Williams <[email protected]> > Signed-off-by: Vishal Verma <[email protected]> > --- > Changes in v2: > - Fix hmem region selection in case the first dax region is not an hmem > one (Dan) > - Link to v1: > https://lore.kernel.org/r/[email protected] > --- > test/daxctl-create.sh | 58 > ++++++++++++++++++++++++++------------------------- > 1 file changed, 30 insertions(+), 28 deletions(-) > > diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh > index d319a39..c093cb9 100755 > --- a/test/daxctl-create.sh > +++ b/test/daxctl-create.sh > @@ -29,14 +29,14 @@ find_testdev() > fi > > # find a victim region provided by dax_hmem > - testpath=$("$DAXCTL" list -r 0 | jq -er '.[0].path | .//""') > - if [[ ! "$testpath" == *"hmem"* ]]; then > + region_id="$("$DAXCTL" list -R | jq -r '.[] | select(.path | > contains("hmem")) | .id')" > + if [[ ! "$region_id" ]]; then
/me learned a new bash'ism for testing empty variables, I like that better than [ -z $region_id ] Reviewed-by: Dan Williams <[email protected]>
