X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Fscripts%2Fsocket_test.sh;h=35e9c0be67cd2af8e41afea803b77aba4aacffd9;hb=5c7cf1cc5358d137160be1619981e7eea9a7402f;hp=1573b48aa7da05e6d912e2008b5f2cc76c7047da;hpb=1948161b65aa89613f3b6d3714158048091a903c;p=vpp.git diff --git a/test/scripts/socket_test.sh b/test/scripts/socket_test.sh index 1573b48aa7d..35e9c0be67c 100755 --- a/test/scripts/socket_test.sh +++ b/test/scripts/socket_test.sh @@ -33,6 +33,7 @@ tmp_cmdfile_prefix="/tmp/socket_test_cmd" cmd1_file="${tmp_cmdfile_prefix}1.$$" cmd2_file="${tmp_cmdfile_prefix}2.$$" cmd3_file="${tmp_cmdfile_prefix}3.$$" +vpp_eth_name="enp0s8" tmp_vpp_exec_file="/tmp/vpp_config.$$" tmp_gdb_cmdfile_prefix="/tmp/gdb_cmdfile" def_gdb_cmdfile_prefix="$WS_ROOT/extras/gdb/gdb_cmdfile" @@ -48,7 +49,6 @@ trap_signals="SIGINT SIGTERM EXIT" VPP_GDB_CMDFILE="${VPP_GDB_CMDFILE:-${def_gdb_cmdfile_prefix}.vpp}" VPPCOM_CLIENT_GDB_CMDFILE="${VPPCOM_CLIENT_GDB_CMDFILE:-${def_gdb_cmdfile_prefix}.vppcom_client}" VPPCOM_SERVER_GDB_CMDFILE="${VPPCOM_SERVER_GDB_CMDFILE:-${def_gdb_cmdfile_prefix}.vppcom_server}" -VCL_LDPRELOAD_LIB_DIR="${VCL_LDPRELOAD_LIB_DIR:-/usr/local/lib}" usage() { cat < 0 )) ; do shift done +VCL_LDPRELOAD_LIB_DIR="${VCL_LDPRELOAD_LIB_DIR:-$lib64_dir}" + if [ -z "$WS_ROOT" ] ; then echo "ERROR: WS_ROOT environment variable not set!" >&2 echo " Please set WS_ROOT to VPP workspace root directory." >&2 exit 1 fi +if [[ "$(grep bin_PROGRAMS $WS_ROOT/src/uri.am)" = "" ]] ; then + $WS_ROOT/extras/vagrant/vcl_test.sh $WS_ROOT $USER + (cd $WS_ROOT; make build) +fi + if [ ! -d $vpp_dir ] ; then - echo "ERROR: Missing VPP$DEBUG bin directory!" >&2 + echo "ERROR: Missing VPP$title_dbg bin directory!" >&2 echo " $vpp_dir" >&2 env_test_failed="true" fi if [[ $run_test =~ .*"_preload" ]] ; then if [ ! -d $lib64_dir ] ; then - echo "ERROR: Missing VPP$DEBUG lib64 directory!" >&2 + echo "ERROR: Missing VPP$title_dbg lib64 directory!" >&2 echo " $lib64_dir" >&2 elif [ ! -d $VCL_LDPRELOAD_LIB_DIR ] ; then echo "ERROR: Missing VCL LD_PRELOAD Library directory!" >&2 @@ -267,19 +281,19 @@ if [[ $run_test =~ .*"_preload" ]] ; then fi if [ ! -f $vpp_dir$vpp_app ] ; then - echo "ERROR: Missing VPP$DEBUG Application!" >&2 + echo "ERROR: Missing VPP$title_dbg Application!" >&2 echo " $vpp_dir$vpp_app" >&2 env_test_failed="true" fi if [ ! -f $vpp_dir$sock_srvr_app ] && [ ! $iperf3 -eq 1 ] ; then - echo "ERROR: Missing$DEBUG Socket Server Application!" >&2 + echo "ERROR: Missing$title_dbg Socket Server Application!" >&2 echo " $vpp_dir$sock_srvr_app" >&2 env_test_failed="true" fi if [ ! -f $vpp_dir$sock_clnt_app ] && [ ! $iperf3 -eq 1 ] ; then - echo "ERROR: Missing$DEBUG Socket Client Application!" >&2 + echo "ERROR: Missing$title_dbg Socket Client Application!" >&2 echo " $vpp_dir$sock_clnt_app" >&2 env_test_failed="true" fi @@ -325,6 +339,7 @@ if [ -z "$api_segment" ] ; then api_segment=" api-segment { gid $user_gid }" fi if [ -n "$multi_host" ] ; then + sudo modprobe uio_pci_generic vpp_args="unix { interactive exec $tmp_vpp_exec_file}${api_segment}" else vpp_args="unix { interactive }${api_segment}" @@ -346,17 +361,23 @@ else clnt_app="$sock_clnt_app${sock_clnt_options} \$srvr_addr $sock_srvr_port" fi + verify_no_vpp() { - local running_vpp="ps -eaf|grep -v grep|grep \"bin/vpp\"" - if [ "$(eval $running_vpp)" != "" ] ; then - echo "ERROR: Please kill all running vpp instances:" + local grep_for_vpp="ps -eaf|grep -v grep|grep \"bin/vpp\"" + + if [ -n "$api_prefix" ] ; then + grep_for_vpp="$grep_for_vpp|grep \"prefix $api_prefix\"" + fi + local running_vpp="$(eval $grep_for_vpp)" + if [ -n "$running_vpp" ] ; then + echo "ERROR: Please kill the following vpp instance(s):" echo - eval $running_vpp + echo $running_vpp echo exit 1 fi clean_devshm="$vpp_shm_dir*db $vpp_shm_dir*global_vm $vpp_shm_dir*vpe-api $vpp_shm_dir[0-9]*-[0-9]* $vpp_shm_dir*:segment[0-9]*" - rm -f $clean_devshm + sudo rm -f $clean_devshm devshm_files="$(ls -l $clean_devshm 2>/dev/null | grep $(whoami))" if [ "$devshm_files" != "" ] ; then echo "ERROR: Please remove the following $vpp_shm_dir files:" @@ -370,7 +391,6 @@ verify_no_vpp() { sudo chown root:$USER $vpp_run_dir fi if [ -n "$multi_host" ] ; then - vpp_eth_name="enp0s8" vpp_eth_pci_id="$(ls -ld /sys/class/net/$vpp_eth_name/device | awk '{print $11}' | cut -d/ -f4)" if [ -z "$vpp_eth_pci_id" ] ; then echo "ERROR: Missing ethernet interface $vpp_eth_name!" @@ -390,6 +410,8 @@ verify_no_vpp() { vpp_eth_ifname="GigabitEthernet$bus/$slot/$func" ;; ixgbe) vpp_eth_ifname="TenGigabitEthernet$bus/$slot/$func" ;; + i40e) + vpp_eth_ifname="FortyGigabitEthernet$bus/$slot/$func" ;; *) echo "ERROR: Unknown ethernet kernel driver $vpp_eth_kernel_driver!" usage ;; @@ -397,17 +419,19 @@ verify_no_vpp() { vpp_eth_ip4_addr="$(ip -4 -br addr show $vpp_eth_name | awk '{print $3}')" if [ -z "$vpp_eth_ip4_addr" ] ; then - echo "ERROR: No inet address configured for $vpp_eth_name!" - usage + if [ "$multi_host" = "server" ] ; then + vpp_eth_ip4_addr="10.10.10.10/24" + else + vpp_eth_ip4_addr="10.10.10.11/24" + fi fi - vpp_eth_ip6_addr="$(ip -6 -br addr show $vpp_eth_name | awk '{print $3}')" - if [ -z "$vpp_eth_ip6_addr" ] ; then + if [ $use_ipv6 -eq 1 ] && [ -z "$vpp_eth_ip6_addr" ] ; then echo "ERROR: No inet6 address configured for $vpp_eth_name!" usage fi - vpp_args="$vpp_args plugins { path $lib64_dir/vpp_plugins } dpdk { dev $vpp_eth_pci_id }" + vpp_args="$vpp_args plugins { path ${lib64_dir}vpp_plugins } dpdk { dev $vpp_eth_pci_id }" - sudo ifdown $vpp_eth_name 2> /dev/null + sudo ifconfig $vpp_eth_name down 2> /dev/null echo "Configuring VPP to use $vpp_eth_name ($vpp_eth_pci_id), inet addr $vpp_eth_ip4_addr" cat <> $tmp_vpp_exec_file @@ -465,15 +489,15 @@ write_script_header() { echo "$bash_header" > $1 echo -e "#\n# $1 generated on $(date)\n#" >> $1 if [ $leave_tmp_files -eq 0 ] ; then - if [ -n "$multi_host" ] && [[ "$3" == VPP* ]] ; then - echo "trap \"rm -f $1 $2 $tmp_vpp_exec_file; sudo $dpdk_devbind -b $vpp_eth_kernel_driver $vpp_eth_pci_id; sudo ifup $vpp_eth_name\" $trap_signals" >> $1 + if [ -n "$multi_host" ] ; then + echo "trap \"rm -f $1 $2 $tmp_vpp_exec_file; sudo $dpdk_devbind -b $vpp_eth_kernel_driver $vpp_eth_pci_id; sudo ifconfig $vpp_eth_name up\" $trap_signals" >> $1 else echo "trap \"rm -f $1 $2 $tmp_vpp_exec_file\" $trap_signals" >> $1 fi fi echo "export VPPCOM_CONF=${vppcom_conf_dir}${vppcom_conf}" >> $1 if [ "$pre_cmd" = "$gdb_in_emacs " ] ; then - if [ -n "$multi_host" ] ; then + if [ -n "$multi_host" ] && [[ $3 =~ "VPP".* ]] ; then cat <> $1 $gdb_in_emacs() { sudo emacs --eval "(gdb \"gdb -x $2 -i=mi --args \$*\")" --eval "(setq frame-title-format \"$3\")" @@ -618,7 +642,12 @@ native_vcl() { tmp_gdb_cmdfile=$tmp_gdb_cmdfile_server gdb_cmdfile=$VPPCOM_SERVER_GDB_CMDFILE set_pre_cmd $emacs_server $gdb_server - write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "sleep 2" + if [ "$multi_host" = "server" ] ; then + delay="sleep 10" + else + delay="sleep 2" + fi + write_script_header $cmd2_file $tmp_gdb_cmdfile "$title2" "$delay" echo "export LD_LIBRARY_PATH=\"$lib64_dir:$LD_LIBRARY_PATH\"" >> $cmd2_file echo "${pre_cmd}${app_dir}${srvr_app}" >> $cmd2_file write_script_footer $cmd2_file $perf_server @@ -630,7 +659,12 @@ native_vcl() { tmp_gdb_cmdfile=$tmp_gdb_cmdfile_client gdb_cmdfile=$VPPCOM_CLIENT_GDB_CMDFILE set_pre_cmd $emacs_client $gdb_client - write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "sleep 3" + if [ "$multi_host" = "client" ] ; then + delay="sleep 10" + else + delay="sleep 2" + fi + write_script_header $cmd3_file $tmp_gdb_cmdfile "$title3" "$delay" echo "export LD_LIBRARY_PATH=\"$lib64_dir:$LD_LIBRARY_PATH\"" >> $cmd3_file echo "srvr_addr=\"$sock_srvr_addr\"" >> $cmd3_file echo "${pre_cmd}${app_dir}${clnt_app}" >> $cmd3_file