Commit 0298e5b9 authored by Serge Semin's avatar Serge Semin Committed by Jon Mason

NTB: ntb_test: Update ntb_tool link tests

Link Up and Down methods are used to change NTB link settings on
local side only for multi-port devices. Link is considered up
only if both sides local and peer set it up. Intel/AMD hardware
acts a bit different by assigning the Primary and Secondary roles,
so Primary device only is able to change the link state. Such behaviour
should be reflected in the test code.
Signed-off-by: default avatarSerge Semin <fancer.lancer@gmail.com>
Signed-off-by: default avatarJon Mason <jdmason@kudzu.us>
parent dd151d72
...@@ -138,6 +138,11 @@ function check_file() ...@@ -138,6 +138,11 @@ function check_file()
fi fi
} }
function subdirname()
{
echo $(basename $(dirname $1)) 2> /dev/null
}
function find_pidx() function find_pidx()
{ {
PORT=$1 PORT=$1
...@@ -183,9 +188,9 @@ function link_test() ...@@ -183,9 +188,9 @@ function link_test()
REM=$2 REM=$2
EXP=0 EXP=0
echo "Running link tests on: $(basename $LOC) / $(basename $REM)" echo "Running link tests on: $(subdirname $LOC) / $(subdirname $REM)"
if ! write_file "N" "$LOC/link" 2> /dev/null; then if ! write_file "N" "$LOC/../link" 2> /dev/null; then
echo " Unsupported" echo " Unsupported"
return return
fi fi
...@@ -193,12 +198,11 @@ function link_test() ...@@ -193,12 +198,11 @@ function link_test()
write_file "N" "$LOC/link_event" write_file "N" "$LOC/link_event"
if [[ $(read_file "$REM/link") != "N" ]]; then if [[ $(read_file "$REM/link") != "N" ]]; then
echo "Expected remote link to be down in $REM/link" >&2 echo "Expected link to be down in $REM/link" >&2
exit -1 exit -1
fi fi
write_file "Y" "$LOC/link" write_file "Y" "$LOC/../link"
write_file "Y" "$LOC/link_event"
echo " Passed" echo " Passed"
} }
...@@ -379,15 +383,15 @@ function ntb_tool_tests() ...@@ -379,15 +383,15 @@ function ntb_tool_tests()
port_test "$LOCAL_TOOL" "$REMOTE_TOOL" port_test "$LOCAL_TOOL" "$REMOTE_TOOL"
write_file "Y" "$LOCAL_TOOL/link_event" LOCAL_PEER_TOOL="$LOCAL_TOOL/peer$LOCAL_PIDX"
write_file "Y" "$REMOTE_TOOL/link_event" REMOTE_PEER_TOOL="$REMOTE_TOOL/peer$REMOTE_PIDX"
link_test "$LOCAL_TOOL" "$REMOTE_TOOL" link_test "$LOCAL_PEER_TOOL" "$REMOTE_PEER_TOOL"
link_test "$REMOTE_TOOL" "$LOCAL_TOOL" link_test "$REMOTE_PEER_TOOL" "$LOCAL_PEER_TOOL"
#Ensure the link is up on both sides before continuing #Ensure the link is up on both sides before continuing
write_file "Y" "$LOCAL_TOOL/link_event" write_file "Y" "$LOCAL_PEER_TOOL/link_event"
write_file "Y" "$REMOTE_TOOL/link_event" write_file "Y" "$REMOTE_PEER_TOOL/link_event"
for PEER_TRANS in $(ls "$LOCAL_TOOL"/peer_trans*); do for PEER_TRANS in $(ls "$LOCAL_TOOL"/peer_trans*); do
PT=$(basename $PEER_TRANS) PT=$(basename $PEER_TRANS)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment