Skip to content

Commit

Permalink
Fix compilation on Buster (#1449)
Browse files Browse the repository at this point in the history
There are two issues causing compilation failures of sairedis on Buster. Since the SONiC PTF container is still based on Buster, sairedis still needs to compile for Buster.

For the first issue, when generating Python bindings through SWIG on Buster, the sai_struct_member_info_t and sai_object_type_info_t struct cause issues during compilation on Buster. The errors stem from function pointers being used, but I'm not certain on the exact reason why these two specific structs have issues.

Instead of debugging further at this point, skip these two structs for now. We won't need it in the near future. Alternatively, once the Buster build is no longer needed, these lines can be removed.

For the second issue, the TestSyncd.cpp file uses the MOCK_METHOD macro. However, this macro is available only from version 1.10 of gmock, but Buster has version 1.8.1. As a simple fix, check to see if MOCK_METHOD is defined; if not, then don't compile this test.

ADO: 30055338
  • Loading branch information
saiarcot895 authored Oct 30, 2024
1 parent 4d504ff commit e394ced
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pyext/pysairedis.i
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
%include "cpointer.i"
%include "carrays.i"

// These objects cause issues on Buster because of the function pointers
%ignore _sai_struct_member_info_t;
%ignore _sai_object_type_info_t;

%{
#pragma GCC optimize("no-var-tracking-assignments")

Expand Down
4 changes: 3 additions & 1 deletion unittest/syncd/TestSyncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ TEST(Syncd, inspectAsic)

using namespace syncd;

#ifdef MOCK_METHOD
class MockSelectableChannel : public sairedis::SelectableChannel {
public:
MOCK_METHOD(bool, empty, (), (override));
Expand Down Expand Up @@ -257,4 +258,5 @@ TEST_F(SyncdTest, processNotifySyncd)
kfvOp(kco) = REDIS_ASIC_STATE_COMMAND_NOTIFY;
}));
syncd_object.processEvent(consumer);
}
}
#endif

0 comments on commit e394ced

Please sign in to comment.