Using trace-cmd to validate the expectations of the huge page faults
generated by the dax-pmd.c test.

Signed-off-by: Dan Williams <[email protected]>
---
 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
+       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
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to