コード例 #1
0
def test_initialize_env_in_environment_with_sanitizer(fs, environ):
    """Test that environment is correctly initialized with sanitizer."""
    fs.create_file('/benchmark.yaml',
                   contents='fuzz_target: fuzzer\ntype: bug')
    utils.initialize_env()
    assert os.getenv('FUZZ_TARGET') == 'fuzzer'
    assert os.getenv('CFLAGS') == (
        '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION '
        '-fsanitize=address -fsanitize=array-bounds,bool,builtin,enum,'
        'float-divide-by-zero,function,integer-divide-by-zero,null,object-size,'
        'return,returns-nonnull-attribute,shift,signed-integer-overflow,'
        'unreachable,vla-bound,vptr -fno-sanitize-recover=array-bounds,bool,'
        'builtin,enum,float-divide-by-zero,function,integer-divide-by-zero,'
        'null,object-size,return,returns-nonnull-attribute,shift,'
        'signed-integer-overflow,unreachable,vla-bound,vptr -O1')

    assert os.getenv('CXXFLAGS') == (
        '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION '
        '-fsanitize=address -fsanitize=array-bounds,bool,builtin,enum,'
        'float-divide-by-zero,function,integer-divide-by-zero,null,object-size,'
        'return,returns-nonnull-attribute,shift,signed-integer-overflow,'
        'unreachable,vla-bound,vptr -fno-sanitize-recover=array-bounds,bool,'
        'builtin,enum,float-divide-by-zero,function,integer-divide-by-zero,'
        'null,object-size,return,returns-nonnull-attribute,shift,'
        'signed-integer-overflow,unreachable,vla-bound,vptr -stdlib=libc++ -O1'
    )
コード例 #2
0
ファイル: test_utils.py プロジェクト: lucmichalski/fuzzbench
def test_initialize_env_in_environment_with_sanitizer(fs, environ):
    """Test that environment is correctly initialized with sanitizer."""
    fs.create_file('/benchmark.yaml',
                   contents='fuzz_target: fuzzer\ntype: bug')
    utils.initialize_env()
    assert os.getenv('FUZZ_TARGET') == 'fuzzer'
    assert os.getenv('CFLAGS') == '-fsanitize=address,undefined -O3'
    assert os.getenv('CXXFLAGS') == (
        '-fsanitize=address,undefined -stdlib=libc++ -O3')
コード例 #3
0
ファイル: test_utils.py プロジェクト: lucmichalski/fuzzbench
def test_initialize_env_in_environment_without_sanitizer(fs, environ):
    """Test that environment is correctly initialized without sanitizer."""
    fs.create_file('/benchmark.yaml', contents='fuzz_target: fuzzer')
    utils.initialize_env()
    assert os.getenv('FUZZ_TARGET') == 'fuzzer'
    assert os.getenv('CFLAGS') == (
        '-pthread -Wl,--no-as-needed -Wl,-ldl -Wl,-lm '
        '-Wno-unused-command-line-argument -O3')
    assert os.getenv('CXXFLAGS') == (
        '-pthread -Wl,--no-as-needed -Wl,-ldl -Wl,-lm '
        '-Wno-unused-command-line-argument -stdlib=libc++ -O3')
コード例 #4
0
ファイル: test_utils.py プロジェクト: Be-Secure/fuzzbench
def test_initialize_env_in_var_without_sanitizer(fs):
    """Test that environment var is correctly initialized without sanitizer."""
    fs.create_file('/benchmark.yaml', contents='fuzz_target: fuzzer')
    env = {}
    utils.initialize_env(env)
    assert env.get('FUZZ_TARGET') == 'fuzzer'
    assert env.get('CFLAGS') == ('-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION '
                                 '-pthread -Wl,--no-as-needed -Wl,-ldl -Wl,-lm '
                                 '-Wno-unused-command-line-argument -O3')
    assert env.get('CXXFLAGS') == (
        '-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION '
        '-pthread -Wl,--no-as-needed -Wl,-ldl -Wl,-lm '
        '-Wno-unused-command-line-argument -stdlib=libc++ -O3')
コード例 #5
0
def test_initialize_env_in_var_with_sanitizer(fs):
    """TTest that environment var is correctly initialized with sanitizer."""
    fs.create_file('/benchmark.yaml', contents='fuzz_target: fuzzer\ntype: bug')
    env = {}
    utils.initialize_env(env)
    assert env.get('FUZZ_TARGET') == 'fuzzer'
    assert env.get('CFLAGS') == (
        '-fsanitize=address -fsanitize=array-bounds,bool,builtin,enum,'
        'float-divide-by-zero,function,integer-divide-by-zero,null,object-size,'
        'return,returns-nonnull-attribute,shift,signed-integer-overflow,'
        'unreachable,vla-bound,vptr -O1')
    assert env.get('CXXFLAGS') == (
        '-fsanitize=address -fsanitize=array-bounds,bool,builtin,enum,'
        'float-divide-by-zero,function,integer-divide-by-zero,null,object-size,'
        'return,returns-nonnull-attribute,shift,signed-integer-overflow,'
        'unreachable,vla-bound,vptr -stdlib=libc++ '
        '-O1')