From 6ba25325101ec677118f2bfcf61cf62cbe9f5aff Mon Sep 17 00:00:00 2001 From: Elangovan Natarajan Date: Wed, 14 Aug 2024 13:10:55 -0700 Subject: [PATCH] Modify AgentEnsembleTest and AgentHwTest teardown to check for warmboot flag Summary: Currently, all of Agent Hw test relies on verifyAcrosswarmboots and so they dont worry about the TearDown implementation. If any test relied on AgentHwTest or AgentEnsembleTest teardown, then they wont be able to support warmboot because it always exits in an non graceful manner. Modify AgentEnsembleTest and AgentHwTest teardown to check for warmboot flag and pass in option to exit gracefully Reviewed By: zechengh09 Differential Revision: D60946407 fbshipit-source-id: 2b4064a13ee403e2d8750c23252dc956acbdf394 --- fboss/agent/test/AgentEnsembleTest.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/fboss/agent/test/AgentEnsembleTest.cpp b/fboss/agent/test/AgentEnsembleTest.cpp index c81ba55416428..d1d397e645b94 100644 --- a/fboss/agent/test/AgentEnsembleTest.cpp +++ b/fboss/agent/test/AgentEnsembleTest.cpp @@ -65,7 +65,13 @@ void AgentEnsembleTest::TearDown() { (::testing::Test::HasFailure() && FLAGS_run_forever_on_failure)) { runForever(); } - tearDownAgentEnsemble(); + if (FLAGS_setup_for_warmboot && + isSupportedOnAllAsics(HwAsic::Feature::WARMBOOT)) { + XLOG(DBG2) << "tearDownAgentEnsemble() for warmboot"; + tearDownAgentEnsemble(true); + } else { + tearDownAgentEnsemble(); + } } void AgentEnsembleTest::tearDownAgentEnsemble(bool doWarmboot) {