Add OneFuzz build pipeline
This commit is contained in:
Родитель
5a83705fce
Коммит
f58c30705b
|
@ -39,6 +39,8 @@ option(USE_PREBUILT_SHADERS "Use externally built HLSL shaders" OFF)
|
|||
|
||||
option(NO_WCHAR_T "Use legacy wide-character as unsigned short" OFF)
|
||||
|
||||
option(BUILD_FUZZING "Build for fuzz testing" OFF)
|
||||
|
||||
# Includes the functions for loading/saving OpenEXR files at runtime
|
||||
option(ENABLE_OPENEXR_SUPPORT "Build with OpenEXR support" OFF)
|
||||
|
||||
|
@ -365,7 +367,7 @@ endif()
|
|||
if(MSVC)
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /Wall /GR- /fp:fast "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
|
||||
target_link_options(${t} PRIVATE /DYNAMICBASE /NXCOMPAT)
|
||||
target_link_options(${t} PRIVATE /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO)
|
||||
endforeach()
|
||||
|
||||
if((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (NOT (${DIRECTX_ARCH} MATCHES "^arm")))
|
||||
|
@ -503,6 +505,13 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|||
foreach(t IN LISTS TOOL_EXES)
|
||||
target_compile_options(${t} PRIVATE ${WarningsEXE})
|
||||
endforeach()
|
||||
|
||||
if (BUILD_FUZZING AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.32)
|
||||
foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME})
|
||||
target_compile_options(${t} PRIVATE /fsanitize=address /fsanitize-coverage=inline-8bit-counters /fsanitize-coverage=edge /fsanitize-coverage=trace-cmp /fsanitize-coverage=trace-div)
|
||||
target_link_libraries(${t} PRIVATE sancov.lib)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
|
@ -540,4 +549,8 @@ if(BUILD_TESTING AND WIN32 AND (NOT WINDOWS_STORE) AND (NOT (DEFINED XBOX_CONSOL
|
|||
AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/CMakeLists.txt"))
|
||||
enable_testing()
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests)
|
||||
elseif(BUILD_FUZZING AND WIN32 AND (NOT WINDOWS_STORE) AND (NOT (DEFINED XBOX_CONSOLE_TARGET))
|
||||
AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/fuzzloaders/CMakeLists.txt"))
|
||||
message(STATUS "Building for fuzzing")
|
||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests/fuzzloaders)
|
||||
endif()
|
||||
|
|
|
@ -167,6 +167,14 @@
|
|||
"VCPKG_HOST_TRIPLET": "x64-mingw-static"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Fuzzing",
|
||||
"cacheVariables": {
|
||||
"BUILD_FUZZING": true,
|
||||
"BUILD_TESTING": false
|
||||
},
|
||||
"hidden": true
|
||||
},
|
||||
|
||||
{ "name": "x64-Debug" , "description": "MSVC for x64 (Debug) with DX12", "inherits": [ "base", "x64", "Debug", "MSVC" ] },
|
||||
{ "name": "x64-Release" , "description": "MSVC for x64 (Release) with DX12", "inherits": [ "base", "x64", "Release", "MSVC" ] },
|
||||
|
@ -233,7 +241,9 @@
|
|||
{ "name": "x64-Debug-Linux", "description": "WSL Linux x64 (Debug)", "inherits": [ "base", "x64", "Debug", "VCPKG" ] },
|
||||
{ "name": "x64-Release-Linux", "description": "WSL Linux x64 (Release)", "inherits": [ "base", "x64", "Release", "VCPKG" ] },
|
||||
{ "name": "arm64-Debug-Linux", "description": "WSL Linux ARM64 (Debug)", "inherits": [ "base", "ARM64", "Debug", "VCPKG" ] },
|
||||
{ "name": "arm64-Release-Linux", "description": "WSL Linux ARM64 (Release)", "inherits": [ "base", "ARM64", "Release", "VCPKG" ] }
|
||||
{ "name": "arm64-Release-Linux", "description": "WSL Linux ARM64 (Release)", "inherits": [ "base", "ARM64", "Release", "VCPKG" ] },
|
||||
|
||||
{ "name": "x64-Fuzzing" , "description": "MSVC for x64 (Release) with ASan", "inherits": [ "base", "x64", "Release", "MSVC", "Fuzzing" ] }
|
||||
],
|
||||
"testPresets": [
|
||||
{ "name": "x64-Debug" , "configurePreset": "x64-Debug" },
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="CopyASanFiles" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFolder Condition="'$(TargetFolder)'==''">.drop</TargetFolder>
|
||||
|
||||
<VSInstallDir>$(VsInstallRoot)\</VSInstallDir>
|
||||
<VCInstallDir>$(VSInstallDir)VC\</VCInstallDir>
|
||||
<VCToolsVersionProps>$(VCInstallDir)Auxiliary\Build\Microsoft.VCToolsVersion.default.props</VCToolsVersionProps>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VCToolsVersionProps)" Condition="Exists('$(VCToolsVersionProps)')" />
|
||||
|
||||
<ItemGroup>
|
||||
<ASanFiles Include="$(VCInstallDir)Tools\MSVC\$(VCToolsVersion)\bin\HostX64\x64\clang_rt.*.dll" />
|
||||
<ASanFiles Include="$(VSInstallDir)Common7\IDE\msdia140.dll" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="CopyASanFiles">
|
||||
<Message Text="VCToolsVersion: $(VCToolsVersion)" />
|
||||
<Copy SourceFiles="@(ASanFiles)" DestinationFolder="$(TargetFolder)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,144 @@
|
|||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT License.
|
||||
#
|
||||
# http://go.microsoft.com/fwlink/?LinkId=248926
|
||||
|
||||
# Builds the library using CMake and submit for file fuzzing
|
||||
|
||||
schedules:
|
||||
- cron: "0 12 * * 0"
|
||||
displayName: 'Submit for File Fuzzing'
|
||||
branches:
|
||||
include:
|
||||
- main
|
||||
always: true
|
||||
|
||||
trigger: none
|
||||
pr: none
|
||||
|
||||
resources:
|
||||
repositories:
|
||||
- repository: self
|
||||
type: git
|
||||
ref: refs/heads/main
|
||||
|
||||
name: $(Year:yyyy).$(Month).$(DayOfMonth)$(Rev:.r)
|
||||
|
||||
variables:
|
||||
VS_GENERATOR: 'Visual Studio 17 2022'
|
||||
WIN11_SDK: '10.0.22000.0'
|
||||
BUGFILING_PAT: $(BugFilingPAT)
|
||||
GITHUB_PAT: $(GITHUBPUBLICTOKEN)
|
||||
ONEFUZZ_PAT: $(OneFuzzPAT)
|
||||
|
||||
pool:
|
||||
vmImage: windows-2022
|
||||
|
||||
jobs:
|
||||
- job: FUZZ_BUILD
|
||||
displayName: 'Build for file fuzzing'
|
||||
steps:
|
||||
- checkout: self
|
||||
clean: true
|
||||
fetchTags: false
|
||||
- task: DeleteFiles@1
|
||||
displayName: Delete files from Tests
|
||||
inputs:
|
||||
SourceFolder: Tests
|
||||
Contents: '**'
|
||||
RemoveSourceFolder: true
|
||||
RemoveDotFiles: true
|
||||
- task: CmdLine@2
|
||||
displayName: Fetch Tests
|
||||
inputs:
|
||||
script: git clone --quiet https://%GITHUB_PAT%@github.com/walbourn/directxtextest.git Tests
|
||||
workingDirectory: $(Build.SourcesDirectory)
|
||||
failOnStderr: true
|
||||
- task: CMake@1
|
||||
displayName: 'CMake (MSVC): Config with ASan'
|
||||
inputs:
|
||||
cwd: '$(Build.SourcesDirectory)'
|
||||
cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out -DCMAKE_SYSTEM_VERSION=$(WIN11_SDK) -DBUILD_TOOLS=OFF -DBUILD_SAMPLE=OFF -DBUILD_FUZZING=ON -DBUILD_TESTING=OFF'
|
||||
- task: CMake@1
|
||||
displayName: 'CMake (MSVC): Build with ASan'
|
||||
inputs:
|
||||
cwd: '$(Build.SourcesDirectory)'
|
||||
cmakeArgs: --build out -v --config RelWithDebInfo
|
||||
- task: CopyFiles@2
|
||||
displayName: Copy fuzzer
|
||||
inputs:
|
||||
Contents: |
|
||||
build\OneFuzzConfig.json
|
||||
out\bin\CMake\RelWithDebInfo\fuzzloaders.exe
|
||||
TargetFolder: .drop
|
||||
OverWrite: true
|
||||
flattenFolders: true
|
||||
- task: CopyFiles@2
|
||||
displayName: Copy symbols
|
||||
inputs:
|
||||
Contents: |
|
||||
out\bin\CMake\RelWithDebInfo\fuzzloaders.pdb
|
||||
TargetFolder: .drop\symbols
|
||||
OverWrite: true
|
||||
flattenFolders: true
|
||||
- task: PowerShell@2
|
||||
displayName: Download seed files
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
$seedfiles = "AlphaEdge.dds",
|
||||
"cubea8r8g8b8.dds",
|
||||
"default_texture_nm.dds",
|
||||
"dx5_logo.dds",
|
||||
"hdrtest.dds",
|
||||
"normalmap.dds",
|
||||
"grad4d.hdr",
|
||||
"grad4dunc.hdr",
|
||||
"BigTree.hdr",
|
||||
"CBW8.TGA",
|
||||
"ccm8.tga",
|
||||
"CTC16.TGA",
|
||||
"CTC24.TGA",
|
||||
"CTC32.TGA",
|
||||
"UTC16.TGA",
|
||||
"UTC24.TGA",
|
||||
"UTC32.TGA",
|
||||
"UBW8.TGA",
|
||||
"ucm8.tga",
|
||||
"testimg.ppm",
|
||||
"grad4d.pfm";
|
||||
|
||||
New-Item -ItemType Directory -Force -Path .drop\seeds\
|
||||
|
||||
foreach($filename in $seedfiles)
|
||||
{
|
||||
Write-Host "Fetching: $filename"
|
||||
$url = "https://raw.githubusercontent.com/walbourn/directxtexmedia/main/" + $filename
|
||||
$target = [System.IO.Path]::Combine(".drop\seeds\", $filename)
|
||||
Invoke-WebRequest $url -o $target
|
||||
}
|
||||
|
||||
- task: MSBuild@1
|
||||
displayName: 'Copy ASan binaries'
|
||||
inputs:
|
||||
solution: build/CopyASAN.targets
|
||||
msbuildArguments: /p:TargetFolder=$(Build.SourcesDirectory)\.drop
|
||||
msbuildVersion: 17.0
|
||||
msbuildArchitecture: x64
|
||||
- task: PowerShell@2
|
||||
displayName: List drop files
|
||||
inputs:
|
||||
targetType: inline
|
||||
script: |
|
||||
Get-ChildItem ".drop" -Recurse | select FullName
|
||||
|
||||
- task: onefuzz-task@0
|
||||
displayName: 'Submit to OneFuzz'
|
||||
inputs:
|
||||
onefuzzOSes: 'Windows'
|
||||
env:
|
||||
onefuzzDropDirectory: $(Build.SourcesDirectory)\.drop
|
||||
onefuzzDropPAT: $(ONEFUZZ_PAT)
|
||||
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
|
||||
onefuzzBugFilingPAT: $(BUGFILING_PAT)
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"ConfigVersion": 3,
|
||||
"Entries": [
|
||||
{
|
||||
"JobNotificationEmail": "directxtkdev@microsoft.com",
|
||||
"Skip": false,
|
||||
"Fuzzer": {
|
||||
"$type": "libfuzzer",
|
||||
"FuzzingHarnessExecutableName": "fuzzloaders.exe"
|
||||
},
|
||||
"RebootAfterSetup": false,
|
||||
"OneFuzzJobs": [
|
||||
{
|
||||
"ProjectName": "Direct3D",
|
||||
"TargetName": "DirectXTex"
|
||||
}
|
||||
],
|
||||
"JobDependencies": [
|
||||
"fuzzloaders.exe",
|
||||
"fuzzloaders.pdb",
|
||||
"clang_rt.asan_dynamic-x86_64.dll",
|
||||
"msdia140.dll"
|
||||
],
|
||||
"AdoTemplate": {
|
||||
"Org": "microsoft",
|
||||
"Project": "OS",
|
||||
"AssignedTo": "chuckw@microsoft.com",
|
||||
"AreaPath": "OS\\Core\\SiGMa\\GRFX-Graphics",
|
||||
"IterationPath": "OS\\Future"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Загрузка…
Ссылка в новой задаче