Tweaks for native engine tests

#601
This commit is contained in:
Wojtek Figat
2021-08-16 12:18:11 +02:00
parent 6a055bd4c5
commit d68189ae3d
6 changed files with 24 additions and 14 deletions

View File

@@ -1,12 +1,9 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
#include "Engine/Core/Types/String.h"
#include "Engine/Core/Types/StringView.h"
#include <ThirdParty/catch2/catch.hpp>
TEST_CASE("String Replace works") {
SECTION("Char, case sensitive") {
String str("hello HELLO");

View File

@@ -1,15 +1,19 @@
// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved.
using System.Collections.Generic;
using System.IO;
using Flax.Build;
using Flax.Build.NativeCpp;
/// <summary>
/// Application startup module.
/// Engine tests module.
/// </summary>
public class TestsMain : EngineModule
public class Tests : EngineModule
{
/// <inheritdoc />
public Tests()
{
Deploy = false;
}
/// <inheritdoc />
public override void GetFilesToDeploy(List<string> files)
{

View File

@@ -9,7 +9,7 @@ using Flax.Build.NativeCpp;
/// <summary>
/// Target that builds standalone, native tests.
/// </summary>
public class FlaxNativeTestsTarget : EngineTarget
public class FlaxTestsTarget : EngineTarget
{
/// <inheritdoc />
public override void Init()
@@ -17,10 +17,10 @@ public class FlaxNativeTestsTarget : EngineTarget
base.Init();
// Initialize
OutputName = "FlaxNativeTests";
OutputName = "FlaxTests";
ConfigurationName = "Tests";
// TODO: All platforms would benefit from the tests.
IsPreBuilt = false;
UseSymbolsExports = false;
Platforms = new[]
{
TargetPlatform.Windows,
@@ -29,11 +29,14 @@ public class FlaxNativeTestsTarget : EngineTarget
Architectures = new[]
{
TargetArchitecture.x64,
TargetArchitecture.x86,
};
Configurations = new[]
{
TargetConfiguration.Development,
};
Modules.Remove("Main");
Modules.Add("TestsMain");
Modules.Add("Tests");
}
/// <inheritdoc />
@@ -56,7 +59,6 @@ public class FlaxNativeTestsTarget : EngineTarget
var testTargetName = "FlaxNativeTests"; // Should this be added to .flaxproj, similarly as "GameTarget" and "EditorTarget"?
var result = projectTargets.FirstOrDefault(x => x.Name == testTargetName);
if (result == null)
// Apparently .NET compiler that is used for building .Build.cs files is different that one used for building Flax.Build itself. String interpolation ($) does't work here.
throw new Exception(string.Format("Invalid or missing test target {0} specified in project {1} (referenced by project {2}).", testTargetName, project.Name, Project.Name));
return result;
}

View File

@@ -42,6 +42,11 @@ namespace Flax.Build
/// </summary>
public bool BuildCSharp = true;
/// <summary>
/// True if module can be deployed.
/// </summary>
public bool Deploy = true;
/// <summary>
/// Initializes a new instance of the <see cref="Module"/> class.
/// </summary>

View File

@@ -86,6 +86,8 @@ namespace Flax.Deploy
var files = new List<string>();
foreach (var module in rules.Modules)
{
if (!module.Deploy)
continue;
module.GetFilesToDeploy(files);
files.Add(module.FilePath);
foreach (var file in files)