tests: fix default failed dir setting
When running tests via run.sh, default setting of None would cause
failed directory symlink to appear in vpp workspace with an ugly name.
This patch places the symlink in temporary directory.
Type: fix
Fixes: b23ffd7ef2
Signed-off-by: Klement Sekera <klement.sekera@gmail.com>
Change-Id: Ic1715eba7ac1f82f71855e2aeb9b659d27bbb3af
This commit is contained in:

committed by
Dave Wallace

parent
0bfc222e3d
commit
152a9b6165
@ -1,7 +1,6 @@
|
||||
import argparse
|
||||
import os
|
||||
import psutil
|
||||
import textwrap
|
||||
import time
|
||||
|
||||
|
||||
@ -119,7 +118,7 @@ parser.add_argument(
|
||||
"--failed-dir",
|
||||
action="store",
|
||||
type=directory,
|
||||
help="directory containing failed tests",
|
||||
help="directory containing failed tests (default: --tmp-dir)",
|
||||
)
|
||||
|
||||
filter_help_string = """\
|
||||
@ -357,8 +356,7 @@ parser.add_argument(
|
||||
"--keep-pcaps",
|
||||
action="store_true",
|
||||
default=default_keep_pcaps,
|
||||
help="if set, keep all pcap files from a test run"
|
||||
f" (default: {default_keep_pcaps})",
|
||||
help=f"if set, keep all pcap files from a test run (default: {default_keep_pcaps})",
|
||||
)
|
||||
|
||||
config = parser.parse_args()
|
||||
@ -399,6 +397,9 @@ config.test_src_dir = test_dirs
|
||||
if config.venv_dir is None:
|
||||
config.venv_dir = f"{ws}/test/venv"
|
||||
|
||||
if config.failed_dir is None:
|
||||
config.failed_dir = f"{config.tmp_dir}"
|
||||
|
||||
available_cpus = psutil.Process().cpu_affinity()
|
||||
num_cpus = len(available_cpus)
|
||||
|
||||
|
@ -5,7 +5,6 @@ import shutil
|
||||
import os
|
||||
import fnmatch
|
||||
import unittest
|
||||
import argparse
|
||||
import time
|
||||
import threading
|
||||
import traceback
|
||||
@ -14,7 +13,6 @@ import re
|
||||
from multiprocessing import Process, Pipe, get_context
|
||||
from multiprocessing.queues import Queue
|
||||
from multiprocessing.managers import BaseManager
|
||||
import framework
|
||||
from config import config, num_cpus, available_cpus, max_vpp_cpus
|
||||
from framework import (
|
||||
VppTestRunner,
|
||||
@ -28,7 +26,7 @@ from framework import (
|
||||
TEST_RUN,
|
||||
SKIP_CPU_SHORTAGE,
|
||||
)
|
||||
from debug import spawn_gdb, start_vpp_in_gdb
|
||||
from debug import spawn_gdb
|
||||
from log import (
|
||||
get_parallel_logger,
|
||||
double_line_delim,
|
||||
@ -269,7 +267,7 @@ 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)
|
||||
link_path = "%s%s-FAILED" % (config.failed_dir, lttd)
|
||||
link_path = os.path.join(config.failed_dir, f"{lttd}-FAILED")
|
||||
if not os.path.exists(link_path):
|
||||
os.symlink(last_test_temp_dir, link_path)
|
||||
logger.error(
|
||||
|
Reference in New Issue
Block a user