tests: fix core file message

Prevent crashing on nonexistent VPP binary path class member when creating
testsuite core message.

Type: fix
Fixes: b23ffd7ef216463c35b75c831e6a27e58971f4ec
Signed-off-by: Dmitry Valter <d-valter@yandex-team.ru>
Change-Id: Ib9b3dc8c69317e6561e5404bbdcbf672e417cbcd
diff --git a/test/hook.py b/test/hook.py
index 7f7a7c3..8033c93 100644
--- a/test/hook.py
+++ b/test/hook.py
@@ -6,6 +6,7 @@
 
 import scapy.compat
 import framework
+from config import config
 from log import RED, single_line_delim, double_line_delim
 from util import check_core_path, get_core_path
 
@@ -79,7 +80,7 @@
 
     def on_crash(self, core_path):
         self.logger.error("Core file present, debug with: gdb %s %s",
-                          self.test.vpp_bin, core_path)
+                          config.vpp, core_path)
         check_core_path(self.logger, core_path)
         self.logger.error("Running `file %s':", core_path)
         try:
diff --git a/test/run_tests.py b/test/run_tests.py
index 1d194ad..7209ddf 100644
--- a/test/run_tests.py
+++ b/test/run_tests.py
@@ -239,7 +239,7 @@
             read_testcase = None
 
 
-def handle_failed_suite(logger, last_test_temp_dir, vpp_pid):
+def handle_failed_suite(logger, last_test_temp_dir, vpp_pid, vpp_binary):
     if last_test_temp_dir:
         # Need to create link in case of a timeout or core dump without failure
         lttd = os.path.basename(last_test_temp_dir)
@@ -273,7 +273,7 @@
             except Exception as e:
                 logger.exception("Unexpected error running `file' utility "
                                  "on core-file")
-            logger.error(f"gdb {config.vpp_bin} {core_path}")
+            logger.error(f"gdb {vpp_binary} {core_path}")
 
     if vpp_pid:
         # Copy api post mortem
@@ -319,7 +319,8 @@
         failed_wrapped_testcases.add(wrapped_testcase_suite)
         handle_failed_suite(wrapped_testcase_suite.logger,
                             wrapped_testcase_suite.last_test_temp_dir,
-                            wrapped_testcase_suite.vpp_pid)
+                            wrapped_testcase_suite.vpp_pid,
+                            wrapped_testcase_suite.last_test_vpp_binary,)
 
     return stop_run
 
diff --git a/test/test_vlib.py b/test/test_vlib.py
index 1d5a3eb..242acab 100644
--- a/test/test_vlib.py
+++ b/test/test_vlib.py
@@ -187,7 +187,7 @@
     def test_vlib_main_unittest(self):
         """ Private Binary API Segment Test (takes 70 seconds) """
 
-        vat_path = self.vpp_bin + '_api_test'
+        vat_path = config.vpp + '_api_test'
         vat = pexpect.spawn(vat_path, ['socket-name',
                                        self.get_api_sock_path()])
         vat.expect("vat# ", timeout=10)