summaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests
diff options
context:
space:
mode:
authorSerge Semin <fancer.lancer@gmail.com>2017-12-06 17:32:03 +0300
committerJon Mason <jdmason@kudzu.us>2018-01-28 22:17:24 -0500
commite770112b2dfa38a9481309f0333d84e122c23e2d (patch)
treea6745a4c26f75bf81048c897c680d717f61d294e /tools/testing/selftests
parent06bd0407d06c4a8437401952caed4bc6bbba9e44 (diff)
downloadblackbird-obmc-linux-e770112b2dfa38a9481309f0333d84e122c23e2d.tar.gz
blackbird-obmc-linux-e770112b2dfa38a9481309f0333d84e122c23e2d.zip
NTB: ntb_test: Add ntb_tool Message tests
Messages NTB API is now available. ntb_tool driver has been altered to perform messages send and receive operation. The test of messages read/write to/from peer device has been added to the script. Signed-off-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
Diffstat (limited to 'tools/testing/selftests')
-rwxr-xr-xtools/testing/selftests/ntb/ntb_test.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/tools/testing/selftests/ntb/ntb_test.sh b/tools/testing/selftests/ntb/ntb_test.sh
index 06b9b156a6fc..849191fd2308 100755
--- a/tools/testing/selftests/ntb/ntb_test.sh
+++ b/tools/testing/selftests/ntb/ntb_test.sh
@@ -282,6 +282,40 @@ function scratchpad_test()
echo " Passed"
}
+function message_test()
+{
+ LOC=$1
+ REM=$2
+
+ echo "Running msg tests on: $(subdirname $LOC) / $(subdirname $REM)"
+
+ CNT=$(get_files_count "msg" "$LOC")
+
+ if [[ $CNT -eq 0 ]]; then
+ echo " Unsupported"
+ return
+ fi
+
+ MSG_OUTBITS_MASK=$(read_file "$LOC/../msg_inbits")
+ MSG_INBITS_MASK=$(read_file "$REM/../msg_inbits")
+
+ write_file "c $MSG_OUTBITS_MASK" "$LOC/../msg_sts"
+ write_file "c $MSG_INBITS_MASK" "$REM/../msg_sts"
+
+ for ((i = 0; i < $CNT; i++)); do
+ VAL=$RANDOM
+ write_file "$VAL" "$LOC/msg$i"
+ RVAL=$(read_file "$REM/../msg$i")
+
+ if [[ "$VAL" -ne "${RVAL%%<-*}" ]]; then
+ echo "Message $i value $RVAL doesn't match $VAL" >&2
+ exit -1
+ fi
+ done
+
+ echo " Passed"
+}
+
function write_mw()
{
split_remote $2
@@ -414,6 +448,9 @@ function ntb_tool_tests()
scratchpad_test "$LOCAL_PEER_TOOL" "$REMOTE_PEER_TOOL"
scratchpad_test "$REMOTE_PEER_TOOL" "$LOCAL_PEER_TOOL"
+ message_test "$LOCAL_PEER_TOOL" "$REMOTE_PEER_TOOL"
+ message_test "$REMOTE_PEER_TOOL" "$LOCAL_PEER_TOOL"
+
for PEER_TRANS in $(ls "$LOCAL_TOOL"/peer_trans*); do
PT=$(basename $PEER_TRANS)
write_file $MW_SIZE "$LOCAL_TOOL/$PT"
OpenPOWER on IntegriCloud