Skip to content

Commit

Permalink
Add CI for builds without error logging enabled. (project-chip#13717)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and selissia committed Jan 28, 2022
1 parent 4c12628 commit 0aa6903
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ jobs:
- name: Run Build Without Progress Logging
timeout-minutes: 20
run: scripts/run_in_build_env.sh "ninja -C ./out"
- name: Setup Build Without Error Logging
run: scripts/build/gn_gen.sh --args="chip_detail_logging=false chip_progress_logging=false chip_error_logging=false"
- name: Run Build Without Error Logging
timeout-minutes: 20
run: scripts/run_in_build_env.sh "ninja -C ./out"
build_linux:
name: Build on Linux (fake, gcc_release, clang, mbedtls, simulated)
timeout-minutes: 90
Expand Down
4 changes: 3 additions & 1 deletion src/controller/python/chip/native/StackInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ void pychip_native_init()
{
ChipLogError(DeviceLayer, "Failed to initialize CHIP stack: platform init failed: %s", chip::ErrorStr(err));
}
int result = pthread_create(&sPlatformMainThread, nullptr, PlatformMainLoop, nullptr);
int result = pthread_create(&sPlatformMainThread, nullptr, PlatformMainLoop, nullptr);
#if CHIP_ERROR_LOGGING
int tmpErrno = errno;
#endif // CHIP_ERROR_LOGGING

if (result != 0)
{
Expand Down
2 changes: 2 additions & 0 deletions src/crypto/CHIPCryptoPALOpenSSL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,15 @@ static void _logSSLError()
unsigned long ssl_err_code = ERR_get_error();
while (ssl_err_code != 0)
{
#if CHIP_ERROR_LOGGING
const char * err_str_lib = ERR_lib_error_string(ssl_err_code);
const char * err_str_routine = ERR_func_error_string(ssl_err_code);
const char * err_str_reason = ERR_reason_error_string(ssl_err_code);
if (err_str_lib)
{
ChipLogError(Crypto, " ssl err %s %s %s\n", err_str_lib, err_str_routine, err_str_reason);
}
#endif // CHIP_ERROR_LOGGING
ssl_err_code = ERR_get_error();
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib/dnssd/minimal_mdns/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ CHIP_ERROR JoinMulticastGroup(chip::Inet::InterfaceId interfaceId, chip::Inet::U
return endpoint->JoinMulticastGroup(interfaceId, address);
}

#if CHIP_ERROR_LOGGING
const char * AddressTypeStr(chip::Inet::IPAddressType addressType)
{
switch (addressType)
Expand All @@ -179,6 +180,7 @@ const char * AddressTypeStr(chip::Inet::IPAddressType addressType)
return "UNKNOWN";
}
}
#endif

} // namespace

Expand Down
4 changes: 3 additions & 1 deletion src/messaging/ReliableMessageMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,10 @@ void ReliableMessageMgr::ExecuteActions()

VerifyOrDie(!entry->retainedBuf.IsNull());

uint8_t sendCount = entry->sendCount;
uint8_t sendCount = entry->sendCount;
#if CHIP_ERROR_LOGGING || CHIP_DETAIL_LOGGING
uint32_t messageCounter = entry->retainedBuf.GetMessageCounter();
#endif // CHIP_ERROR_LOGGING || CHIP_DETAIL_LOGGING

if (sendCount == CHIP_CONFIG_RMP_DEFAULT_MAX_RETRANS)
{
Expand Down
8 changes: 8 additions & 0 deletions src/platform/Linux/bluez/Helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,9 @@ static gboolean BluezCharacteristicAcquireWrite(BluezGattCharacteristic1 * aChar
{
int fds[2] = { -1, -1 };
GIOChannel * channel;
#if CHIP_ERROR_LOGGING
char * errStr;
#endif // CHIP_ERROR_LOGGING
GVariantDict options;
bool isSuccess = false;
BluezConnection * conn = nullptr;
Expand All @@ -438,7 +440,9 @@ static gboolean BluezCharacteristicAcquireWrite(BluezGattCharacteristic1 * aChar

if (socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, 0, fds) < 0)
{
#if CHIP_ERROR_LOGGING
errStr = strerror(errno);
#endif // CHIP_ERROR_LOGGING
ChipLogError(DeviceLayer, "FAIL: socketpair: %s in %s", errStr, __func__);
g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "FD creation failed");
goto exit;
Expand Down Expand Up @@ -490,7 +494,9 @@ static gboolean BluezCharacteristicAcquireNotify(BluezGattCharacteristic1 * aCha
{
int fds[2] = { -1, -1 };
GIOChannel * channel;
#if CHIP_ERROR_LOGGING
char * errStr;
#endif // CHIP_ERROR_LOGGING
GVariantDict options;
BluezConnection * conn = nullptr;
bool isSuccess = false;
Expand All @@ -515,7 +521,9 @@ static gboolean BluezCharacteristicAcquireNotify(BluezGattCharacteristic1 * aCha
}
if (socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_NONBLOCK | SOCK_CLOEXEC, 0, fds) < 0)
{
#if CHIP_ERROR_LOGGING
errStr = strerror(errno);
#endif // CHIP_ERROR_LOGGING
ChipLogError(DeviceLayer, "FAIL: socketpair: %s in %s", errStr, __func__);
g_dbus_method_invocation_return_dbus_error(aInvocation, "org.bluez.Error.Failed", "FD creation failed");
goto exit;
Expand Down
4 changes: 3 additions & 1 deletion src/platform/Linux/bluez/MainLoop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ CHIP_ERROR MainLoop::EnsureStarted()
}

int pthreadErr = pthread_create(&mThread, nullptr, &MainLoop::Thread, reinterpret_cast<void *>(this));
int tmpErrno = errno;
#if CHIP_ERROR_LOGGING
int tmpErrno = errno;
#endif // CHIP_ERROR_LOGGING
if (pthreadErr != 0)
{
ChipLogError(DeviceLayer, "FAIL: pthread_create (%s) in %s", strerror(tmpErrno), __func__);
Expand Down

0 comments on commit 0aa6903

Please sign in to comment.