aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extras/vcl-ldpreload/env.sh1
-rwxr-xr-xextras/vcl-ldpreload/test/common/nginx_test.sh2
-rwxr-xr-xextras/vcl-ldpreload/test/emacs_gdb_curl.sh33
-rwxr-xr-xextras/vcl-ldpreload/test/emacs_gdb_vpp.sh23
4 files changed, 59 insertions, 0 deletions
diff --git a/extras/vcl-ldpreload/env.sh b/extras/vcl-ldpreload/env.sh
index b0df547dbd2..eb8aab801b0 100644
--- a/extras/vcl-ldpreload/env.sh
+++ b/extras/vcl-ldpreload/env.sh
@@ -1,3 +1,4 @@
export VPP_DIR=$WS_ROOT
export LDP_DIR=$WS_ROOT/extras/vcl-ldpreload
+export LDP_TEST_DIR=$LDP_DIR/test
export VCL_LDPRELOAD_LIB_DIR=$LDP_DIR/src/.libs
diff --git a/extras/vcl-ldpreload/test/common/nginx_test.sh b/extras/vcl-ldpreload/test/common/nginx_test.sh
index 7c43324dbc8..3875d9f579a 100755
--- a/extras/vcl-ldpreload/test/common/nginx_test.sh
+++ b/extras/vcl-ldpreload/test/common/nginx_test.sh
@@ -53,7 +53,9 @@ if [ -z "$(docker ps -qf name=$vpp_dk_name)" ] ; then
sudo ip link del dev vpp_dk
sudo ip link add name vpp_dk type veth peer name vpp1
sudo ip link set dev vpp_dk up
+ sudo ethtool --offload vpp_dk rx off tx off
sudo ip link set dev vpp1 up
+ sudo ethtool --offload vpp1 rx off tx off
sudo ip link set dev lo up
sudo brctl addif docker0 vpp_dk
fi
diff --git a/extras/vcl-ldpreload/test/emacs_gdb_curl.sh b/extras/vcl-ldpreload/test/emacs_gdb_curl.sh
new file mode 100755
index 00000000000..a5d6be3dfee
--- /dev/null
+++ b/extras/vcl-ldpreload/test/emacs_gdb_curl.sh
@@ -0,0 +1,33 @@
+#! /bin/bash
+
+if [ -z "$WS_ROOT" ] ; then
+ echo "ERROR: WS_ROOT environment variable is not set!"
+ exit 1
+fi
+
+source $WS_ROOT/extras/vcl-ldpreload/env.sh
+tmp_gdb_cmdfile="/tmp/gdb_cmdfile_curl.$$"
+
+trap "rm -f $tmp_gdb_cmdfile" SIGINT SIGTERM EXIT
+
+cat <<EOF > $tmp_gdb_cmdfile
+set confirm off
+source $WS_ROOT/extras/gdb/gdb_cmdfile.vpp
+set exec-wrapper env LD_PRELOAD=$VCL_LDPRELOAD_LIB_DIR/libvcl_ldpreload.so.0.0.0
+start
+EOF
+
+gdb_in_emacs() {
+ sudo -E emacs --eval "(gdb \"gdb -x $tmp_gdb_cmdfile -i=mi --args $*\")" --eval "(setq frame-title-format \"CURL-DEBUG (VCL-LDPRELOAD)\")"
+}
+
+# Extract nginx IPv4 address from docker bridge
+#
+nginx_addr=$(docker network inspect bridge | grep IPv4Address | awk -e '{print $2}' | sed -e 's,/16,,' -e 's,",,g' -e 's/,//')
+
+if [ -z "$nginx_addr" ] ; then
+ echo "ERROR: Unable to determine docker container address!"
+ exit 1
+fi
+
+gdb_in_emacs /usr/bin/curl http://$nginx_addr
diff --git a/extras/vcl-ldpreload/test/emacs_gdb_vpp.sh b/extras/vcl-ldpreload/test/emacs_gdb_vpp.sh
new file mode 100755
index 00000000000..460e4077e53
--- /dev/null
+++ b/extras/vcl-ldpreload/test/emacs_gdb_vpp.sh
@@ -0,0 +1,23 @@
+#! /bin/bash
+
+if [ -z "$WS_ROOT" ] ; then
+ echo "ERROR: WS_ROOT environment variable is not set!"
+ exit 1
+fi
+
+source $WS_ROOT/extras/vcl-ldpreload/env.sh
+tmp_gdb_cmdfile="/tmp/gdb_cmdfile_vpp.$$"
+
+trap "rm -f $tmp_gdb_cmdfile" SIGINT SIGTERM EXIT
+
+cat <<EOF > $tmp_gdb_cmdfile
+set confirm off
+source $WS_ROOT/extras/gdb/gdb_cmdfile.vpp
+start
+EOF
+
+gdb_in_emacs() {
+ sudo -E emacs --eval "(gdb \"gdb -x $tmp_gdb_cmdfile -i=mi --args $*\")" --eval "(setq frame-title-format \"VPP-DEBUG\")"
+}
+sudo rm -f /dev/shm/*
+gdb_in_emacs $WS_ROOT/build-root/install-vpp_debug-native/vpp/bin/vpp unix { interactive exec $LDP_TEST_DIR/common/vpp_docker.conf } api-segment { gid $(id -g) }