(qsfp_hw_test):fix random failure in EmptyHwTest.CheckInit #779
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runclang-format.............................................................Passed
black................................................(no files to check)Skipped
shellcheck...........................................(no files to check)Skipped
shfmt................................................(no files to check)Skipped
trim trailing whitespace.................................................Passed
fix end of files.........................................................Passed
check yaml...........................................(no files to check)Skipped
check json...........................................(no files to check)Skipped
check for merge conflicts................................................Passed
ruff check...........................................(no files to check)Skipped
Summary
When running qsfp_hw_test, if the port for transceiverid is not configured, the test will fail randomly.
Motivation
From function std::optional getTranscieverIdx, it will return nullopt if the transceiverIds is empty.
when it is nullopt, in std::vector getCabledPortTranceivers
transceivers.insert(*getTranscieverIdx(port, ensemble)); will insert a random value, which will cause the case fail.
Test Plan
command:
TS=(date +%Y%m%d_%H%M%S) LD_LIBRARY_PATH=/root/gangtao/opt/fboss/lib/ /root/gangtao/img/qsfp_hw_test --qsfp-config /root/gangtao/cfg/qsfp-p2.conf --gtest_filter=EmptyHwTest.CheckInit --enable_sai_log DEBUG --sai_log /root/gangtao/log/sai_replayer_{TS}.log --enable_replayer=true --phy_config_file=/root/gangtao/cfg/retimer.conf --logging=DBG5 2>&1 | tee /root/gangtao/log/qsfp_hwtest_${TS}.log
port with transceivers, will pass.
V0108 06:30:45.620086 93215 SaiApi.h:172] removed SAI object: SwitchSaiId(2383629127551811584)
[ OK ] EmptyHwTest.CheckInit (535874 ms)
[----------] 1 test from EmptyHwTest (535874 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (535874 ms total)
[ PASSED ] 1 test.
/var/FBOSS/retimer/PAI_4.0/src/brcm_pai_adapter.c:279 sai_api_uninitialize: :> enter
/var/FBOSS/retimer/PAI_4.0/src/brcm_pai_adapter.c:284 sai_api_uninitialize: :< exit
F20260107 06:36:26.031422 356612 HwPortUtils.cpp:291] Check failed: tid.has_value()
*** Check failure stack trace: ***
*** Aborted at 1767785786 (Unix time, try 'date -d @1767785786') ***
*** Signal 6 (SIGABRT) (0x57104) received by PID 356612 (pthread TID 0x7f2f2b83c8c0) (linux TID 356612) (maybe from PID 356612, UID 0) (code: -6), stack trace: ***
@ 00000000038b747e folly::symbolizer::(anonymous namespace)::signalHandler(int, siginfo_t*, void*)
/var/FBOSS/tmp_bld_dir/scratch/repos/github.com-facebook-folly.git/folly/debugging/symbolizer/SignalHandler.cpp:526
@ 000000000003fc2f (unknown)
@ 000000000008d03c __pthread_kill_implementation
@ 000000000003fb85 raise
@ 0000000000029872 abort
@ 00000000004993d3 folly::(anonymous namespace)::wrapped_abort()
/var/FBOSS/tmp_bld_dir/scratch/repos/github.com-facebook-folly.git/folly/init/Init.cpp:53
@ 000000000000b6fd google::LogMessage::Fail()
@ 000000000000e1f0 google::LogMessage::SendToLog()
@ 000000000000b5cd google::LogMessage::Flush()
@ 000000000000b875 google::LogMessageFatal::~LogMessageFatal()
@ 0000000000738c51 facebook::fboss::utility::getCabledPortTranceivers(facebook::fboss::HwQsfpEnsemble const*)
/var/FBOSS/fboss/fboss/qsfp_service/test/hw_test/HwPortUtils.cpp:291
@ 000000000077b225 facebook::fboss::HwTest::waitTillCabledTcvrProgrammed(int, bool)
/var/FBOSS/fboss/fboss/qsfp_service/test/hw_test/HwTest.cpp:195
@ 00000000007792f5 facebook::fboss::HwTest::SetUp()
/var/FBOSS/fboss/fboss/qsfp_service/test/hw_test/HwTest.cpp:85
@ 0000000000857d66 void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::)(), char const)
@ 000000000084b5f6 testing::Test::Run()
@ 000000000084b72d testing::TestInfo::Run()
@ 000000000084b857 testing::TestSuite::Run()
@ 0000000000851e05 testing::internal::UnitTestImpl::RunAllTests()
@ 000000000085810e bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::)(), char const)
@ 000000000084b974 testing::UnitTest::Run()
@ 000000000049d420 main
@ 000000000002a60f __libc_start_call_main
@ 000000000002a6bf __libc_start_main
@ 00000000006d0124 _start