Skip to content

Commit cc259b5

Browse files
committed
Merge branch 'topic/avoid-jq' into 'master'
Avoid dependency on jq in testing See merge request eng/ide/ada_language_server!1208
2 parents 9804aca + 8a72a95 commit cc259b5

File tree

6 files changed

+29
-11
lines changed

6 files changed

+29
-11
lines changed

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"ada.projectFile": "gnat/lsp_server.gpr"
2+
"ada.projectFile": "gnat/lsp_server.gpr",
3+
"python.analysis.extraPaths": [
4+
"testsuite"
5+
]
36
}

testsuite/drivers/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ def run_and_log(self, cmd, **kwargs):
8989
'status': process.status,
9090
'output': Log(process.out)})
9191

92+
cwd = kwargs.get("cwd", os.getcwd())
93+
self.result.log += f"Run: cd {cwd}; {process.command_line_image()}\n"
94+
self.result.log += f"Status code: {process.status}\n"
95+
self.result.log += "Output:\n"
96+
self.result.log += process.out
97+
9298
if self.result.out is None:
9399
self.result.out = process.out
94100
else:

testsuite/drivers/shell.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import os.path
2-
31
from e3.testsuite.result import TestStatus
2+
from e3.testsuite.process import check_call
43

54
from drivers import ALSTestDriver
65

@@ -16,10 +15,13 @@ def run(self, previous_values, slot):
1615
if self.should_skip():
1716
return False
1817

19-
index = os.path.abspath(os.path.join(self.test_env["test_dir"], "index.txt"))
20-
test_sh = os.path.join(self.env.repo_base, 'testsuite', 'shell', 'test.sh')
21-
p = self.run_and_log([test_sh, self.env.repo_base], cwd=self.env.working_dir)
22-
self.result.out += p.out
18+
# This takes care of failing the test in case the return code is
19+
# non-zero
20+
check_call(
21+
self,
22+
[self.working_dir("test.sh"), self.env.repo_base],
23+
parse_shebang=True
24+
)
2325

24-
self.result.set_status(TestStatus.PASS if p.status == 0 else TestStatus.FAIL)
26+
self.result.set_status(TestStatus.PASS)
2527
self.push_result()

testsuite/run-tests

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env python
22
import testsuite
33
import os
4-
import yaml
54
import sys
65

76
if __name__ == '__main__':
@@ -16,7 +15,9 @@ if __name__ == '__main__':
1615
if status not in ('PASS', 'XFAIL'):
1716
all_ok = False
1817
print("--- {} : {} ---".format(k, status))
19-
print(entry.load().out)
18+
test_result = entry.load()
19+
print(f"Output:\n{test_result.out}")
20+
print(f"Log:\n{test_result.log}")
2021

2122
if all_ok:
2223
print("SUCCESS")
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import sys
2+
import json
3+
4+
pkg = json.load(sys.stdin)
5+
settings = pkg["contributes"]["configuration"][0]["properties"].keys()
6+
print("\n".join(settings))

testsuite/shell/test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
2-
jq -r '.contributes.configuration[].properties|keys[]' < $1/integration/vscode/ada/package.json | grep ^ada. > pkg.txt
2+
python3 get-extension-settings.py < $1/integration/vscode/ada/package.json | grep ^ada. | sort > pkg.txt
33
grep '^## ' $1/doc/settings.md |sed -e 's/.../ada./' | sort > doc.txt
44
diff -u pkg.txt doc.txt

0 commit comments

Comments
 (0)