Address PR comments

This commit is contained in:
John
2021-06-10 14:54:46 +01:00
parent fdbc15b195
commit 169d4da288
32 changed files with 1631 additions and 164 deletions
@@ -9,5 +9,4 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
add_subdirectory(Executable)
add_subdirectory(Static)
add_subdirectory(Code)
@@ -24,27 +24,42 @@ ly_add_target(
AZ::TestImpact.Runtime.Static
)
ly_add_target(
NAME TestImpact.Frontend.Console EXECUTABLE
OUTPUT_NAME tiaf
NAMESPACE AZ
FILES_CMAKE
testimpactframework_frontend_console_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
Source
BUILD_DEPENDENCIES
PRIVATE
AZ::TestImpact.Frontend.Console.Static
)
################################################################################
# Tests
################################################################################
ly_add_target(
NAME TestImpact.Frontend.Console.Static.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
NAMESPACE AZ
FILES_CMAKE
testimpactframework_frontend_console_static_tests_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
Include
Source
Tests
BUILD_DEPENDENCIES
PRIVATE
AZ::AzTestShared
AZ::AzTest
AZ::TestImpact.Frontend.Console.Static
)
ly_add_googletest(
NAME AZ::TestImpact.Frontend.Console.Static.Tests
)
# Disbled:SPEC-7246
#ly_add_target(
# NAME TestImpact.Frontend.Console.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
# NAMESPACE AZ
# FILES_CMAKE
# testimpactframework_frontend_console_static_tests_files.cmake
# INCLUDE_DIRECTORIES
# PRIVATE
# Include
# Source
# Tests
# BUILD_DEPENDENCIES
# PRIVATE
# AZ::AzTestShared
# AZ::AzTest
# AZ::TestImpact.Frontend.Console.Static
#)
#
#ly_add_googletest(
# NAME AZ::TestImpact.Frontend.Console.Static.Tests
#)
@@ -0,0 +1,42 @@
///*
// * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
// * its licensors.
// *
// * For complete copyright and license terms please see the LICENSE at the root of this
// * distribution (the "License"). All use of this software is governed by the License,
// * or, if provided, by the license below or the license accompanying this file. Do not
// * remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// *
// */
//
//#include <TestImpactFramework/TestImpactClientTestSelection.h>
//#include <TestImpactFramework/TestImpactClientTestRun.h>
//
//#include <TestImpactConsoleTestSequenceEventHandler.h>
//
//#include <AzCore/std/containers/vector.h>
//#include <AzCore/std/smart_ptr/unique_ptr.h>
//#include <AzCore/UnitTest/TestTypes.h>
//#include <AzTest/AzTest.h>
//
//namespace UnitTest
//{
// class ConsoleTestSequenceTestFixture
// : public AllocatorsTestFixture
// {
// };
//
// TEST_F(ConsoleTestSequenceTestFixture, CheckEmptyArgs_ExpectDefaultValues)
// {
// AZStd::unordered_set<AZStd::string> suites = { "PERIODIC","MAIN" };
// TestImpact::Console::TestSequenceEventHandler seq(&suites);
// AZStd::vector<AZStd::string> selectedTests = { "Test1", "Test2", "Test3", "Test4", "Test5" };
// seq.operator()(TestImpact::Client::TestRunSelection(selectedTests, {"Test6"}));
//
// for (auto i = 0; i < selectedTests.size(); i++)
// {
// seq.operator()(TestImpact::Client::TestRun(selectedTests[i], (TestImpact::Client::TestRunResult)i, AZStd::chrono::milliseconds(i)));
// }
// }
//}
@@ -0,0 +1,34 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzCore/Memory/OSAllocator.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzTest/AzTest.h>
class TestImpactTestEnvironment
: public AZ::Test::ITestEnvironment
{
protected:
void SetupEnvironment() override
{
AZ::AllocatorInstance<AZ::OSAllocator>::Create();
AZ::AllocatorInstance<AZ::SystemAllocator>::Create();
}
void TeardownEnvironment() override
{
AZ::AllocatorInstance<AZ::OSAllocator>::Destroy();
AZ::AllocatorInstance<AZ::SystemAllocator>::Destroy();
}
};
AZ_UNIT_TEST_HOOK(new TestImpactTestEnvironment);
@@ -0,0 +1,27 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <TestImpactRuntimeConfigurationFactory.h>
#include <AzTest/AzTest.h>
#include <fstream>
namespace UnitTest
{
//TEST(FOO, BAR)
//{
// std::ifstream configFile("C:\\o3de_TIF_Feature\\windows_vs2019\\bin\\debug\\tiaf.debug.json");
// AZStd::string configData((std::istreambuf_iterator<char>(configFile)), std::istreambuf_iterator<char>());
// const auto configuration = TestImpact::ConfigurationFactory(configData);
//}
}
@@ -10,4 +10,9 @@
#
set(FILES
Tests/TestImpactCommandLineOptionsTest.cpp
Tests/TestImpactRuntimeConfigurationFactoryTest.cpp
Tests/TestImpactFrontendConsoleStaticTestMain.cpp
Tests/TestImpactConsoleMainTest.cpp
Tests/TestImpactConsoleTestSequenceEventHandlerTest.cpp
)
@@ -1,12 +0,0 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
add_subdirectory(Code)
@@ -1,25 +0,0 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
ly_add_target(
NAME TestImpact.Frontend.Console EXECUTABLE
OUTPUT_NAME tiaf
NAMESPACE AZ
FILES_CMAKE
testimpactframework_frontend_console_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
Source
BUILD_DEPENDENCIES
PRIVATE
AZ::TestImpact.Frontend.Console.Static
)
@@ -1,12 +0,0 @@
#
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
# its licensors.
#
# For complete copyright and license terms please see the LICENSE at the root of this
# distribution (the "License"). All use of this software is governed by the License,
# or, if provided, by the license below or the license accompanying this file. Do not
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#
add_subdirectory(Code)
@@ -40,48 +40,49 @@ ly_add_target(
# Tests
################################################################################
ly_add_target(
NAME TestImpact.Runtime.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
NAMESPACE AZ
FILES_CMAKE
testimpactframework_runtime_tests_files.cmake
INCLUDE_DIRECTORIES
PRIVATE
Include
Source
Tests
BUILD_DEPENDENCIES
PRIVATE
AZ::AzTestShared
AZ::AzTest
AZ::TestImpact.Runtime.Static
RUNTIME_DEPENDENCIES
AZ::AzTestRunner
AZ::TestImpact.TestProcess.Console
AZ::TestImpact.TestTargetA.Tests
AZ::TestImpact.TestTargetB.Tests
AZ::TestImpact.TestTargetC.Tests
AZ::TestImpact.TestTargetD.Tests
COMPILE_DEFINITIONS
PRIVATE
LY_TEST_IMPACT_AZ_TESTRUNNER_BIN="$<TARGET_FILE:AzTestRunner>"
LY_TEST_IMPACT_TEST_PROCESS_BIN="$<TARGET_FILE:TestImpact.TestProcess.Console>"
LY_TEST_IMPACT_TEST_TARGET_A_BIN="$<TARGET_FILE:TestImpact.TestTargetA.Tests>"
LY_TEST_IMPACT_TEST_TARGET_B_BIN="$<TARGET_FILE:TestImpact.TestTargetB.Tests>"
LY_TEST_IMPACT_TEST_TARGET_C_BIN="$<TARGET_FILE:TestImpact.TestTargetC.Tests>"
LY_TEST_IMPACT_TEST_TARGET_D_BIN="$<TARGET_FILE:TestImpact.TestTargetD.Tests>"
LY_TEST_IMPACT_TEST_TARGET_A_BASE_NAME="$<TARGET_FILE_BASE_NAME:TestImpact.TestTargetA.Tests>"
LY_TEST_IMPACT_TEST_TARGET_B_BASE_NAME="$<TARGET_FILE_BASE_NAME:TestImpact.TestTargetB.Tests>"
LY_TEST_IMPACT_TEST_TARGET_C_BASE_NAME="$<TARGET_FILE_BASE_NAME:TestImpact.TestTargetC.Tests>"
LY_TEST_IMPACT_TEST_TARGET_D_BASE_NAME="$<TARGET_FILE_BASE_NAME:TestImpact.TestTargetD.Tests>"
LY_TEST_IMPACT_TEST_TARGET_ENUMERATION_DIR="${GTEST_XML_OUTPUT_DIR}/TestImpact/Temp/Exclusive/Enum"
LY_TEST_IMPACT_TEST_TARGET_RESULTS_DIR="${GTEST_XML_OUTPUT_DIR}/TestImpact/Temp/Exclusive/Result"
LY_TEST_IMPACT_TEST_TARGET_COVERAGE_DIR="${GTEST_XML_OUTPUT_DIR}/TestImpact/Temp/Exclusive/Coverage"
LY_TEST_IMPACT_INSTRUMENTATION_BIN="${LY_TEST_IMPACT_INSTRUMENTATION_BIN}"
LY_TEST_IMPACT_MODULES_DIR="${CMAKE_BINARY_DIR}"
LY_TEST_IMPACT_COVERAGE_SOURCES_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
)
ly_add_googletest(
NAME AZ::TestImpact.Runtime.Tests
)
# Disabled: SPEC-7246
#ly_add_target(
# NAME TestImpact.Runtime.Tests ${PAL_TRAIT_TEST_TARGET_TYPE}
# NAMESPACE AZ
# FILES_CMAKE
# testimpactframework_runtime_tests_files.cmake
# INCLUDE_DIRECTORIES
# PRIVATE
# Include
# Source
# Tests
# BUILD_DEPENDENCIES
# PRIVATE
# AZ::AzTestShared
# AZ::AzTest
# AZ::TestImpact.Runtime.Static
# RUNTIME_DEPENDENCIES
# AZ::AzTestRunner
# AZ::TestImpact.TestProcess.Console
# AZ::TestImpact.TestTargetA.Tests
# AZ::TestImpact.TestTargetB.Tests
# AZ::TestImpact.TestTargetC.Tests
# AZ::TestImpact.TestTargetD.Tests
# COMPILE_DEFINITIONS
# PRIVATE
# LY_TEST_IMPACT_AZ_TESTRUNNER_BIN="$<TARGET_FILE:AzTestRunner>"
# LY_TEST_IMPACT_TEST_PROCESS_BIN="$<TARGET_FILE:TestImpact.TestProcess.Console>"
# LY_TEST_IMPACT_TEST_TARGET_A_BIN="$<TARGET_FILE:TestImpact.TestTargetA.Tests>"
# LY_TEST_IMPACT_TEST_TARGET_B_BIN="$<TARGET_FILE:TestImpact.TestTargetB.Tests>"
# LY_TEST_IMPACT_TEST_TARGET_C_BIN="$<TARGET_FILE:TestImpact.TestTargetC.Tests>"
# LY_TEST_IMPACT_TEST_TARGET_D_BIN="$<TARGET_FILE:TestImpact.TestTargetD.Tests>"
# LY_TEST_IMPACT_TEST_TARGET_A_BASE_NAME="$<TARGET_FILE_BASE_NAME:TestImpact.TestTargetA.Tests>"
# LY_TEST_IMPACT_TEST_TARGET_B_BASE_NAME="$<TARGET_FILE_BASE_NAME:TestImpact.TestTargetB.Tests>"
# LY_TEST_IMPACT_TEST_TARGET_C_BASE_NAME="$<TARGET_FILE_BASE_NAME:TestImpact.TestTargetC.Tests>"
# LY_TEST_IMPACT_TEST_TARGET_D_BASE_NAME="$<TARGET_FILE_BASE_NAME:TestImpact.TestTargetD.Tests>"
# LY_TEST_IMPACT_TEST_TARGET_ENUMERATION_DIR="${GTEST_XML_OUTPUT_DIR}/TestImpact/Temp/Exclusive/Enum"
# LY_TEST_IMPACT_TEST_TARGET_RESULTS_DIR="${GTEST_XML_OUTPUT_DIR}/TestImpact/Temp/Exclusive/Result"
# LY_TEST_IMPACT_TEST_TARGET_COVERAGE_DIR="${GTEST_XML_OUTPUT_DIR}/TestImpact/Temp/Exclusive/Coverage"
# LY_TEST_IMPACT_INSTRUMENTATION_BIN="${LY_TEST_IMPACT_INSTRUMENTATION_BIN}"
# LY_TEST_IMPACT_MODULES_DIR="${CMAKE_BINARY_DIR}"
# LY_TEST_IMPACT_COVERAGE_SOURCES_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
#)
#
#ly_add_googletest(
# NAME AZ::TestImpact.Runtime.Tests
#)
+1
View File
@@ -315,6 +315,7 @@ function(ly_add_pytest)
${ly_add_pytest_UNPARSED_ARGUMENTS}
)
set_property(GLOBAL APPEND PROPERTY LY_ALL_TESTS_${ly_add_pytest_NAME}_SCRIPT_PATH ${ly_add_pytest_PATH})
set_tests_properties(${LY_ADDED_TEST_NAME} PROPERTIES RUN_SERIAL "${ly_add_pytest_TEST_SERIAL}")
endfunction()
@@ -88,7 +88,7 @@
"COMMAND": "python_windows.cmd",
"PARAMETERS": {
"SCRIPT_PATH": "scripts/build/TestImpactAnalysis/tiaf_driver.py",
"SCRIPT_PARAMETERS": "--testFailurePolicy abort --safeMode --suite main --pipeline !PIPELINE_NAME! --destCommit !CHANGE_ID! --config \"build\\windows_vs2019\\bin\\TestImpactFramework\\persistent\\tiaf.profile.json\""
"SCRIPT_PARAMETERS": "--testFailurePolicy abort --safeMode --suite main --pipeline !PIPELINE_NAME! --destCommit !CHANGE_ID! --config \"!OUTPUT_DIRECTORY!\\TestImpactFramework\\persistent\\tiaf.profile.json\""
}
},
"debug_vs2019": {
+1 -46
View File
@@ -219,49 +219,4 @@ class TestImpact:
else:
print(f"The test impact analysis runtime returned with error: '{result.returncode}'.")
return result.returncode
#args = []
#print("Please note: test impact analysis sequences will be run in read-only mode (seed sequences are unaffected).")
#if sequence_type == SequenceType.REGULAR:
# print("Sequence type: regular.")
# args.append("--sequence=regular")
# args.append("--fpolicy=abort")
#elif sequence_type == SequenceType.SEED:
# print("Sequence type: seed.")
# args.append("--sequence=seed")
# args.append("--fpolicy=continue")
#elif sequence_type == SequenceType.TEST_IMPACT_ANALYSIS:
# print("Sequence type: test impact analysis (no write).")
# args.append("--fpolicy=abort")
# if self.__has_change_list:
# args.append(f"-changelist={self.__change_list_path}")
# args.append("--sequence=tianowrite")
# else:
# print(f"No change list was generated, falling back to a regular sequence.")
# print("Sequence type: Regular.")
# args.append("--sequence=regular")
#else:
# raise ValueError(sequence_type)
#
#if test_timeout != None:
# args.append(f"--ttimeout={test_timeout}")
# print(f"Test target timeout is set to {test_timeout} seconds.")
#if global_timeout != None:
# args.append(f"--gtimeout={global_timeout}")
# print(f"Global sequence timeout is set to {test_timeout} seconds.")
#
#print("Args: ", end='')
#print(*args)
#result = subprocess.run([self.__tiaf_bin] + args)
#if result.returncode == 0:
# print("Test impact analysis runtime returned successfully.")
# if sequence_type == SequenceType.SEED:
# print("Writing historical meta-data...")
# self.__write_last_run_hash(self.__dst_commit)
# print("Complete!")
#else:
# print(f"The test impact analysis runtime returned with error: '{result.returncode}'.")
#return result.returncode
@@ -57,4 +57,5 @@ if __name__ == "__main__":
args = parse_args()
tiaf = TestImpact(args.config, args.pipeline, args.dst_commit)
return_code = tiaf.run(args.suite, args.test_failure_policy, args.safe_mode, args.test_timeout, args.global_timeout)
sys.exit(return_code)
sys.exit(return_code)