mirror of
https://github.com/trailofbits/buttercup
synced 2026-06-21 14:11:39 +00:00
dd7c9c21e7
* Uncomment skipped tests * Codequery was already working for bouncycastle. * Add support for copying src after build
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
"""CodeQuery primitives testing"""
|
|
|
|
import pytest
|
|
|
|
from buttercup.common.challenge_task import ChallengeTask
|
|
from ..conftest import oss_fuzz_task
|
|
from ..common import (
|
|
common_test_get_functions,
|
|
TestFunctionInfo,
|
|
)
|
|
|
|
|
|
@pytest.fixture(scope="module")
|
|
def bc_oss_fuzz_task(tmp_path_factory: pytest.TempPathFactory):
|
|
return oss_fuzz_task(
|
|
tmp_path_factory.mktemp("task_dir"),
|
|
"bc-java",
|
|
"bc-java",
|
|
"https://github.com/bcgit/bc-java",
|
|
"8b4326f24738ad6f6ab360089436a8a93c6a5424",
|
|
)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"function_name,file_path,function_info",
|
|
[
|
|
(
|
|
"doGenerate",
|
|
"/src/bc-java/pkix/src/main/java/org/bouncycastle/cms/CMSAuthEnvelopedDataGenerator.java",
|
|
TestFunctionInfo(
|
|
num_bodies=1,
|
|
body_excerpts=[
|
|
"""authenticatedAttrSet = CMSUtils.processAuthAttrSet(authAttrsGenerator, contentEncryptor);""",
|
|
],
|
|
),
|
|
),
|
|
],
|
|
)
|
|
@pytest.mark.integration
|
|
def test_bc_get_functions(
|
|
bc_oss_fuzz_task: ChallengeTask, function_name, file_path, function_info
|
|
):
|
|
"""Test that we can get functions in challenge task code"""
|
|
common_test_get_functions(bc_oss_fuzz_task, function_name, file_path, function_info)
|