1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-31 17:18:04 +03:00

Improve cargo test output

Signed-off-by: David Mulder <dmulder@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
This commit is contained in:
David Mulder 2024-08-13 15:06:42 -06:00
parent 7140c506ee
commit 8298cf4376

View File

@ -20,11 +20,12 @@
"""Cargo tests for Rust sources"""
from samba.tests import BlackboxTestCase
from samba.tests import TestCase, BlackboxProcessError
import os
from subprocess import Popen, PIPE
class RustCargoTests(BlackboxTestCase):
class RustCargoTests(TestCase):
def setUp(self):
super().setUp()
@ -52,7 +53,16 @@ class RustCargoTests(BlackboxTestCase):
def check_cargo_test(self, crate_toml):
# Execute the cargo test command
cmd = 'cargo test --target-dir=%s --manifest-path=%s' % (self.target_dir, crate_toml)
return self.check_run(cmd, 'cargo test failed')
p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
stdoutdata, stderrdata = p.communicate()
retcode = p.returncode
if retcode != 0:
msg = "cargo test failed; return code %s" % retcode
raise BlackboxProcessError(retcode,
cmd,
stdoutdata.decode('utf-8'),
stderrdata.decode('utf-8'),
msg)
def test_rust(self):
crates = []