Message ID | 157150319417.3940762.12887432367621574807.stgit@dwillia2-desk3.amr.corp.intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | test/dax.sh: Add huge page fault validation | expand |
On Sat, 2019-10-19 at 09:39 -0700, Dan Williams wrote: > Using trace-cmd to validate the expectations of the huge page faults > generated by the dax-pmd.c test. > > Signed-off-by: Dan Williams <dan.j.williams@intel.com> > --- > test/dax.sh | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/test/dax.sh b/test/dax.sh > index 59d5eafadae8..e5945fc3e335 100755 > --- a/test/dax.sh > +++ b/test/dax.sh > @@ -30,12 +30,32 @@ cleanup() { > > run_test() { > rc=0 > - if ! ./dax-pmd $MNT/$FILE; then > + if ! trace-cmd record -e fs_dax:dax_pmd_fault_done ./dax-pmd $MNT/$FILE; then > rc=$? > if [ $rc -ne 77 -a $rc -ne 0 ]; then > cleanup $1 > fi > fi > + > + # Fragile hack to double check the kernel services this test > + # with successful pmd faults. If dax-pmd.c ever changes the > + # number of times the dax_pmd_fault_done trace point fires the > + # hack needs to be updated from 10 expected firings and the > + # result of success (NOPAGE). > + count=0 > + rc=1 > + for p in $(trace-cmd report | awk '{ print $21 }') > + do > + if [ $count -lt 10 ]; then > + if [ $p != "0x100" -a $p != "NOPAGE" ]; then > + cleanup $1 > + fi > + fi > + count=$((count + 1)) > + done We shouldn't read lines with 'for' - if the command in $() happens to spit out any glob metacharacters, we can get unexpected iterations. It should instead be: while read -r p; do ... done < <(trace-cmd report | awk '{ print $21 }') > + if [ $count -lt 10 ]; then within [ ], any $variables should be quoted. Generally true for just about all variables. If [[ ]] is used (bash-specific), then the quoting may be omitted, but since it is a math comparison, the easiest might be: if ((count < 10)); then ... fi > + cleanup $1 > + fi > } > > set -e > @@ -91,4 +111,4 @@ json=$($NDCTL create-namespace -m raw -f -e $dev) > eval $(json2var <<< "$json") > [ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 same comment about quoting "$mode". If 'mode' happens to be empty for soem reason, we want to fail with the error message - instead the above will fail with a syntax error. > > -exit $rc > +exit 0 > _______________________________________________ > Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org > To unsubscribe send an email to linux-nvdimm-leave@lists.01.org
On Wed, 2019-10-23 at 19:33 +0000, Verma, Vishal L wrote: > > > @@ -91,4 +111,4 @@ json=$($NDCTL create-namespace -m raw -f -e $dev) > > eval $(json2var <<< "$json") > > [ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 > > same comment about quoting "$mode". If 'mode' happens to be empty for > soem reason, we want to fail with the error message - instead the above > will fail with a syntax error. Sorry ignore this - that was a context line..
> On Wed, 2019-10-23 at 19:33 +0000, Verma, Vishal L wrote: > > > @@ -91,4 +111,4 @@ json=$($NDCTL create-namespace -m raw -f -e $dev) > > > eval $(json2var <<< "$json") > > > [ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 > > > > same comment about quoting "$mode". If 'mode' happens to be empty for > > soem reason, we want to fail with the error message - instead the above > > will fail with a syntax error. > > Sorry ignore this - that was a context line.. > Hey Dan, I've applied patches 1-3, with the following fixup to patch 3. Patch 4 didn't apply cleanly, if you can resend that I'll queue it up too. --8<-- From 9d6c43d5240ddb18b5540b3064f2f90c25dcf574 Mon Sep 17 00:00:00 2001 From: Vishal Verma <vishal.l.verma@intel.com> Date: Fri, 25 Oct 2019 16:41:22 -0600 Subject: [ndctl PATCH] fixup! test/dax.sh: Validate huge page mappings --- test/dax.sh | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/dax.sh b/test/dax.sh index 157b398..45c2027 100755 --- a/test/dax.sh +++ b/test/dax.sh @@ -32,8 +32,8 @@ run_test() { rc=0 if ! trace-cmd record -e fs_dax:dax_pmd_fault_done ./dax-pmd $MNT/$FILE; then rc=$? - if [ $rc -ne 77 -a $rc -ne 0 ]; then - cleanup $1 + if [ "$rc" -ne 77 ] && [ "$rc" -ne 0 ]; then + cleanup "$1" fi fi @@ -44,17 +44,18 @@ run_test() { # result of success (NOPAGE). count=0 rc=1 - for p in $(trace-cmd report | awk '{ print $21 }') - do - if [ $count -lt 10 ]; then - if [ $p != "0x100" -a $p != "NOPAGE" ]; then - cleanup $1 + while read -r p; do + [[ $p ]] || continue + if [ "$count" -lt 10 ]; then + if [ "$p" != "0x100" ] && [ "$p" != "NOPAGE" ]; then + cleanup "$1" fi fi count=$((count + 1)) - done + done < <(trace-cmd report | awk '{ print $21 }') + if [ $count -lt 10 ]; then - cleanup $1 + cleanup "$1" fi }
On Fri, Oct 25, 2019 at 3:44 PM Verma, Vishal L <vishal.l.verma@intel.com> wrote: > > > On Wed, 2019-10-23 at 19:33 +0000, Verma, Vishal L wrote: > > > > @@ -91,4 +111,4 @@ json=$($NDCTL create-namespace -m raw -f -e $dev) > > > > eval $(json2var <<< "$json") > > > > [ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 > > > > > > same comment about quoting "$mode". If 'mode' happens to be empty for > > > soem reason, we want to fail with the error message - instead the above > > > will fail with a syntax error. > > > > Sorry ignore this - that was a context line.. > > > > Hey Dan, > > I've applied patches 1-3, with the following fixup to patch 3. > Patch 4 didn't apply cleanly, if you can resend that I'll queue it up too. Will do, thanks for the fixups!
diff --git a/test/dax.sh b/test/dax.sh index 59d5eafadae8..e5945fc3e335 100755 --- a/test/dax.sh +++ b/test/dax.sh @@ -30,12 +30,32 @@ cleanup() { run_test() { rc=0 - if ! ./dax-pmd $MNT/$FILE; then + if ! trace-cmd record -e fs_dax:dax_pmd_fault_done ./dax-pmd $MNT/$FILE; then rc=$? if [ $rc -ne 77 -a $rc -ne 0 ]; then cleanup $1 fi fi + + # Fragile hack to double check the kernel services this test + # with successful pmd faults. If dax-pmd.c ever changes the + # number of times the dax_pmd_fault_done trace point fires the + # hack needs to be updated from 10 expected firings and the + # result of success (NOPAGE). + count=0 + rc=1 + for p in $(trace-cmd report | awk '{ print $21 }') + do + if [ $count -lt 10 ]; then + if [ $p != "0x100" -a $p != "NOPAGE" ]; then + cleanup $1 + fi + fi + count=$((count + 1)) + done + if [ $count -lt 10 ]; then + cleanup $1 + fi } set -e @@ -91,4 +111,4 @@ json=$($NDCTL create-namespace -m raw -f -e $dev) eval $(json2var <<< "$json") [ $mode != "fsdax" ] && echo "fail: $LINENO" && exit 1 -exit $rc +exit 0
Using trace-cmd to validate the expectations of the huge page faults generated by the dax-pmd.c test. Signed-off-by: Dan Williams <dan.j.williams@intel.com> --- test/dax.sh | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)