Skip to content

Commit

Permalink
[Tests] Make runnable from main()
Browse files Browse the repository at this point in the history
  • Loading branch information
hyazinthh committed Dec 12, 2023
1 parent fcb5fd8 commit ae9414b
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 5 deletions.
70 changes: 66 additions & 4 deletions src/Tests/Aardvark.Rendering.Tests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ open FSharp.Data.Adaptive
open Aardvark.Rendering
open Aardvark.Rendering.GL
open OpenTK.Graphics.OpenGL4
open Aardvark.Application
open Aardvark.Application.Slim

open BenchmarkDotNet.Running;
open BenchmarkDotNet.Configs
open BenchmarkDotNet.Jobs
open BenchmarkDotNet.Toolchains

open Expecto

let testCompile() =
use runtime = new Runtime(DebugLevel.None)
let ctx = new Context(runtime, fun () -> ContextHandleOpenTK.create runtime.DebugConfig)
Expand Down Expand Up @@ -242,10 +245,69 @@ module CSTest =
dst.Download(img)
img.SaveImageSharp @"C:\Users\Schorsch\Desktop\bla.png"



[<EntryPoint>]
let main argv =

let backendTests backend =
let bufferTests =
testBackend backend "Buffers" [
Buffer.BufferCopy.tests
Buffer.BufferUpload.tests
Buffer.BufferDownload.tests
Buffer.AttributeBuffer.tests
]

let textureTests =
testBackend backend "Textures" [
Texture.TextureUpload.tests
Texture.TextureDownload.tests
Texture.TextureCreate.tests
Texture.TextureCopy.tests
Texture.TextureClear.tests
]

let renderingTests =
testBackend backend "Rendering" [
Rendering.Culling.tests
Rendering.RenderTasks.tests
Rendering.FramebufferSignature.tests
Rendering.IntegerAttachments.tests
Rendering.Samplers.tests
Rendering.Uniforms.tests
]

let computeTests =
testBackend backend "Compute" [
Rendering.ComputeImages.tests
Rendering.ComputeBuffers.tests
Rendering.ComputePrimitives.tests
Rendering.ComputeSorting.tests
Rendering.ComputeJpeg.tests
Rendering.MutableInputBinding.tests
]
testList $"Tests ({backend})" [
bufferTests
textureTests
renderingTests
computeTests
]

let otherTests =
testList "Other tests" [
``SceneGraph Tests``.tests
``CompactSet Tests``.tests
``AdaptiveResource Tests``.tests
]

let allTests =
testList "Tests" [
otherTests
backendTests Backend.GL
backendTests Backend.Vulkan
]

runTestsWithCLIArgs [ CLIArguments.No_Spinner ] argv allTests

//Aardvark.Init()
//CSTest.run()

Expand All @@ -264,7 +326,7 @@ let main argv =
//testDownloadSlice()
//testCopySlice()

BenchmarkRunner.Run<StatsBench.StatsTest>() |> ignore
// BenchmarkRunner.Run<StatsBench.StatsTest>() |> ignore


//testTextureCubeArray()
Expand All @@ -278,4 +340,4 @@ let main argv =
//PerformanceTests.StartupPerformance.runConsole args
//PerformanceTests.IsActiveFlagPerformance.run args
//UseTest.bla()
0
// 0
3 changes: 2 additions & 1 deletion src/Tests/Aardvark.Rendering.Tests/Tests/Application.fs
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ module TestApplication =
runtime,
{ new IDisposable with
member x.Dispose() =
checkForDebugErrors()
checkForErrors()
runtime.Dispose()
checkForDebugErrors()
toolkit.Dispose()
}
)
Expand All @@ -70,6 +70,7 @@ module TestApplication =
open Aardvark.Rendering.Vulkan

let create (debug : IDebugConfig) =
CustomDeviceChooser.Register Seq.head
let app = new HeadlessVulkanApplication(debug)
let onExit =
{ new IDisposable with
Expand Down
2 changes: 2 additions & 0 deletions src/Tests/Aardvark.Rendering.Tests/Tests/Common.fs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ module ``Unit Test Utilities`` =
let prepareCases (backend : Backend) (name : string) (cases : List<string * (IRuntime -> unit)>) =
cases |> List.map (fun (name, test) ->
testCase name (fun () -> TestApplication.createUse test backend)
|> testSequenced
)
|> testList name

Expand All @@ -32,5 +33,6 @@ module ``Unit Test Utilities`` =
Aardvark.Init()
test()
)
|> testSequenced
)
|> testList name

0 comments on commit ae9414b

Please sign in to comment.