Improve tests coverage by testing for bad arguments and the error output during a failed compilation

This commit is contained in:
Cosmin Ștefan Ciocan
2024-01-23 23:44:36 +00:00
parent 65eca38a67
commit 6236fe2b1e
+21
View File
@@ -103,6 +103,17 @@ def test_compile_args(
with pytest.raises(subprocess.CalledProcessError):
exec_fpath = plugin._compile(gname, compiler_args="--std c++14")
output = plugin._compile_and_run(
group_name=gname,
args=argparse.Namespace(
timeit=False,
profile=True,
profiler_args="",
compiler_args="--std c++14",
),
)
assert "errors detected in the compilation of" in output
def test_run(
plugin: NVCCPlugin,
@@ -213,6 +224,16 @@ def test_magic_cuda(
check_profiler_output(capsys.readouterr().out)
def test_magic_cuda_bad_args(
capsys,
plugin: NVCCPlugin,
sample_cuda_code: str,
):
plugin.cuda("--this-is-an-unrecognized-argument", sample_cuda_code)
output = capsys.readouterr().out
assert output.startswith("usage: ")
def test_magic_cuda_group_save(plugin: NVCCPlugin, sample_cuda_code: str):
gname = "test_save_source"
sname = "sample.cu"