aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Semin <fancer.lancer@gmail.com>2017-12-06 09:32:02 -0500
committerJon Mason <jdmason@kudzu.us>2018-01-28 22:17:24 -0500
commit06bd0407d06c4a8437401952caed4bc6bbba9e44 (patch)
tree3f727b324af3262ad6054fd07abd57da70274f42
parent4e1ef427f273504fd99556f6f60a1218563ab772 (diff)
NTB: ntb_test: Update ntb_tool Scratchpad tests
Scratchpad NTB API has changed so has the ntb_tool driver. Outbound Scratchpad DebugFS files have been moved to peer specific directories. Each scratchpad is now available via separate file. The test code has been accordingly altered. Signed-off-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
-rwxr-xr-xtools/testing/selftests/ntb/ntb_test.sh43
1 files changed, 26 insertions, 17 deletions
diff --git a/tools/testing/selftests/ntb/ntb_test.sh b/tools/testing/selftests/ntb/ntb_test.sh
index ec2e51183f8d..06b9b156a6fc 100755
--- a/tools/testing/selftests/ntb/ntb_test.sh
+++ b/tools/testing/selftests/ntb/ntb_test.sh
@@ -239,35 +239,44 @@ function doorbell_test()
239 echo " Passed" 239 echo " Passed"
240} 240}
241 241
242function read_spad() 242function get_files_count()
243{ 243{
244 VPATH=$1 244 NAME=$1
245 IDX=$2 245 LOC=$2
246
247 split_remote $LOC
246 248
247 ROW=($(read_file "$VPATH" | grep -e "^$IDX")) 249 if [[ "$REMOTE" == "" ]]; then
248 let VAL=${ROW[1]} || true 250 echo $(ls -1 "$LOC"/${NAME}* 2>/dev/null | wc -l)
249 echo $VAL 251 else
252 echo $(ssh "$REMOTE" "ls -1 \"$VPATH\"/${NAME}* | \
253 wc -l" 2> /dev/null)
254 fi
250} 255}
251 256
252function scratchpad_test() 257function scratchpad_test()
253{ 258{
254 LOC=$1 259 LOC=$1
255 REM=$2 260 REM=$2
256 CNT=$(read_file "$LOC/spad" | wc -l)
257 261
258 echo "Running spad tests on: $(basename $LOC) / $(basename $REM)" 262 echo "Running spad tests on: $(subdirname $LOC) / $(subdirname $REM)"
263
264 CNT=$(get_files_count "spad" "$LOC")
265
266 if [[ $CNT -eq 0 ]]; then
267 echo " Unsupported"
268 return
269 fi
259 270
260 for ((i = 0; i < $CNT; i++)); do 271 for ((i = 0; i < $CNT; i++)); do
261 VAL=$RANDOM 272 VAL=$RANDOM
262 write_file "$i $VAL" "$LOC/peer_spad" 273 write_file "$VAL" "$LOC/spad$i"
263 RVAL=$(read_spad "$REM/spad" $i) 274 RVAL=$(read_file "$REM/../spad$i")
264 275
265 if [[ "$VAL" != "$RVAL" ]]; then 276 if [[ "$VAL" -ne "$RVAL" ]]; then
266 echo "Scratchpad doesn't match expected value $VAL " \ 277 echo "Scratchpad $i value $RVAL doesn't match $VAL" >&2
267 "in $REM/spad, got $RVAL" >&2
268 exit -1 278 exit -1
269 fi 279 fi
270
271 done 280 done
272 281
273 echo " Passed" 282 echo " Passed"
@@ -402,15 +411,15 @@ function ntb_tool_tests()
402 doorbell_test "$LOCAL_TOOL" "$REMOTE_TOOL" 411 doorbell_test "$LOCAL_TOOL" "$REMOTE_TOOL"
403 doorbell_test "$REMOTE_TOOL" "$LOCAL_TOOL" 412 doorbell_test "$REMOTE_TOOL" "$LOCAL_TOOL"
404 413
414 scratchpad_test "$LOCAL_PEER_TOOL" "$REMOTE_PEER_TOOL"
415 scratchpad_test "$REMOTE_PEER_TOOL" "$LOCAL_PEER_TOOL"
416
405 for PEER_TRANS in $(ls "$LOCAL_TOOL"/peer_trans*); do 417 for PEER_TRANS in $(ls "$LOCAL_TOOL"/peer_trans*); do
406 PT=$(basename $PEER_TRANS) 418 PT=$(basename $PEER_TRANS)
407 write_file $MW_SIZE "$LOCAL_TOOL/$PT" 419 write_file $MW_SIZE "$LOCAL_TOOL/$PT"
408 write_file $MW_SIZE "$REMOTE_TOOL/$PT" 420 write_file $MW_SIZE "$REMOTE_TOOL/$PT"
409 done 421 done
410 422
411 scratchpad_test "$LOCAL_TOOL" "$REMOTE_TOOL"
412 scratchpad_test "$REMOTE_TOOL" "$LOCAL_TOOL"
413
414 for MW in $(ls "$LOCAL_TOOL"/mw*); do 423 for MW in $(ls "$LOCAL_TOOL"/mw*); do
415 MW=$(basename $MW) 424 MW=$(basename $MW)
416 425