Skip to content

Conversation

@gang-tao
Copy link
Contributor

@gang-tao gang-tao commented Jan 5, 2026

Pre-submission checklist

  • [Done ] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • [Done] pre-commit run
    clang-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

  1. 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

  2. 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

  1. port without transceivers, will report error:
    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

@meta-cla meta-cla bot added the CLA Signed label Jan 5, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 6, 2026

@joseph5wu has imported this pull request. If you are a Meta employee, you can view this in D90211862.

@birdsoup
Copy link
Contributor

birdsoup commented Jan 7, 2026

Which ports are returning nullopt from getTranscieverIdx? If these ports have transceivers, then there's probably some configuration we need to fix. If these are backplane ports, we should probably explicitly skip adding those to the transceivers list and add a CHECK(tcvr_id) for any ports that do have transceivers

@gang-tao
Copy link
Contributor Author

gang-tao commented Jan 7, 2026

Hi @birdsoup
Thank you for the review.
These ports are backplane ports, and ports without transceivers should be the same.
I plan to follow "std::vector getTransceiverIds", plus "CHECK(tid.has_value());"
what do you think?

@gang-tao gang-tao force-pushed the ladakh800bcls_retimer_dev branch from 81dcc7e to 89ac180 Compare January 8, 2026 01:09
@facebook-github-bot
Copy link
Contributor

@gang-tao has updated the pull request. You must reimport the pull request before landing.

@gang-tao
Copy link
Contributor Author

Hi @birdsoup
I have updated as your comments, could you help to check again?
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants