Skip to content

Commit 88e5b2d

Browse files
committed
Merge branch 'topic/als-ts' into 'master'
Migrate to ClassicTestDriver See merge request eng/ide/ada_language_server!1751
2 parents 6e3282a + c69885c commit 88e5b2d

File tree

23 files changed

+66
-136
lines changed

23 files changed

+66
-136
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ include:
2727
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
2828
inputs:
2929
job-name: als-cov
30-
anod-args: run test_als_cov_$ACI_TRACK
30+
anod-args: run test_als_cov_$ACI_TRACK --latest
3131
image: systemgtk
3232
# This job needs to rebuild ALS in coverage mode, so it doesn't need to
3333
# depend on the build job. The following will get it to run in parallel

testsuite/ada_lsp/F131-024.xrefs.separate_body/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ title: 'F131-024.xrefs.separate_body'
22

33
# This test is expected to fail until eng/libadalang/libadalang#1409
44
# is fixed.
5-
skip:
5+
control:
66
- ['XFAIL', 'True']
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
title: 'U910-043.client_capabilities.optional'
22
# Skip till 3.17 ready
3-
skip:
3+
control:
44
- ['XFAIL', 'True']
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
title: 'UA28-007.Did_Change_Watched_Files_0'
2-
skip:
2+
control:
33
- ['SKIP', 'env.build.os.name == "windows"']
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
title: 'UA28-007.Did_Delete_Files_0'
2-
skip:
2+
control:
33
- ['SKIP', 'env.build.os.name == "windows"']

testsuite/ada_lsp/called_by_dispatching/test.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
"""test that callHierarchy/incomingCalls works for dispatching calls"""
22

3-
from drivers.lsp_python_driver import simple_test
4-
from drivers.lsp_ada_requests import didOpen_from_disk, prepareCallHierarchy, incomingCalls
5-
from drivers.lsp_types import LSPMessage, URI
63
import os
74

5+
from drivers.lsp_ada_requests import (
6+
didOpen_from_disk,
7+
incomingCalls,
8+
prepareCallHierarchy,
9+
)
10+
from drivers.lsp_python_driver import simple_test
11+
812

913
@simple_test
1014
def test_called_by(lsp, wd):
@@ -19,7 +23,7 @@ def test_called_by(lsp, wd):
1923
response = lsp.send(prepareCallHierarchy(main_adb, 7, 4))
2024

2125
# Expect these locations
22-
response.assertLocationsList([("root.ads",5)])
26+
response.assertLocationsList([("root.ads", 5)])
2327

2428
# Now send the callHierarchy/incomingCalls request
2529
response = lsp.send(incomingCalls(root_ads, 5, 14))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
title: 'completion.invisible.runtime'
22
# Test only on Linux, since runtime source locations can be
33
# different depending on the platform
4-
skip:
4+
control:
55
- ['SKIP', 'env.build.os.name != "linux"']
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
title: 'project_config.alire'
2-
skip:
2+
control:
33
- ['SKIP', 'env.build.os.name == "windows"']
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
title: 'project_symlinks'
2-
skip:
2+
control:
33
- ['SKIP', 'env.build.os.name == "windows"']

testsuite/drivers/__init__.py

Lines changed: 25 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,34 @@
1-
import logging
21
import os
3-
import traceback
42

5-
from e3.fs import sync_tree
63
from e3.os.fs import df
74
from e3.os.process import Run
8-
from e3.testsuite.driver import TestDriver
9-
from e3.testsuite.result import Log, TestStatus
5+
from e3.testsuite.control import TestControlCreator, YAMLTestControlCreator
6+
from e3.testsuite.driver.classic import ClassicTestDriver, ProcessResult
7+
from e3.testsuite.result import Log
108

11-
from drivers.gnatcov import GNATcov
12-
13-
14-
TESTSUITE_ROOT_DIR = os.path.dirname(
15-
os.path.dirname(os.path.abspath(__file__)))
9+
TESTSUITE_ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
1610

1711
PACKAGE_ROOT_DIR = os.path.dirname(TESTSUITE_ROOT_DIR)
1812

1913

20-
class ALSTestDriver(TestDriver):
14+
class ALSTestDriver(ClassicTestDriver):
2115
"""Abstract class to share some common facilities."""
2216

23-
def add_test(self, dag):
24-
"""
25-
Default workflow for testcases.
17+
@property
18+
def test_control_creator(self) -> TestControlCreator:
19+
eval_env = {
20+
"env": self.env,
21+
"test_env": self.test_env,
22+
"disk_space": lambda: df(self.env.working_dir),
23+
}
2624

27-
Subclasses are free to override this if they need anything more
28-
complicated.
29-
"""
30-
self.add_fragment(dag, 'prepare')
31-
self.add_fragment(dag, 'run', after=['prepare'])
25+
return YAMLTestControlCreator(eval_env)
3226

33-
def prepare(self, previous_values, slot):
34-
"""
35-
Create the working directory to be a copy of the test directory.
36-
"""
37-
sync_tree(self.test_env['test_dir'],
38-
self.test_env['working_dir'])
39-
40-
def should_skip(self):
41-
"""Handle of 'skip' in test.yaml.
27+
def shell(self, *args, **kwargs) -> ProcessResult:
28+
if self.env.gnatcov:
29+
kwargs = self.env.gnatcov.decorate_run(self, kwargs)
4230

43-
If the test should be skipped according to test.yaml, push the result
44-
and return True. Otherwise, just return false.
45-
"""
46-
status = None
47-
if 'skip' in self.test_env:
48-
eval_env = {
49-
'env': self.env,
50-
'test_env': self.test_env,
51-
'disk_space': lambda: df(self.env.working_dir)}
52-
53-
for candidate_status, expr in self.test_env['skip']:
54-
try:
55-
if eval(expr, eval_env):
56-
status = TestStatus[candidate_status]
57-
break
58-
except Exception:
59-
logging.error(traceback.format_exc())
60-
status = TestStatus.ERROR
61-
break
62-
63-
if status is None:
64-
return False
65-
else:
66-
self.result.set_status(status)
67-
self.push_result()
68-
return True
31+
return super().shell(*args, **kwargs)
6932

7033
def run_and_log(self, cmd, **kwargs):
7134
"""
@@ -83,11 +46,14 @@ def run_and_log(self, cmd, **kwargs):
8346

8447
process = Run(cmd, **kwargs)
8548

86-
self.result.processes.append({
87-
'cmd': cmd,
88-
'run_args': kwargs,
89-
'status': process.status,
90-
'output': Log(process.out)})
49+
self.result.processes.append(
50+
{
51+
"cmd": cmd,
52+
"run_args": kwargs,
53+
"status": process.status,
54+
"output": Log(process.out),
55+
}
56+
)
9157

9258
if "Log:" in process.out:
9359
output, log = process.out.split("Log:")

0 commit comments

Comments
 (0)