From dbe479f5830a6a32737410ce0dda6e0f5263787d Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Tue, 4 Oct 2022 15:24:31 -0700 Subject: [PATCH 1/2] core tests --- .../perf/test/inc/azure/perf/test/delay_test.hpp | 12 +++++++----- .../perf/test/inc/azure/perf/test/no_op_test.hpp | 16 +++++++++++++++- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sdk/core/perf/test/inc/azure/perf/test/delay_test.hpp b/sdk/core/perf/test/inc/azure/perf/test/delay_test.hpp index 4d779f1106..02ec8ec918 100644 --- a/sdk/core/perf/test/inc/azure/perf/test/delay_test.hpp +++ b/sdk/core/perf/test/inc/azure/perf/test/delay_test.hpp @@ -56,7 +56,7 @@ namespace Azure { namespace Perf { namespace Test { { // Increment the counter and fetch the value, then remove 1 to get the previous-increment // value - auto instanceCount = _detail::DelayTestInstanceCount.fetch_add(1) - 1; + auto instanceCount = _detail::DelayTestInstanceCount.fetch_add(0); // default value if option is not parsed is 1000 auto initialDelay = m_options.GetOptionOrDefault("InitialDelayMs", 1000); auto instanceGrowFactor = m_options.GetOptionOrDefault("InstanceGrowthFactor", 1); @@ -67,7 +67,9 @@ namespace Azure { namespace Perf { namespace Test { * @brief The test definition * */ - void Run(Azure::Core::Context const&) override { std::this_thread::sleep_for(m_delay); } + void Run(Azure::Core::Context const&) override { + std::this_thread::sleep_for(m_delay); + } /** * @brief Define the test options for the test. @@ -78,16 +80,16 @@ namespace Azure { namespace Perf { namespace Test { { return { {"InitialDelayMs", - {"--delay"}, + {"-m"}, "Initial delay (in milliseconds). Default to 1000 (1sec)", 1}, {"InstanceGrowthFactor", - {"--infactor"}, + {"-n"}, "Instance growth factor. The delay of instance N will be (InitialDelayMS * " "(InstanceGrowthFactor ^ InstanceCount)). Default to 1", 1}, {"IterationGrowthFactor", - {"--itfactor"}, + {"-t"}, "Initial delay (in milliseconds). The delay of iteration N will be (InitialDelayMS * " "(IterationGrowthFactor ^ IterationCount)). Default to 1", 1}}; diff --git a/sdk/core/perf/test/inc/azure/perf/test/no_op_test.hpp b/sdk/core/perf/test/inc/azure/perf/test/no_op_test.hpp index 1910ec3cf2..adcc9e5cd2 100644 --- a/sdk/core/perf/test/inc/azure/perf/test/no_op_test.hpp +++ b/sdk/core/perf/test/inc/azure/perf/test/no_op_test.hpp @@ -32,7 +32,21 @@ namespace Azure { namespace Perf { namespace Test { * @brief Define an empty test. * */ - void Run(Azure::Core::Context const&) override {} + void Run(Azure::Core::Context const&) override + { // Get the option or a default value of 0 + auto myTestOption = m_options.GetOptionOrDefault("extraOption", 0); + (void)myTestOption; + } + + /** + * @brief Define the test options for the test. + * + * @return The list of test options. + */ + std::vector GetTestOptions() override + { + return {{"extraOption", {"-e"}, "Example for extended option for test.", 1}}; + } /** * @brief Get the static Test Metadata for the test. From 1da9b19e80801275bff9346fcf140656e28dc2d0 Mon Sep 17 00:00:00 2001 From: George Arama <50641385+gearama@users.noreply.github.com> Date: Fri, 7 Oct 2022 16:04:28 -0700 Subject: [PATCH 2/2] clang --- sdk/core/perf/test/inc/azure/perf/test/delay_test.hpp | 9 ++------- sdk/core/perf/test/inc/azure/perf/test/no_op_test.hpp | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/sdk/core/perf/test/inc/azure/perf/test/delay_test.hpp b/sdk/core/perf/test/inc/azure/perf/test/delay_test.hpp index 02ec8ec918..9a21179cd8 100644 --- a/sdk/core/perf/test/inc/azure/perf/test/delay_test.hpp +++ b/sdk/core/perf/test/inc/azure/perf/test/delay_test.hpp @@ -67,9 +67,7 @@ namespace Azure { namespace Perf { namespace Test { * @brief The test definition * */ - void Run(Azure::Core::Context const&) override { - std::this_thread::sleep_for(m_delay); - } + void Run(Azure::Core::Context const&) override { std::this_thread::sleep_for(m_delay); } /** * @brief Define the test options for the test. @@ -79,10 +77,7 @@ namespace Azure { namespace Perf { namespace Test { std::vector GetTestOptions() override { return { - {"InitialDelayMs", - {"-m"}, - "Initial delay (in milliseconds). Default to 1000 (1sec)", - 1}, + {"InitialDelayMs", {"-m"}, "Initial delay (in milliseconds). Default to 1000 (1sec)", 1}, {"InstanceGrowthFactor", {"-n"}, "Instance growth factor. The delay of instance N will be (InitialDelayMS * " diff --git a/sdk/core/perf/test/inc/azure/perf/test/no_op_test.hpp b/sdk/core/perf/test/inc/azure/perf/test/no_op_test.hpp index adcc9e5cd2..f3875cda41 100644 --- a/sdk/core/perf/test/inc/azure/perf/test/no_op_test.hpp +++ b/sdk/core/perf/test/inc/azure/perf/test/no_op_test.hpp @@ -38,7 +38,7 @@ namespace Azure { namespace Perf { namespace Test { (void)myTestOption; } - /** + /** * @brief Define the test options for the test. * * @return The list of test options.