Merge branch 'TIF/Jenkins' into TIF/Jenkins_Console

monroegm-disable-blank-issue-2
jonawals 5 years ago
commit 5fd23cef35

@ -184,8 +184,8 @@ namespace TestImpact
Policy::TargetOutputCapture ParseTargetOutputCapture(const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(OptionKeys[TargetOutputCapture]);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(OptionKeys[TargetOutputCapture]);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues <= 2, CommandLineOptionsException, "Unexpected parameters for target output capture option");
@ -253,8 +253,8 @@ namespace TestImpact
AZStd::unordered_set<AZStd::string> ParseSuitesFilter(const AZ::CommandLine& cmd)
{
AZStd::unordered_set<AZStd::string> suitesFilter;
const auto numSwitchValues = cmd.GetNumSwitchValues(OptionKeys[SuitesFilter]);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(OptionKeys[SuitesFilter]);
numSwitchValues)
{
for (auto i = 0; i < numSwitchValues; i++)
{
@ -460,4 +460,4 @@ namespace TestImpact
return help;
}
}
} // namespace TestImpact

@ -25,7 +25,7 @@ namespace TestImpact
//! The type of test sequence to run.
enum class TestSequenceType
{
None, //!< Runs no tests and will report a all tests successful.
None, //!< Runs no tests and will report all tests successful.
Seed, //!< Removes any prior coverage data and runs all test targets with instrumentation to reseed the data from scratch.
Regular, //!< Runs all of the test targets without any instrumentation to generate coverage data (any prior coverage data is left intact).
ImpactAnalysis, //!< Uses any prior coverage data to run the instrumented subset of selected tests (if no prior coverage data a regular run is performed instead).
@ -108,4 +108,4 @@ namespace TestImpact
AZStd::unordered_set<AZStd::string> m_suitesFilter;
bool m_safeMode = false;
};
}
} // namespace TestImpact

@ -12,13 +12,15 @@
#include <TestImpactCommandLineOptionsUtils.h>
#include <AzCore/std/string/conversions.h>
namespace TestImpact
{
//! Attempts to parse a path option value.
AZStd::optional<RepoPath> ParsePathOption(const AZStd::string& optionName, const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
if (numSwitchValues)
{
if (const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues == 1,
@ -40,22 +42,22 @@ namespace TestImpact
//! Attempts to pass an unsigned integer option value.
AZStd::optional<size_t> ParseUnsignedIntegerOption(const AZStd::string& optionName, const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues == 1,
CommandLineOptionsException,
AZStd::string::format("Unexpected number of parameters for %s option", optionName.c_str()));
const auto str = cmd.GetSwitchValue(optionName, 0);
char* end = nullptr;
auto value = strtoul(str.c_str(), &end, 0);
const auto strValue = cmd.GetSwitchValue(optionName, 0);
size_t successfulParse = 0; // Will be non-zero if the parse was successful
auto value = AZStd::stoul(strValue, &successfulParse, 0);
AZ_TestImpact_Eval(
end != str,
successfulParse,
CommandLineOptionsException,
AZStd::string::format("Couldn't parse unsigned integer option value: %s", str.c_str()));
AZStd::string::format("Couldn't parse unsigned integer option value: %s", strValue.c_str()));
return aznumeric_caster(value);
}
@ -74,4 +76,4 @@ namespace TestImpact
return AZStd::nullopt;
}
}
} // namespace TestImpact

@ -38,8 +38,8 @@ namespace TestImpact
const AZStd::pair<OptionValue<T>,
OptionValue<T>>& state, const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues == 1,
@ -47,13 +47,15 @@ namespace TestImpact
AZStd::string::format("Unexpected number of parameters for %s option", optionName.c_str()));
const auto option = cmd.GetSwitchValue(optionName, 0);
if (option == state.first.first)
if (const auto& [optionValueText, optionValue] = state.first;
option == optionValueText)
{
return state.first.second;
return optionValue;
}
else if (option == state.second.first)
if (const auto& [optionValueText, optionValue] = state.second;
option == optionValueText)
{
return state.second.second;
return optionValue;
}
throw CommandLineOptionsException(
@ -70,8 +72,8 @@ namespace TestImpact
const AZStd::vector<AZStd::pair<AZStd::string, T>>& states,
const AZ::CommandLine& cmd)
{
const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
if (numSwitchValues)
if (const auto numSwitchValues = cmd.GetNumSwitchValues(optionName);
numSwitchValues)
{
AZ_TestImpact_Eval(
numSwitchValues == 1,
@ -81,9 +83,10 @@ namespace TestImpact
const auto option = cmd.GetSwitchValue(optionName, 0);
for (const auto& state : states)
{
if (option == state.first)
if (const auto& [optionValueText, optionValue] = state;
option == optionValueText)
{
return state.second;
return optionValue;
}
}
@ -116,4 +119,4 @@ namespace TestImpact
//! Attempts to parse an option value in seconds.
AZStd::optional<AZStd::chrono::milliseconds> ParseSecondsOption(const AZStd::string& optionName, const AZ::CommandLine& cmd);
}
} // namespace TestImpact

Loading…
Cancel
Save