Add OneFuzz build pipeline (#191)
This commit is contained in:
Родитель
813d186efe
Коммит
a1b2321203
|
@ -35,6 +35,8 @@ option(BUILD_DXIL_SHADERS "Use DXC Shader Model 6 for shaders" ON)
|
||||||
|
|
||||||
option(NO_WCHAR_T "Use legacy wide-character as unsigned short" OFF)
|
option(NO_WCHAR_T "Use legacy wide-character as unsigned short" OFF)
|
||||||
|
|
||||||
|
option(BUILD_FUZZING "Build for fuzz testing" OFF)
|
||||||
|
|
||||||
option(BUILD_MIXED_DX11 "Support linking with DX11 version of toolkit" OFF)
|
option(BUILD_MIXED_DX11 "Support linking with DX11 version of toolkit" OFF)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
@ -409,7 +411,7 @@ install(FILES
|
||||||
# Model uses dynamic_cast, so we need /GR (Enable RTTI)
|
# Model uses dynamic_cast, so we need /GR (Enable RTTI)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE /Wall /GR /fp:fast "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
|
target_compile_options(${PROJECT_NAME} PRIVATE /Wall /GR /fp:fast "$<$<NOT:$<CONFIG:DEBUG>>:/guard:cf>")
|
||||||
target_link_options(${PROJECT_NAME} PRIVATE /DYNAMICBASE /NXCOMPAT)
|
target_link_options(${PROJECT_NAME} PRIVATE /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO)
|
||||||
|
|
||||||
if((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (NOT ${DIRECTX_ARCH} MATCHES "^arm"))
|
if((CMAKE_SIZEOF_VOID_P EQUAL 4) AND (NOT ${DIRECTX_ARCH} MATCHES "^arm"))
|
||||||
target_link_options(${PROJECT_NAME} PRIVATE /SAFESEH)
|
target_link_options(${PROJECT_NAME} PRIVATE /SAFESEH)
|
||||||
|
@ -497,6 +499,11 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
||||||
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:checkGwOdr $<$<VERSION_GREATER_EQUAL:${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION},10.0.22000>:/Zc:templateScope>)
|
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:checkGwOdr $<$<VERSION_GREATER_EQUAL:${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION},10.0.22000>:/Zc:templateScope>)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_FUZZING AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.32)
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE /fsanitize=address /fsanitize-coverage=inline-8bit-counters /fsanitize-coverage=edge /fsanitize-coverage=trace-cmp /fsanitize-coverage=trace-div)
|
||||||
|
target_link_libraries(${PROJECT_NAME} PRIVATE sancov.lib)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
|
@ -525,4 +532,8 @@ if(BUILD_TESTING AND WIN32 AND (NOT WINDOWS_STORE) AND (NOT (DEFINED XBOX_CONSOL
|
||||||
AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/CMakeLists.txt"))
|
AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/CMakeLists.txt"))
|
||||||
enable_testing()
|
enable_testing()
|
||||||
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests)
|
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()
|
endif()
|
||||||
|
|
|
@ -206,6 +206,14 @@
|
||||||
},
|
},
|
||||||
"hidden": true
|
"hidden": true
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Fuzzing",
|
||||||
|
"cacheVariables": {
|
||||||
|
"BUILD_FUZZING": true,
|
||||||
|
"BUILD_TESTING": false
|
||||||
|
},
|
||||||
|
"hidden": true
|
||||||
|
},
|
||||||
|
|
||||||
{ "name": "x64-Debug" , "description": "MSVC for x64 (Debug) for Windows 10", "inherits": [ "base", "x64", "Debug", "MSVC" ] },
|
{ "name": "x64-Debug" , "description": "MSVC for x64 (Debug) for Windows 10", "inherits": [ "base", "x64", "Debug", "MSVC" ] },
|
||||||
{ "name": "x64-Release" , "description": "MSVC for x64 (Release) for Windows 10", "inherits": [ "base", "x64", "Release", "MSVC" ] },
|
{ "name": "x64-Release" , "description": "MSVC for x64 (Release) for Windows 10", "inherits": [ "base", "x64", "Release", "MSVC" ] },
|
||||||
|
@ -259,7 +267,9 @@
|
||||||
{ "name": "x64-Debug-MinGW" , "description": "MinG-W64 (Debug)", "inherits": [ "base", "x64", "Debug", "GNUC", "VCPKG", "XAudio2Redist", "MinGW64" ] },
|
{ "name": "x64-Debug-MinGW" , "description": "MinG-W64 (Debug)", "inherits": [ "base", "x64", "Debug", "GNUC", "VCPKG", "XAudio2Redist", "MinGW64" ] },
|
||||||
{ "name": "x64-Release-MinGW", "description": "MinG-W64 (Release)", "inherits": [ "base", "x64", "Release", "GNUC", "VCPKG", "XAudio2Redist", "MinGW64" ] },
|
{ "name": "x64-Release-MinGW", "description": "MinG-W64 (Release)", "inherits": [ "base", "x64", "Release", "GNUC", "VCPKG", "XAudio2Redist", "MinGW64" ] },
|
||||||
{ "name": "x86-Debug-MinGW" , "description": "MinG-W32 (Debug)", "inherits": [ "base", "x86", "Debug", "GNUC", "VCPKG", "XAudio2Redist", "MinGW32" ] },
|
{ "name": "x86-Debug-MinGW" , "description": "MinG-W32 (Debug)", "inherits": [ "base", "x86", "Debug", "GNUC", "VCPKG", "XAudio2Redist", "MinGW32" ] },
|
||||||
{ "name": "x86-Release-MinGW", "description": "MinG-W32 (Release)", "inherits": [ "base", "x86", "Release", "GNUC", "VCPKG", "XAudio2Redist", "MinGW32" ] }
|
{ "name": "x86-Release-MinGW", "description": "MinG-W32 (Release)", "inherits": [ "base", "x86", "Release", "GNUC", "VCPKG", "XAudio2Redist", "MinGW32" ] },
|
||||||
|
|
||||||
|
{ "name": "x64-Fuzzing" , "description": "MSVC for x64 (Release) with ASan", "inherits": [ "base", "x64", "Release", "MSVC", "Fuzzing" ] }
|
||||||
],
|
],
|
||||||
"testPresets": [
|
"testPresets": [
|
||||||
{ "name": "x64-Debug" , "configurePreset": "x64-Debug" },
|
{ "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,129 @@
|
||||||
|
# Copyright (c) Microsoft Corporation.
|
||||||
|
# Licensed under the MIT License.
|
||||||
|
#
|
||||||
|
# http://go.microsoft.com/fwlink/?LinkID=615561
|
||||||
|
|
||||||
|
# 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/directxtk12test.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_XAUDIO_WIN10=ON -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";
|
||||||
|
|
||||||
|
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": "DirectXTK12"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Загрузка…
Ссылка в новой задаче