From c0d6d03b7e145a792a26265804faf38e7bf4f2ce Mon Sep 17 00:00:00 2001 From: AYA Date: Wed, 19 Jun 2024 11:15:06 +0200 Subject: [PATCH] allowing chip_with_nlfaultinjection for chip_build_tools --- build/chip/tests.gni | 5 +++-- src/inet/tests/BUILD.gn | 1 - src/inet/tests/TestInetCommonOptions.cpp | 6 ------ 3 files changed, 3 insertions(+), 9 deletions(-) mode change 100644 => 100755 build/chip/tests.gni mode change 100644 => 100755 src/inet/tests/BUILD.gn mode change 100644 => 100755 src/inet/tests/TestInetCommonOptions.cpp diff --git a/build/chip/tests.gni b/build/chip/tests.gni old mode 100644 new mode 100755 index 61a2ad3e685682..8fb77932662634 --- a/build/chip/tests.gni +++ b/build/chip/tests.gni @@ -15,6 +15,7 @@ import("//build_overrides/build.gni") import("//build_overrides/chip.gni") +import("${chip_root}/build/chip/tools.gni") import("${chip_root}/src/platform/device.gni") declare_args() { @@ -40,6 +41,6 @@ declare_args() { } declare_args() { - # Enable use of nlfaultinjection. - chip_with_nlfaultinjection = chip_build_tests + # Enable use of nlfaultinjection when building tests or when building tools. + chip_with_nlfaultinjection = chip_build_tests || chip_build_tools } diff --git a/src/inet/tests/BUILD.gn b/src/inet/tests/BUILD.gn old mode 100644 new mode 100755 index 7774764fe4faff..46ed3f420e6bc1 --- a/src/inet/tests/BUILD.gn +++ b/src/inet/tests/BUILD.gn @@ -51,7 +51,6 @@ static_library("helpers") { "${chip_root}/src/inet", "${chip_root}/src/lib/core", "${chip_root}/src/platform", - "${nlfaultinjection_root}:nlfaultinjection", ] if (chip_with_nlfaultinjection) { diff --git a/src/inet/tests/TestInetCommonOptions.cpp b/src/inet/tests/TestInetCommonOptions.cpp old mode 100644 new mode 100755 index 7e4648d7466b1b..0e6909f60d97c7 --- a/src/inet/tests/TestInetCommonOptions.cpp +++ b/src/inet/tests/TestInetCommonOptions.cpp @@ -199,13 +199,11 @@ bool NetworkOptions::HandleOption(const char * progName, OptionSet * optSet, int FaultInjectionOptions::FaultInjectionOptions() { static OptionDef optionDefs[] = { -#if CHIP_CONFIG_TEST || CHIP_SYSTEM_CONFIG_TEST || INET_CONFIG_TEST { "faults", kArgumentRequired, kToolCommonOpt_FaultInjection }, { "iterations", kArgumentRequired, kToolCommonOpt_FaultTestIterations }, { "debug-resource-usage", kNoArgument, kToolCommonOpt_DebugResourceUsage }, { "print-fault-counters", kNoArgument, kToolCommonOpt_PrintFaultCounters }, { "extra-cleanup-time", kArgumentRequired, kToolCommonOpt_ExtraCleanupTime }, -#endif {} }; OptionDefs = optionDefs; @@ -213,7 +211,6 @@ FaultInjectionOptions::FaultInjectionOptions() HelpGroupName = "FAULT INJECTION OPTIONS"; OptionHelp = -#if CHIP_CONFIG_TEST || CHIP_SYSTEM_CONFIG_TEST || INET_CONFIG_TEST " --faults \n" " Inject specified fault(s) into the operation of the tool at runtime.\n" "\n" @@ -233,7 +230,6 @@ FaultInjectionOptions::FaultInjectionOptions() " should fail a normal happy-sequence test, but not necessarily a fault-injection test.\n" " The value is in milliseconds; a common value is 10000.\n" "\n" -#endif ""; // Defaults @@ -253,7 +249,6 @@ bool FaultInjectionOptions::HandleOption(const char * progName, OptionSet * optS switch (id) { -#if CHIP_CONFIG_TEST || CHIP_SYSTEM_CONFIG_TEST || INET_CONFIG_TEST case kToolCommonOpt_FaultInjection: { chip::Platform::ScopedMemoryString mutableArg(arg, strlen(arg)); assert(mutableArg); @@ -285,7 +280,6 @@ bool FaultInjectionOptions::HandleOption(const char * progName, OptionSet * optS return false; } break; -#endif // CHIP_CONFIG_TEST || CHIP_SYSTEM_CONFIG_TEST || INET_CONFIG_TEST default: PrintArgError("%s: INTERNAL ERROR: Unhandled option: %s\n", progName, name); return false;