Skip to content

Commit

Permalink
Improve tests coverage by testing for bad arguments and the error out…
Browse files Browse the repository at this point in the history
…put during a failed compilation
  • Loading branch information
cosminc98 committed Jan 23, 2024
1 parent 65eca38 commit 6236fe2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 6236fe2

Please sign in to comment.