#!/bin/bash # Copyright (c) 2016 Microsemi. All Rights Reserved. # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # This program is distributed in the hope that it would be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # Author: Logan Gunthorpe global REMOTE_HOST := '' global LIST_DEVS := 'FALSE' global DEBUGFS := $(DEBUGFS-/sys/kernel/debug) global PERF_RUN_ORDER := '32' global MAX_MW_SIZE := '0' global RUN_DMA_TESTS := '' global DONT_CLEANUP := '' global MW_SIZE := '65536' proc show_help { echo "Usage: $0 [OPTIONS] LOCAL_DEV REMOTE_DEV" echo "Run tests on a pair of NTB endpoints." echo echo "If the NTB device loops back to the same host then," echo "just specifying the two PCI ids on the command line is" echo "sufficient. Otherwise, if the NTB link spans two hosts" echo "use the -r option to specify the hostname for the remote" echo "device. SSH will then be used to test the remote side." echo "An SSH key between the root users of the host would then" echo "be highly recommended." echo echo "Options:" echo " -C don't cleanup ntb modules on exit" echo " -d run dma tests" echo " -h show this help message" echo " -l list available local and remote PCI ids" echo " -r REMOTE_HOST specify the remote's hostname to connect" echo " to for the test (using ssh)" echo " -p NUM ntb_perf run order (default: $PERF_RUN_ORDER)" echo " -w max_mw_size maxmium memory window size" echo } proc parse_args { global OPTIND := '0' while getopts "Cdhlm:r:p:w:" opt { matchstr $opt { C { global DONT_CLEANUP := '1' } d { global RUN_DMA_TESTS := '1' } h { show_help; exit 0 } l { global LIST_DEVS := 'TRUE' } m { global MW_SIZE := $(OPTARG) } r { global REMOTE_HOST := $(OPTARG) } p { global PERF_RUN_ORDER := $(OPTARG) } w { global MAX_MW_SIZE := $(OPTARG) } \? { echo "Invalid option: -$OPTARG" > !2 exit 1 } } } } parse_args @Argv shift $(OPTIND-1) global LOCAL_DEV := $1 shift parse_args @Argv shift $(OPTIND-1) global REMOTE_DEV := $1 shift parse_args @Argv set -e proc _modprobe { modprobe @Argv } proc split_remote { global VPATH := $1 global REMOTE := '' if [[ "$VPATH" == *":/"* ]] { global REMOTE := $(VPATH%%:*) global VPATH := $(VPATH#*:) } } proc read_file { split_remote $1 if [[ "$REMOTE" != "" ]] { ssh $REMOTE cat $VPATH } else { cat $VPATH } } proc write_file { split_remote $2 global VALUE := $1 if [[ "$REMOTE" != "" ]] { ssh $REMOTE "echo \"$VALUE\" > \"$VPATH\"" } else { echo $VALUE > $VPATH } } proc link_test { global LOC := $1 global REM := $2 global EXP := '0' echo "Running link tests on: $[basename $LOC] / $[basename $REM]" if ! write_file "N" "$LOC/link" !2 > /dev/null { echo " Unsupported" return } write_file "N" "$LOC/link_event" if [[ $(read_file "$REM/link") != "N" ]] { echo "Expected remote link to be down in $REM/link" > !2 exit -1 } write_file "Y" "$LOC/link" write_file "Y" "$LOC/link_event" echo " Passed" } proc doorbell_test { global LOC := $1 global REM := $2 global EXP := '0' echo "Running db tests on: $[basename $LOC] / $[basename $REM]" write_file "c 0xFFFFFFFF" "$REM/db" for ((i=1; i <= 8; i++)); do let DB=$(read_file "$REM/db") || true if [[ "$DB" != "$EXP" ]]; then echo "Doorbell doesn't match expected value $EXP " \ "in $REM/db" >&2 exit -1 fi let "MASK=1 << ($i-1)" || true let "EXP=$EXP | $MASK" || true write_file "s $MASK" "$LOC/peer_db" done echo " Passed" } proc read_spad { global VPATH := $1 global IDX := $2 global ROW := '('$(read_file "$VPATH" | grep -e "^$IDX")) let VAL=$(ROW[1]) || true echo $VAL } proc scratchpad_test { global LOC := $1 global REM := $2 global CNT := $[read_file "$LOC/spad" | wc -l] echo "Running spad tests on: $[basename $LOC] / $[basename $REM]" for ((i = 0; i < $CNT; i++)); do VAL=$RANDOM write_file "$i $VAL" "$LOC/peer_spad" RVAL=$(read_spad "$REM/spad" $i) if [[ "$VAL" != "$RVAL" ]]; then echo "Scratchpad doesn't match expected value $VAL " \ "in $REM/spad, got $RVAL" >&2 exit -1 fi done echo " Passed" } proc write_mw { split_remote $2 if [[ "$REMOTE" != "" ]] { ssh $REMOTE \ dd if=/dev/urandom "of=$VPATH" !2 > /dev/null || true } else { dd if=/dev/urandom "of=$VPATH" !2 > /dev/null || true } } proc mw_test { global IDX := $1 global LOC := $2 global REM := $3 echo "Running $IDX tests on: $[basename $LOC] / $[basename $REM]" write_mw "$LOC/$IDX" split_remote "$LOC/$IDX" if [[ "$REMOTE" == "" ]] { global A := $VPATH } else { global A := "/tmp/ntb_test.$Pid.A" ssh $REMOTE cat $VPATH > $A } split_remote "$REM/peer_$IDX" if [[ "$REMOTE" == "" ]] { global B := $VPATH } else { global B := "/tmp/ntb_test.$Pid.B" ssh $REMOTE cat $VPATH > $B } cmp -n $MW_SIZE $A $B if [[ $? != 0 ]] { echo "Memory window $MW did not match!" > !2 } if [[ "$A" == "/tmp/*" ]] { rm $A } if [[ "$B" == "/tmp/*" ]] { rm $B } echo " Passed" } proc pingpong_test { global LOC := $1 global REM := $2 echo "Running ping pong tests on: $[basename $LOC] / $[basename $REM]" global LOC_START := $[read_file $LOC/count] global REM_START := $[read_file $REM/count] sleep 7 global LOC_END := $[read_file $LOC/count] global REM_END := $[read_file $REM/count] if [[ $LOC_START == $LOC_END ]] || [[ $REM_START == $REM_END ]] { echo "Ping pong counter not incrementing!" > !2 exit 1 } echo " Passed" } proc perf_test { global USE_DMA := $1 if [[ $USE_DMA == "1" ]] { global WITH := '"with'" } else { global WITH := '"without'" } _modprobe ntb_perf run_order=$PERF_RUN_ORDER \ max_mw_size=$MAX_MW_SIZE use_dma=$USE_DMA echo "Running local perf test $WITH DMA" write_file "" $LOCAL_PERF/run echo -n " " read_file $LOCAL_PERF/run echo " Passed" echo "Running remote perf test $WITH DMA" write_file "" $REMOTE_PERF/run echo -n " " read_file $LOCAL_PERF/run echo " Passed" _modprobe -r ntb_perf } proc ntb_tool_tests { global LOCAL_TOOL := "$DEBUGFS/ntb_tool/$LOCAL_DEV" global REMOTE_TOOL := "$REMOTE_HOST:$DEBUGFS/ntb_tool/$REMOTE_DEV" echo "Starting ntb_tool tests..." _modprobe ntb_tool write_file Y $LOCAL_TOOL/link_event write_file Y $REMOTE_TOOL/link_event link_test $LOCAL_TOOL $REMOTE_TOOL link_test $REMOTE_TOOL $LOCAL_TOOL for PEER_TRANS in [$[ls $LOCAL_TOOL/peer_trans*]] { global PT := $[basename $PEER_TRANS] write_file $MW_SIZE $LOCAL_TOOL/$PT write_file $MW_SIZE $REMOTE_TOOL/$PT } doorbell_test $LOCAL_TOOL $REMOTE_TOOL doorbell_test $REMOTE_TOOL $LOCAL_TOOL scratchpad_test $LOCAL_TOOL $REMOTE_TOOL scratchpad_test $REMOTE_TOOL $LOCAL_TOOL for MW in [$[ls $LOCAL_TOOL/mw*]] { global MW := $[basename $MW] mw_test $MW $LOCAL_TOOL $REMOTE_TOOL mw_test $MW $REMOTE_TOOL $LOCAL_TOOL } _modprobe -r ntb_tool } proc ntb_pingpong_tests { global LOCAL_PP := "$DEBUGFS/ntb_pingpong/$LOCAL_DEV" global REMOTE_PP := "$REMOTE_HOST:$DEBUGFS/ntb_pingpong/$REMOTE_DEV" echo "Starting ntb_pingpong tests..." _modprobe ntb_pingpong pingpong_test $LOCAL_PP $REMOTE_PP _modprobe -r ntb_pingpong } proc ntb_perf_tests { global LOCAL_PERF := "$DEBUGFS/ntb_perf/$LOCAL_DEV" global REMOTE_PERF := "$REMOTE_HOST:$DEBUGFS/ntb_perf/$REMOTE_DEV" echo "Starting ntb_perf tests..." perf_test 0 if [[ $RUN_DMA_TESTS ]] { perf_test 1 } } proc cleanup { set +e _modprobe -r ntb_tool !2 > /dev/null _modprobe -r ntb_perf !2 > /dev/null _modprobe -r ntb_pingpong !2 > /dev/null _modprobe -r ntb_transport !2 > /dev/null set -e } cleanup if ! [[ $$DONT_CLEANUP ]] { trap cleanup EXIT } if test $[id -u] != "0" { echo "This script must be run as root" !1 > !2 exit 1 } if [[ "$LIST_DEVS" == TRUE ]] { echo "Local Devices:" ls -1 /sys/bus/ntb/devices echo if [[ "$REMOTE_HOST" != "" ]] { echo "Remote Devices:" ssh $REMOTE_HOST ls -1 /sys/bus/ntb/devices } exit 0 } if [[ "$LOCAL_DEV" == $"" ]] || [[ "$REMOTE_DEV" == $"" ]] { show_help exit 1 } ntb_tool_tests echo ntb_pingpong_tests echo ntb_perf_tests echo (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:REMOTE_HOST) op:Equal rhs:{(SQ )} spids:[43])] spids: [43] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:LIST_DEVS) op:Equal rhs:{(FALSE)} spids:[45])] spids: [45] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DEBUGFS) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id: VTest_Hyphen arg_word: {(Lit_Slash /) (sys) (Lit_Slash /) (kernel) (Lit_Slash /) (debug)} ) spids: [50 59] ) } spids: [49] ) ] spids: [49] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:PERF_RUN_ORDER) op:Equal rhs:{(32)} spids:[62])] spids: [62] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:MAX_MW_SIZE) op:Equal rhs:{(0)} spids:[65])] spids: [65] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:RUN_DMA_TESTS) op:Equal rhs:{(SQ )} spids:[68])] spids: [68] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:DONT_CLEANUP) op:Equal rhs:{(SQ )} spids:[70])] spids: [70] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:MW_SIZE) op:Equal rhs:{(65536)} spids:[72])] spids: [72] ) (FuncDef name: show_help body: (BraceGroup children: [ (C {(echo)} {(DQ ("Usage: ") ($ VSub_Number "$0") (" [OPTIONS] LOCAL_DEV REMOTE_DEV"))}) (C {(echo)} {(DQ ("Run tests on a pair of NTB endpoints."))}) (C {(echo)}) (C {(echo)} {(DQ ("If the NTB device loops back to the same host then,"))}) (C {(echo)} {(DQ ("just specifying the two PCI ids on the command line is"))}) (C {(echo)} {(DQ ("sufficient. Otherwise, if the NTB link spans two hosts"))}) (C {(echo)} {(DQ ("use the -r option to specify the hostname for the remote"))}) (C {(echo)} {(DQ ("device. SSH will then be used to test the remote side."))}) (C {(echo)} {(DQ ("An SSH key between the root users of the host would then"))}) (C {(echo)} {(DQ ("be highly recommended."))}) (C {(echo)}) (C {(echo)} {(DQ ("Options:"))}) (C {(echo)} {(DQ (" -C don't cleanup ntb modules on exit"))}) (C {(echo)} {(DQ (" -d run dma tests"))}) (C {(echo)} {(DQ (" -h show this help message"))}) (C {(echo)} {(DQ (" -l list available local and remote PCI ids"))}) (C {(echo)} {(DQ (" -r REMOTE_HOST specify the remote's hostname to connect"))}) (C {(echo)} {(DQ (" to for the test (using ssh)"))}) (C {(echo)} { (DQ (" -p NUM ntb_perf run order (default: ") ($ VSub_Name "$PERF_RUN_ORDER") (")") ) } ) (C {(echo)} {(DQ (" -w max_mw_size maxmium memory window size"))}) (C {(echo)}) ] spids: [82] ) spids: [76 81] ) (FuncDef name: parse_args body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:OPTIND) op:Equal rhs:{(0)} spids:[235])] spids: [235] ) (While cond: [ (Sentence child: (C {(getopts)} {(DQ ("Cdhlm:r:p:w:"))} {(opt)}) terminator: ) ] body: (DoGroup children: [ (Case to_match: {(DQ ($ VSub_Name "$opt"))} arms: [ (case_arm pat_list: [{(C)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DONT_CLEANUP) op: Equal rhs: {(1)} spids: [265] ) ] spids: [265] ) ] spids: [262 263 268 -1] ) (case_arm pat_list: [{(d)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:RUN_DMA_TESTS) op: Equal rhs: {(1)} spids: [274] ) ] spids: [274] ) ] spids: [271 272 277 -1] ) (case_arm pat_list: [{(h)}] action: [ (Sentence child: (C {(show_help)}) terminator: ) (C {(exit)} {(0)}) ] spids: [280 281 290 -1] ) (case_arm pat_list: [{(l)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LIST_DEVS) op: Equal rhs: {(TRUE)} spids: [296] ) ] spids: [296] ) ] spids: [293 294 299 -1] ) (case_arm pat_list: [{(m)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MW_SIZE) op: Equal rhs: {(${ VSub_Name OPTARG)} spids: [305] ) ] spids: [305] ) ] spids: [302 303 310 -1] ) (case_arm pat_list: [{(r)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REMOTE_HOST) op: Equal rhs: {(${ VSub_Name OPTARG)} spids: [316] ) ] spids: [316] ) ] spids: [313 314 321 -1] ) (case_arm pat_list: [{(p)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PERF_RUN_ORDER) op: Equal rhs: {(${ VSub_Name OPTARG)} spids: [327] ) ] spids: [327] ) ] spids: [324 325 332 -1] ) (case_arm pat_list: [{(w)}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MAX_MW_SIZE) op: Equal rhs: {(${ VSub_Name OPTARG)} spids: [338] ) ] spids: [338] ) ] spids: [335 336 343 -1] ) (case_arm pat_list: [{(EscapedLiteralPart token:)}] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Invalid option: -") ($ VSub_Name "$OPTARG"))}] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [357] ) ] ) (C {(exit)} {(1)}) ] spids: [346 347 366 -1] ) ] spids: [253 259 369] ) ] spids: [250 372] ) ) ] spids: [232] ) spids: [226 231] ) (C {(parse_args)} {(DQ ($ VSub_At "$@"))}) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithVarRef name:OPTIND) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [385 390] ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOCAL_DEV) op: Equal rhs: {($ VSub_Number "$1")} spids: [392] ) ] spids: [392] ) (C {(shift)}) (C {(parse_args)} {(DQ ($ VSub_At "$@"))}) (C {(shift)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Minus left: (ArithVarRef name:OPTIND) right: (ArithWord w:{(Lit_Digits 1)}) ) spids: [405 410] ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REMOTE_DEV) op: Equal rhs: {($ VSub_Number "$1")} spids: [412] ) ] spids: [412] ) (C {(shift)}) (C {(parse_args)} {(DQ ($ VSub_At "$@"))}) (C {(set)} {(-e)}) (FuncDef name: _modprobe body: (BraceGroup children:[(C {(modprobe)} {(DQ ($ VSub_At "$@"))})] spids:[435]) spids: [429 434] ) (FuncDef name: split_remote body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VPATH) op: Equal rhs: {($ VSub_Number "$1")} spids: [456] ) ] spids: [456] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:REMOTE) op:Equal rhs:{(SQ )} spids:[460])] spids: [460] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$VPATH"))} right: {(Lit_Other "*") (DQ (":/")) (Lit_Other "*")} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REMOTE) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_DPercent arg_word:{(":*")}) spids: [487 491] ) } spids: [486] ) ] spids: [486] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VPATH) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Pound arg_word:{("*:")}) spids: [495 499] ) } spids: [494] ) ] spids: [494] ) ] spids: [-1 483] ) ] spids: [-1 502] ) ] spids: [453] ) spids: [447 452] ) (FuncDef name: read_file body: (BraceGroup children: [ (C {(split_remote)} {($ VSub_Number "$1")}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ ($ VSub_Name "$REMOTE"))} right: {(DQ )} ) ) terminator: ) ] action: [ (C {(ssh)} {(DQ ($ VSub_Name "$REMOTE"))} {(cat)} {(DQ ($ VSub_Name "$VPATH"))}) ] spids: [-1 537] ) ] else_action: [(C {(cat)} {(DQ ($ VSub_Name "$VPATH"))})] spids: [553 563] ) ] spids: [513] ) spids: [507 512] ) (FuncDef name: write_file body: (BraceGroup children: [ (C {(split_remote)} {($ VSub_Number "$2")}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VALUE) op: Equal rhs: {($ VSub_Number "$1")} spids: [582] ) ] spids: [582] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ ($ VSub_Name "$REMOTE"))} right: {(DQ )} ) ) terminator: ) ] action: [ (C {(ssh)} {(DQ ($ VSub_Name "$REMOTE"))} { (DQ ("echo ") (EscapedLiteralPart token:) ($ VSub_Name "$VALUE") (EscapedLiteralPart token:) (" > ") (EscapedLiteralPart token: ) ($ VSub_Name "$VPATH") (EscapedLiteralPart token:) ) } ) ] spids: [-1 603] ) ] else_action: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Name "$VALUE"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$VPATH"))} spids: [633] ) ] ) ] spids: [624 640] ) ] spids: [574] ) spids: [568 573] ) (FuncDef name: link_test body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOC) op: Equal rhs: {($ VSub_Number "$1")} spids: [654] ) ] spids: [654] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REM) op: Equal rhs: {($ VSub_Number "$2")} spids: [658] ) ] spids: [658] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:EXP) op:Equal rhs:{(0)} spids:[662])] spids: [662] ) (C {(echo)} { (DQ ("Running link tests on: ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$LOC")})]) left_token: spids: [671 675] ) (" / ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$REM")})]) left_token: spids: [677 681] ) ) } ) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [ (SimpleCommand words: [{(write_file)} {(DQ (N))} {(DQ ($ VSub_Name "$LOC") (/link))}] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [701] ) ] ) ] negated: True ) terminator: ) ] action: [ (C {(echo)} {(DQ (" Unsupported"))}) (ControlFlow token:) ] spids: [-1 706] ) ] spids: [-1 719] ) (C {(write_file)} {(DQ (N))} {(DQ ($ VSub_Name "$LOC") (/link_event))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: { (CommandSubPart command_list: (CommandList children: [(C {(read_file)} {(DQ ($ VSub_Name "$REM") (/link))})] ) left_token: spids: [740 747] ) } right: {(DQ (N))} ) ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} {(DQ ("Expected remote link to be down in ") ($ VSub_Name "$REM") (/link))} ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[769])] ) (C {(exit)} {(-1)}) ] spids: [-1 758] ) ] spids: [-1 778] ) (C {(write_file)} {(DQ (Y))} {(DQ ($ VSub_Name "$LOC") (/link))}) (C {(write_file)} {(DQ (Y))} {(DQ ($ VSub_Name "$LOC") (/link_event))}) (C {(echo)} {(DQ (" Passed"))}) ] spids: [651] ) spids: [645 650] ) (FuncDef name: doorbell_test body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOC) op: Equal rhs: {($ VSub_Number "$1")} spids: [825] ) ] spids: [825] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REM) op: Equal rhs: {($ VSub_Number "$2")} spids: [829] ) ] spids: [829] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:EXP) op:Equal rhs:{(0)} spids:[833])] spids: [833] ) (C {(echo)} { (DQ ("Running db tests on: ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$LOC")})]) left_token: spids: [842 846] ) (" / ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$REM")})]) left_token: spids: [848 852] ) ) } ) (C {(write_file)} {(DQ ("c 0xFFFFFFFF"))} {(DQ ($ VSub_Name "$REM") (/db))}) (ForExpr init: (BinaryAssign op_id: Arith_Equal left: (LhsName name:i) right: (ArithWord w:{(Lit_Digits 1)}) ) cond: (ArithBinary op_id: Arith_LessEqual left: (ArithVarRef name:i) right: (ArithWord w:{(Lit_Digits 8)}) ) update: (UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i)) body: (DoGroup children: [ (AndOr children: [ (C {(let)} {(Lit_VarLike "DB=") (CommandSubPart command_list: (CommandList children: [(C {(read_file)} {(DQ ($ VSub_Name "$REM") (/db))})] ) left_token: spids: [897 904] ) } ) (C {(true)}) ] op_id: Op_DPipe ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ ($ VSub_Name "$DB"))} right: {(DQ ($ VSub_Name "$EXP"))} ) ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("Doorbell doesn't match expected value ") ($ VSub_Name "$EXP") (" ") ) } {(DQ ("in ") ($ VSub_Name "$REM") (/db))} ] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [947] ) ] ) (C {(exit)} {(-1)}) ] spids: [-1 928] ) ] spids: [-1 956] ) (AndOr children: [ (C {(let)} {(DQ ("MASK=1 << (") ($ VSub_Name "$i") ("-1)"))}) (C {(true)}) ] op_id: Op_DPipe ) (AndOr children: [ (C {(let)} {(DQ ("EXP=") ($ VSub_Name "$EXP") (" | ") ($ VSub_Name "$MASK"))}) (C {(true)}) ] op_id: Op_DPipe ) (C {(write_file)} {(DQ ("s ") ($ VSub_Name "$MASK"))} {(DQ ($ VSub_Name "$LOC") (/peer_db))} ) ] spids: [891 1000] ) ) (C {(echo)} {(DQ (" Passed"))}) ] spids: [822] ) spids: [816 821] ) (FuncDef name: read_spad body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VPATH) op: Equal rhs: {($ VSub_Number "$1")} spids: [1022] ) ] spids: [1022] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:IDX) op: Equal rhs: {($ VSub_Number "$2")} spids: [1026] ) ] spids: [1026] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ROW) op: Equal rhs: { (ArrayLiteralPart words: [ { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(read_file)} {(DQ ($ VSub_Name "$VPATH"))}) (C {(grep)} {(-e)} {(DQ ("^") ($ VSub_Name "$IDX"))}) ] negated: False ) ] ) left_token: spids: [1033 1050] ) } ] ) } spids: [1031] ) ] spids: [1031] ) (AndOr children: [ (C {(let)} {(Lit_VarLike "VAL=") (BracedVarSub token: bracket_op: (ArrayIndex expr:(ArithWord w:{(Lit_Digits 1)})) spids: [1057 1062] ) } ) (C {(true)}) ] op_id: Op_DPipe ) (C {(echo)} {($ VSub_Name "$VAL")}) ] spids: [1019] ) spids: [1013 1018] ) (FuncDef name: scratchpad_test body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOC) op: Equal rhs: {($ VSub_Number "$1")} spids: [1085] ) ] spids: [1085] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REM) op: Equal rhs: {($ VSub_Number "$2")} spids: [1089] ) ] spids: [1089] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CNT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(read_file)} {(DQ ($ VSub_Name "$LOC") (/spad))}) (C {(wc)} {(-l)}) ] negated: False ) ] ) left_token: spids: [1094 1107] ) } spids: [1093] ) ] spids: [1093] ) (C {(echo)} { (DQ ("Running spad tests on: ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$LOC")})]) left_token: spids: [1115 1119] ) (" / ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$REM")})]) left_token: spids: [1121 1125] ) ) } ) (ForExpr init: (BinaryAssign op_id: Arith_Equal left: (LhsName name:i) right: (ArithWord w:{(Lit_Digits 0)}) ) cond: (ArithBinary op_id: Arith_Less left: (ArithVarRef name:i) right: (ArithWord w:{($ VSub_Name "$CNT")}) ) update: (UnaryAssign op_id:Node_PostDPlus child:(LhsName name:i)) body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:VAL) op: Equal rhs: {($ VSub_Name "$RANDOM")} spids: [1156] ) ] spids: [1156] ) (C {(write_file)} {(DQ ($ VSub_Name "$i") (" ") ($ VSub_Name "$VAL"))} {(DQ ($ VSub_Name "$LOC") (/peer_spad))} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:RVAL) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (C {(read_spad)} {(DQ ($ VSub_Name "$REM") (/spad))} {($ VSub_Name "$i")} ) ] ) left_token: spids: [1175 1184] ) } spids: [1174] ) ] spids: [1174] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ ($ VSub_Name "$VAL"))} right: {(DQ ($ VSub_Name "$RVAL"))} ) ) terminator: ) ] action: [ (SimpleCommand words: [ {(echo)} { (DQ ("Scratchpad doesn't match expected value ") ($ VSub_Name "$VAL") (" ") ) } { (DQ ("in ") ($ VSub_Name "$REM") ("/spad, got ") ($ VSub_Name "$RVAL")) } ] redirects: [ (Redir op_id: Redir_GreatAnd fd: -1 arg_word: {(2)} spids: [1225] ) ] ) (C {(exit)} {(-1)}) ] spids: [-1 1205] ) ] spids: [-1 1234] ) ] spids: [1153 1238] ) ) (C {(echo)} {(DQ (" Passed"))}) ] spids: [1082] ) spids: [1076 1081] ) (FuncDef name: write_mw body: (BraceGroup children: [ (C {(split_remote)} {($ VSub_Number "$2")}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ ($ VSub_Name "$REMOTE"))} right: {(DQ )} ) ) terminator: ) ] action: [ (AndOr children: [ (SimpleCommand words: [ {(ssh)} {(DQ ($ VSub_Name "$REMOTE"))} {(dd)} {(Lit_VarLike "if=") (/dev/urandom)} {(DQ ("of=") ($ VSub_Name "$VPATH"))} ] redirects: [ (Redir op_id: Redir_Great fd: 2 arg_word: {(/dev/null)} spids: [1303] ) ] ) (C {(true)}) ] op_id: Op_DPipe ) ] spids: [-1 1282] ) ] else_action: [ (AndOr children: [ (SimpleCommand words: [ {(dd)} {(Lit_VarLike "if=") (/dev/urandom)} {(DQ ("of=") ($ VSub_Name "$VPATH"))} ] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[1325])] ) (C {(true)}) ] op_id: Op_DPipe ) ] spids: [1312 1334] ) ] spids: [1257] ) spids: [1251 1256] ) (FuncDef name: mw_test body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:IDX) op: Equal rhs: {($ VSub_Number "$1")} spids: [1348] ) ] spids: [1348] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOC) op: Equal rhs: {($ VSub_Number "$2")} spids: [1352] ) ] spids: [1352] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REM) op: Equal rhs: {($ VSub_Number "$3")} spids: [1356] ) ] spids: [1356] ) (C {(echo)} { (DQ ("Running ") ($ VSub_Name "$IDX") (" tests on: ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$LOC")})]) left_token: spids: [1367 1371] ) (" / ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$REM")})]) left_token: spids: [1373 1377] ) ) } ) (C {(write_mw)} {(DQ ($ VSub_Name "$LOC") (/) ($ VSub_Name "$IDX"))}) (C {(split_remote)} {(DQ ($ VSub_Name "$LOC") (/) ($ VSub_Name "$IDX"))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$REMOTE"))} right: {(DQ )} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:A) op: Equal rhs: {($ VSub_Name "$VPATH")} spids: [1420] ) ] spids: [1420] ) ] spids: [-1 1417] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:A) op: Equal rhs: {(/tmp/ntb_test.) ($ VSub_Dollar "$$") (.A)} spids: [1427] ) ] spids: [1427] ) (SimpleCommand words: [{(ssh)} {(DQ ($ VSub_Name "$REMOTE"))} {(cat)} {(DQ ($ VSub_Name "$VPATH"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$A"))} spids: [1445] ) ] ) ] spids: [1424 1452] ) (C {(split_remote)} {(DQ ($ VSub_Name "$REM") (/peer_) ($ VSub_Name "$IDX"))}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$REMOTE"))} right: {(DQ )} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:B) op: Equal rhs: {($ VSub_Name "$VPATH")} spids: [1484] ) ] spids: [1484] ) ] spids: [-1 1481] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:B) op: Equal rhs: {(/tmp/ntb_test.) ($ VSub_Dollar "$$") (.B)} spids: [1491] ) ] spids: [1491] ) (SimpleCommand words: [{(ssh)} {(DQ ($ VSub_Name "$REMOTE"))} {(cat)} {(DQ ($ VSub_Name "$VPATH"))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ ($ VSub_Name "$B"))} spids: [1509] ) ] ) ] spids: [1488 1516] ) (C {(cmp)} {(-n)} {($ VSub_Name "$MW_SIZE")} {(DQ ($ VSub_Name "$A"))} {(DQ ($ VSub_Name "$B"))} ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {($ VSub_QMark "$?")} right: {(0)} ) ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Memory window ") ($ VSub_Name "$MW") (" did not match!"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1559])] ) ] spids: [-1 1548] ) ] spids: [-1 1563] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$A"))} right: {(DQ ("/tmp/*"))} ) ) terminator: ) ] action: [(C {(rm)} {(DQ ($ VSub_Name "$A"))})] spids: [-1 1584] ) ] spids: [-1 1594] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$B"))} right: {(DQ ("/tmp/*"))} ) ) terminator: ) ] action: [(C {(rm)} {(DQ ($ VSub_Name "$B"))})] spids: [-1 1615] ) ] spids: [-1 1625] ) (C {(echo)} {(DQ (" Passed"))}) ] spids: [1345] ) spids: [1339 1344] ) (FuncDef name: pingpong_test body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOC) op: Equal rhs: {($ VSub_Number "$1")} spids: [1647] ) ] spids: [1647] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REM) op: Equal rhs: {($ VSub_Number "$2")} spids: [1651] ) ] spids: [1651] ) (C {(echo)} { (DQ ("Running ping pong tests on: ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$LOC")})]) left_token: spids: [1660 1664] ) (" / ") (CommandSubPart command_list: (CommandList children:[(C {(basename)} {($ VSub_Name "$REM")})]) left_token: spids: [1666 1670] ) ) } ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOC_START) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(read_file)} {($ VSub_Name "$LOC") (/count)})] ) left_token: spids: [1676 1681] ) } spids: [1675] ) ] spids: [1675] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REM_START) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(read_file)} {($ VSub_Name "$REM") (/count)})] ) left_token: spids: [1685 1690] ) } spids: [1684] ) ] spids: [1684] ) (C {(sleep)} {(7)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOC_END) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(read_file)} {($ VSub_Name "$LOC") (/count)})] ) left_token: spids: [1701 1706] ) } spids: [1700] ) ] spids: [1700] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REM_END) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(read_file)} {($ VSub_Name "$REM") (/count)})] ) left_token: spids: [1710 1715] ) } spids: [1709] ) ] spids: [1709] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$LOC_START")} right: {($ VSub_Name "$LOC_END")} ) ) (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$REM_START")} right: {($ VSub_Name "$REM_END")} ) ) ] op_id: Op_DPipe ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("Ping pong counter not incrementing!"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[1753])] ) (C {(exit)} {(1)}) ] spids: [-1 1744] ) ] spids: [-1 1762] ) (C {(echo)} {(DQ (" Passed"))}) ] spids: [1644] ) spids: [1638 1643] ) (FuncDef name: perf_test body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:USE_DMA) op: Equal rhs: {($ VSub_Number "$1")} spids: [1784] ) ] spids: [1784] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {($ VSub_Name "$USE_DMA")} right: {(DQ (1))} ) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:WITH) op: Equal rhs: {(DQ (with))} spids: [1807] ) ] spids: [1807] ) ] spids: [-1 1804] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:WITH) op: Equal rhs: {(DQ (without))} spids: [1816] ) ] spids: [1816] ) ] spids: [1813 1822] ) (C {(_modprobe)} {(ntb_perf)} {(Lit_VarLike "run_order=") ($ VSub_Name "$PERF_RUN_ORDER")} {(Lit_VarLike "max_mw_size=") ($ VSub_Name "$MAX_MW_SIZE")} {(Lit_VarLike "use_dma=") ($ VSub_Name "$USE_DMA")} ) (C {(echo)} {(DQ ("Running local perf test ") ($ VSub_Name "$WITH") (" DMA"))}) (C {(write_file)} {(DQ )} {($ VSub_Name "$LOCAL_PERF") (/run)}) (C {(echo)} {(-n)} {(DQ (" "))}) (C {(read_file)} {($ VSub_Name "$LOCAL_PERF") (/run)}) (C {(echo)} {(DQ (" Passed"))}) (C {(echo)} {(DQ ("Running remote perf test ") ($ VSub_Name "$WITH") (" DMA"))}) (C {(write_file)} {(DQ )} {($ VSub_Name "$REMOTE_PERF") (/run)}) (C {(echo)} {(-n)} {(DQ (" "))}) (C {(read_file)} {($ VSub_Name "$LOCAL_PERF") (/run)}) (C {(echo)} {(DQ (" Passed"))}) (C {(_modprobe)} {(-r)} {(ntb_perf)}) ] spids: [1781] ) spids: [1775 1780] ) (FuncDef name: ntb_tool_tests body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOCAL_TOOL) op: Equal rhs: {($ VSub_Name "$DEBUGFS") (/ntb_tool/) ($ VSub_Name "$LOCAL_DEV")} spids: [1943] ) ] spids: [1943] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REMOTE_TOOL) op: Equal rhs: {($ VSub_Name "$REMOTE_HOST") (Lit_Other ":") ($ VSub_Name "$DEBUGFS") (/ntb_tool/) ($ VSub_Name "$REMOTE_DEV") } spids: [1949] ) ] spids: [1949] ) (C {(echo)} {(DQ ("Starting ntb_tool tests..."))}) (C {(_modprobe)} {(ntb_tool)}) (C {(write_file)} {(Y)} {($ VSub_Name "$LOCAL_TOOL") (/link_event)}) (C {(write_file)} {(Y)} {($ VSub_Name "$REMOTE_TOOL") (/link_event)}) (C {(link_test)} {($ VSub_Name "$LOCAL_TOOL")} {($ VSub_Name "$REMOTE_TOOL")}) (C {(link_test)} {($ VSub_Name "$REMOTE_TOOL")} {($ VSub_Name "$LOCAL_TOOL")}) (ForEach iter_name: PEER_TRANS iter_words: [ { (CommandSubPart command_list: (CommandList children: [ (C {(ls)} {($ VSub_Name "$LOCAL_TOOL") (/peer_trans) (Lit_Other "*")}) ] ) left_token: spids: [2010 2016] ) } ] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:PT) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(basename)} {($ VSub_Name "$PEER_TRANS")})] ) left_token: spids: [2023 2027] ) } spids: [2022] ) ] spids: [2022] ) (C {(write_file)} {($ VSub_Name "$MW_SIZE")} {($ VSub_Name "$LOCAL_TOOL") (/) ($ VSub_Name "$PT")} ) (C {(write_file)} {($ VSub_Name "$MW_SIZE")} {($ VSub_Name "$REMOTE_TOOL") (/) ($ VSub_Name "$PT")} ) ] spids: [2019 2048] ) spids: [2009 2017] ) (C {(doorbell_test)} {($ VSub_Name "$LOCAL_TOOL")} {($ VSub_Name "$REMOTE_TOOL")}) (C {(doorbell_test)} {($ VSub_Name "$REMOTE_TOOL")} {($ VSub_Name "$LOCAL_TOOL")}) (C {(scratchpad_test)} {($ VSub_Name "$LOCAL_TOOL")} {($ VSub_Name "$REMOTE_TOOL")}) (C {(scratchpad_test)} {($ VSub_Name "$REMOTE_TOOL")} {($ VSub_Name "$LOCAL_TOOL")}) (ForEach iter_name: MW iter_words: [ { (CommandSubPart command_list: (CommandList children: [(C {(ls)} {($ VSub_Name "$LOCAL_TOOL") (/mw) (Lit_Other "*")})] ) left_token: spids: [2087 2093] ) } ] do_arg_iter: False body: (DoGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:MW) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(basename)} {($ VSub_Name "$MW")})] ) left_token: spids: [2100 2104] ) } spids: [2099] ) ] spids: [2099] ) (C {(mw_test)} {($ VSub_Name "$MW")} {($ VSub_Name "$LOCAL_TOOL")} {($ VSub_Name "$REMOTE_TOOL")} ) (C {(mw_test)} {($ VSub_Name "$MW")} {($ VSub_Name "$REMOTE_TOOL")} {($ VSub_Name "$LOCAL_TOOL")} ) ] spids: [2096 2126] ) spids: [2086 2094] ) (C {(_modprobe)} {(-r)} {(ntb_tool)}) ] spids: [1940] ) spids: [1934 1939] ) (FuncDef name: ntb_pingpong_tests body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOCAL_PP) op: Equal rhs: {($ VSub_Name "$DEBUGFS") (/ntb_pingpong/) ($ VSub_Name "$LOCAL_DEV")} spids: [2148] ) ] spids: [2148] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REMOTE_PP) op: Equal rhs: {($ VSub_Name "$REMOTE_HOST") (Lit_Other ":") ($ VSub_Name "$DEBUGFS") (/ntb_pingpong/) ($ VSub_Name "$REMOTE_DEV") } spids: [2154] ) ] spids: [2154] ) (C {(echo)} {(DQ ("Starting ntb_pingpong tests..."))}) (C {(_modprobe)} {(ntb_pingpong)}) (C {(pingpong_test)} {($ VSub_Name "$LOCAL_PP")} {($ VSub_Name "$REMOTE_PP")}) (C {(_modprobe)} {(-r)} {(ntb_pingpong)}) ] spids: [2145] ) spids: [2139 2144] ) (FuncDef name: ntb_perf_tests body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOCAL_PERF) op: Equal rhs: {($ VSub_Name "$DEBUGFS") (/ntb_perf/) ($ VSub_Name "$LOCAL_DEV")} spids: [2203] ) ] spids: [2203] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REMOTE_PERF) op: Equal rhs: {($ VSub_Name "$REMOTE_HOST") (Lit_Other ":") ($ VSub_Name "$DEBUGFS") (/ntb_perf/) ($ VSub_Name "$REMOTE_DEV") } spids: [2209] ) ] spids: [2209] ) (C {(echo)} {(DQ ("Starting ntb_perf tests..."))}) (C {(perf_test)} {(0)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr:(WordTest w:{($ VSub_Name "$RUN_DMA_TESTS")})) terminator: ) ] action: [(C {(perf_test)} {(1)})] spids: [-1 2241] ) ] spids: [-1 2249] ) ] spids: [2200] ) spids: [2194 2199] ) (FuncDef name: cleanup body: (BraceGroup children: [ (C {(set)} {(Lit_Other "+") (e)}) (SimpleCommand words: [{(_modprobe)} {(-r)} {(ntb_tool)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[2275])] ) (SimpleCommand words: [{(_modprobe)} {(-r)} {(ntb_perf)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[2286])] ) (SimpleCommand words: [{(_modprobe)} {(-r)} {(ntb_pingpong)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[2297])] ) (SimpleCommand words: [{(_modprobe)} {(-r)} {(ntb_transport)}] redirects: [(Redir op_id:Redir_Great fd:2 arg_word:{(/dev/null)} spids:[2308])] ) (C {(set)} {(-e)}) ] spids: [2260] ) spids: [2254 2259] ) (C {(cleanup)}) (If arms: [ (if_arm cond: [ (Sentence child: (Pipeline children: [(DBracket expr:(WordTest w:{($ VSub_Dollar "$$") (DONT_CLEANUP)}))] negated: True ) terminator: ) ] action: [(C {(trap)} {(cleanup)} {(EXIT)})] spids: [-1 2335] ) ] spids: [-1 2344] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(id)} {(-u)})]) left_token: spids: [2352 2356] ) ) } {(KW_Bang "!") (Lit_Other "=")} {(DQ (0))} {(Lit_Other "]")} ) terminator: ) ] action: [ (SimpleCommand words: [{(echo)} {(DQ ("This script must be run as root"))}] redirects: [(Redir op_id:Redir_GreatAnd fd:1 arg_word:{(2)} spids:[2378])] ) (C {(exit)} {(1)}) ] spids: [-1 2369] ) ] spids: [-1 2386] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$LIST_DEVS"))} right: {(TRUE)} ) ) terminator: ) ] action: [ (C {(echo)} {(DQ ("Local Devices:"))}) (C {(ls)} {(-1)} {(/sys/bus/ntb/devices)}) (C {(echo)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id: BoolBinary_GlobNEqual left: {(DQ ($ VSub_Name "$REMOTE_HOST"))} right: {(DQ )} ) ) terminator: ) ] action: [ (C {(echo)} {(DQ ("Remote Devices:"))}) (C {(ssh)} {($ VSub_Name "$REMOTE_HOST")} {(ls)} {(-1)} {(/sys/bus/ntb/devices)}) ] spids: [-1 2441] ) ] spids: [-1 2462] ) (C {(exit)} {(0)}) ] spids: [-1 2404] ) ] spids: [-1 2470] ) (If arms: [ (if_arm cond: [ (Sentence child: (AndOr children: [ (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$LOCAL_DEV"))} right: {(DQ )} ) ) (DBracket expr: (BoolBinary op_id: BoolBinary_GlobDEqual left: {(DQ ($ VSub_Name "$REMOTE_DEV"))} right: {(DQ )} ) ) ] op_id: Op_DPipe ) terminator: ) ] action: [(C {(show_help)}) (C {(exit)} {(1)})] spids: [-1 2504] ) ] spids: [-1 2514] ) (C {(ntb_tool_tests)}) (C {(echo)}) (C {(ntb_pingpong_tests)}) (C {(echo)}) (C {(ntb_perf_tests)}) (C {(echo)}) ] )