Merge pull request #14950 from apolcyn/log_stuff

Fix c-ares tests under gcc musl
diff --git a/templates/test/cpp/naming/resolver_component_tests_defs.include b/templates/test/cpp/naming/resolver_component_tests_defs.include
index 01e1860..c29b466 100644
--- a/templates/test/cpp/naming/resolver_component_tests_defs.include
+++ b/templates/test/cpp/naming/resolver_component_tests_defs.include
@@ -36,7 +36,8 @@
 fi
 export GRPC_DNS_RESOLVER=ares
 
-"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_dns_server_port" > /dev/null 2>&1 &
+DNS_SERVER_LOG="$(mktemp)"
+"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_dns_server_port" > "$DNS_SERVER_LOG" 2>&1 &
 DNS_SERVER_PID=$!
 echo "Local DNS server started. PID: $DNS_SERVER_PID"
 
@@ -55,8 +56,11 @@
 
 if [[ $RETRY == 1 ]]; then
   echo "FAILED TO START LOCAL DNS SERVER"
-  kill -SIGTERM "$DNS_SERVER_PID"
+  kill -SIGTERM "$DNS_SERVER_PID" || true
   wait
+  echo "========== DNS server log (merged stdout and stderr) ========="
+  cat "$DNS_SERVER_LOG"
+  echo "========== end DNS server log ================================"
   exit 1
 fi
 
diff --git a/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template b/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template
index 1bbfdfd..57d0986 100644
--- a/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template
+++ b/templates/tools/dockerfile/test/cxx_alpine_x64/Dockerfile.template
@@ -34,6 +34,7 @@
     strace ${'\\'}
     python-dev ${'\\'}
     py-pip ${'\\'}
+    py-yaml ${'\\'}
     unzip ${'\\'}
     wget ${'\\'}
     zip
diff --git a/test/cpp/naming/resolver_component_tests_runner.sh b/test/cpp/naming/resolver_component_tests_runner.sh
index 18b56ab..3f8765f 100755
--- a/test/cpp/naming/resolver_component_tests_runner.sh
+++ b/test/cpp/naming/resolver_component_tests_runner.sh
@@ -36,7 +36,8 @@
 fi
 export GRPC_DNS_RESOLVER=ares
 
-"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_dns_server_port" > /dev/null 2>&1 &
+DNS_SERVER_LOG="$(mktemp)"
+"$FLAGS_dns_server_bin_path" --records_config_path="$FLAGS_records_config_path" --port="$FLAGS_dns_server_port" > "$DNS_SERVER_LOG" 2>&1 &
 DNS_SERVER_PID=$!
 echo "Local DNS server started. PID: $DNS_SERVER_PID"
 
@@ -55,8 +56,11 @@
 
 if [[ $RETRY == 1 ]]; then
   echo "FAILED TO START LOCAL DNS SERVER"
-  kill -SIGTERM "$DNS_SERVER_PID"
+  kill -SIGTERM "$DNS_SERVER_PID" || true
   wait
+  echo "========== DNS server log (merged stdout and stderr) ========="
+  cat "$DNS_SERVER_LOG"
+  echo "========== end DNS server log ================================"
   exit 1
 fi
 
diff --git a/tools/dockerfile/test/cxx_alpine_x64/Dockerfile b/tools/dockerfile/test/cxx_alpine_x64/Dockerfile
index c68a5dd..72bd4b3 100644
--- a/tools/dockerfile/test/cxx_alpine_x64/Dockerfile
+++ b/tools/dockerfile/test/cxx_alpine_x64/Dockerfile
@@ -32,6 +32,7 @@
   strace \
   python-dev \
   py-pip \
+  py-yaml \
   unzip \
   wget \
   zip