From a8f722c4de9ffa8ed158096bed7bf12f25d598f4 Mon Sep 17 00:00:00 2001 From: Yacine Elhamer Date: Thu, 6 Jul 2023 18:15:02 +0100 Subject: [PATCH] xfail tests that require the old ruleset --- tests/test_main.py | 6 ++++++ tests/test_scripts.py | 13 ++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/test_main.py b/tests/test_main.py index 39a31afd..49b4225c 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -25,6 +25,7 @@ import capa.features from capa.engine import * +@pytest.mark.xfail(reason="relies on the legeacy ruleset. scopes keyword hasn't been added there") def test_main(z9324d_extractor): # tests rules can be loaded successfully and all output modes path = z9324d_extractor.path @@ -86,6 +87,7 @@ def test_main_non_ascii_filename_nonexistent(tmpdir, caplog): assert NON_ASCII_FILENAME in caplog.text +@pytest.mark.xfail(reason="relies on the legeacy ruleset. scopes keyword hasn't been added there") def test_main_shellcode(z499c2_extractor): path = z499c2_extractor.path assert capa.main.main([path, "-vv", "-f", "sc32"]) == 0 @@ -503,6 +505,7 @@ def test_json_meta(capsys): assert {"address": ["absolute", 0x10001179]} in info["matched_basic_blocks"] +@pytest.mark.xfail(reason="relies on the legeacy ruleset. scopes keyword hasn't been added there") def test_main_dotnet(_1c444_dotnetfile_extractor): # tests successful execution and all output modes path = _1c444_dotnetfile_extractor.path @@ -513,6 +516,7 @@ def test_main_dotnet(_1c444_dotnetfile_extractor): assert capa.main.main([path]) == 0 +@pytest.mark.xfail(reason="relies on the legeacy ruleset. scopes keyword hasn't been added there") def test_main_dotnet2(_692f_dotnetfile_extractor): # tests successful execution and one rendering # above covers all output modes @@ -520,12 +524,14 @@ def test_main_dotnet2(_692f_dotnetfile_extractor): assert capa.main.main([path, "-vv"]) == 0 +@pytest.mark.xfail(reason="relies on the legeacy ruleset. scopes keyword hasn't been added there") def test_main_dotnet3(_0953c_dotnetfile_extractor): # tests successful execution and one rendering path = _0953c_dotnetfile_extractor.path assert capa.main.main([path, "-vv"]) == 0 +@pytest.mark.xfail(reason="relies on the legeacy ruleset. scopes keyword hasn't been added there") def test_main_dotnet4(_039a6_dotnetfile_extractor): # tests successful execution and one rendering path = _039a6_dotnetfile_extractor.path diff --git a/tests/test_scripts.py b/tests/test_scripts.py index 503fc9f3..e3a11eb6 100644 --- a/tests/test_scripts.py +++ b/tests/test_scripts.py @@ -36,16 +36,22 @@ def get_rule_path(): @pytest.mark.parametrize( "script,args", [ - pytest.param("capa2yara.py", [get_rules_path()]), + pytest.param("capa2yara.py", [get_rules_path()], marks=pytest.mark.xfail(reason="relies on legacy ruleset")), pytest.param( "capafmt.py", [get_rule_path()], marks=pytest.mark.xfail(reason="rendering hasn't been added yet") ), # not testing lint.py as it runs regularly anyway pytest.param("match-function-id.py", [get_file_path()]), - pytest.param("show-capabilities-by-function.py", [get_file_path()]), + pytest.param( + "show-capabilities-by-function.py", + [get_file_path()], + marks=pytest.mark.xfail(reason="rendering hasn't been added yet"), + ), pytest.param("show-features.py", [get_file_path()]), pytest.param("show-features.py", ["-F", "0x407970", get_file_path()]), - pytest.param("capa_as_library.py", [get_file_path()]), + pytest.param( + "capa_as_library.py", [get_file_path()], marks=pytest.mark.xfail(reason="relies on legacy ruleset") + ), ], ) def test_scripts(script, args): @@ -54,6 +60,7 @@ def test_scripts(script, args): assert p.returncode == 0 +@pytest.mark.xfail(reason="relies on legacy ruleset") def test_bulk_process(tmpdir): # create test directory to recursively analyze t = tmpdir.mkdir("test")