ci/lava: Distinguish test suites in DUT vs Docker

Test suite in the dut is just running SSH server and waiting for the
docker container to start the SSH session. So it can take all the test
cases accumulated duration, not just the init-stage1.sh part anymore.

Signed-off-by: Guilherme Gallo <guilherme.gallo@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22870>
This commit is contained in:
Guilherme Gallo 2023-04-27 18:48:53 -03:00 committed by Marge Bot
parent 8626a52637
commit 2cee21ffa5
2 changed files with 39 additions and 8 deletions

View file

@ -11,6 +11,7 @@ from lava.utils.gitlab_section import GitlabSection
class LogSectionType(Enum):
UNKNOWN = auto()
LAVA_BOOT = auto()
TEST_DUT_SUITE = auto()
TEST_SUITE = auto()
TEST_CASE = auto()
LAVA_POST_PROCESSING = auto()
@ -24,7 +25,11 @@ class LogSectionType(Enum):
# the enqueue delay.
LAVA_BOOT_TIMEOUT = int(getenv("LAVA_BOOT_TIMEOUT", 9))
# Test suite phase is where the initialization happens.
# Test DUT suite phase is where the initialization happens in DUT, not on docker.
# The device will be listening to SSH session until the end of the job.
LAVA_TEST_DUT_SUITE_TIMEOUT = int(getenv("JOB_TIMEOUT", 60))
# Test suite phase is where the initialization happens on docker.
LAVA_TEST_SUITE_TIMEOUT = int(getenv("LAVA_TEST_SUITE_TIMEOUT", 5))
# Test cases may take a long time, this script has no right to interrupt
@ -39,6 +44,7 @@ LAVA_POST_PROCESSING_TIMEOUT = int(getenv("LAVA_POST_PROCESSING_TIMEOUT", 5))
FALLBACK_GITLAB_SECTION_TIMEOUT = timedelta(minutes=10)
DEFAULT_GITLAB_SECTION_TIMEOUTS = {
LogSectionType.LAVA_BOOT: timedelta(minutes=LAVA_BOOT_TIMEOUT),
LogSectionType.TEST_DUT_SUITE: timedelta(minutes=LAVA_TEST_DUT_SUITE_TIMEOUT),
LogSectionType.TEST_SUITE: timedelta(minutes=LAVA_TEST_SUITE_TIMEOUT),
LogSectionType.TEST_CASE: timedelta(minutes=LAVA_TEST_CASE_TIMEOUT),
LogSectionType.LAVA_POST_PROCESSING: timedelta(
@ -83,10 +89,17 @@ LOG_SECTIONS = (
section_type=LogSectionType.TEST_CASE,
),
LogSection(
regex=re.compile(r"<?STARTRUN>? ([^>]*)"),
levels=("target", "debug"),
regex=re.compile(r"<?STARTRUN>? ([^>]*ssh.*server.*)"),
levels=("debug"),
section_id="{}",
section_header="test_suite {}",
section_header="[dut] test_suite {}",
section_type=LogSectionType.TEST_DUT_SUITE,
),
LogSection(
regex=re.compile(r"<?STARTRUN>? ([^>]*)"),
levels=("debug"),
section_id="{}",
section_header="[docker] test_suite {}",
section_type=LogSectionType.TEST_SUITE,
),
LogSection(

View file

@ -62,6 +62,11 @@ def test_gitlab_section(method, collapsed, expectation):
def test_gl_sections():
lines = [
{
"dt": datetime.now(),
"lvl": "debug",
"msg": "Received signal: <STARTRUN> 0_setup-ssh-server 10145749_1.3.2.3.1",
},
{
"dt": datetime.now(),
"lvl": "debug",
@ -92,10 +97,13 @@ def test_gl_sections():
},
]
lf = LogFollower()
for line in lines:
lf.manage_gl_sections(line)
with lf:
for line in lines:
lf.manage_gl_sections(line)
parsed_lines = lf.flush()
section_types = [s.type for s in lf.section_history]
parsed_lines = lf.flush()
assert "section_start" in parsed_lines[0]
assert "collapsed=true" not in parsed_lines[0]
assert "section_end" in parsed_lines[1]
@ -103,7 +111,17 @@ def test_gl_sections():
assert "collapsed=true" not in parsed_lines[2]
assert "section_end" in parsed_lines[3]
assert "section_start" in parsed_lines[4]
assert "collapsed=true" in parsed_lines[4]
assert "collapsed=true" not in parsed_lines[4]
assert "section_end" in parsed_lines[5]
assert "section_start" in parsed_lines[6]
assert "collapsed=true" in parsed_lines[6]
assert section_types == [
# LogSectionType.LAVA_BOOT, True, if LogFollower started with Boot section
LogSectionType.TEST_DUT_SUITE,
LogSectionType.TEST_SUITE,
LogSectionType.TEST_CASE,
LogSectionType.LAVA_POST_PROCESSING,
]
def test_log_follower_flush():