Skip to content

Commit 0df8da1

Browse files
saiarcot895shiraez
authored andcommitted
Fix compilation on Buster (sonic-net#1449)
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
1 parent bfa4342 commit 0df8da1

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

pyext/pysairedis.i

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
%include "cpointer.i"
33
%include "carrays.i"
44

5+
// These objects cause issues on Buster because of the function pointers
6+
%ignore _sai_struct_member_info_t;
7+
%ignore _sai_object_type_info_t;
8+
59
%{
610
#pragma GCC optimize("no-var-tracking-assignments")
711

unittest/syncd/TestSyncd.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ TEST(Syncd, inspectAsic)
210210

211211
using namespace syncd;
212212

213+
#ifdef MOCK_METHOD
213214
class MockSelectableChannel : public sairedis::SelectableChannel {
214215
public:
215216
MOCK_METHOD(bool, empty, (), (override));
@@ -257,4 +258,5 @@ TEST_F(SyncdTest, processNotifySyncd)
257258
kfvOp(kco) = REDIS_ASIC_STATE_COMMAND_NOTIFY;
258259
}));
259260
syncd_object.processEvent(consumer);
260-
}
261+
}
262+
#endif

0 commit comments

Comments
 (0)