You've already forked ada_language_server
mirror of
https://github.com/AdaCore/ada_language_server.git
synced 2026-02-12 12:45:50 -08:00
* Enable test result uploading on errors. * Fix python test driver for tester-run. Exit status of `tester-run` is non-zero on failures and zero on pass. * Put `tester-run` output into the log to get it in JUnit XML.
53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
import glob
|
|
import os
|
|
|
|
from e3.testsuite.result import TestStatus
|
|
|
|
from drivers import ALSTestDriver
|
|
|
|
|
|
class JsonTestDriver(ALSTestDriver):
|
|
""" Each test should have:
|
|
- a test.yaml containing
|
|
title: '<test name>'
|
|
|
|
- a number of test drivers, in .json files.
|
|
"""
|
|
|
|
def run(self, previous_values, slot):
|
|
# Check whether the test should be skipped
|
|
if self.should_skip():
|
|
return False
|
|
|
|
# The working directory
|
|
wd = self.test_env["working_dir"]
|
|
|
|
output = ""
|
|
|
|
status = TestStatus.PASS
|
|
|
|
for json in glob.glob(os.path.join(wd, "*.json")):
|
|
process = self.run_and_log(
|
|
[self.env.tester_run, json],
|
|
cwd=wd,
|
|
env={
|
|
"ALS": self.env.als,
|
|
"ALS_HOME": self.env.als_home,
|
|
"ALS_WAIT_FACTOR": str(self.env.wait_factor),
|
|
},
|
|
ignore_environ=False,
|
|
)
|
|
output += process.out
|
|
|
|
if process.status:
|
|
# Nonzero status?
|
|
status = TestStatus.FAIL
|
|
break
|
|
|
|
self.result.set_status(status)
|
|
if output:
|
|
# If there's an output, capture it as log
|
|
self.result.log = output
|
|
|
|
self.push_result()
|