Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ef9f725f authored by Arman Uguray's avatar Arman Uguray
Browse files

build: Build net_test_osi using GN + ninja

This CL adds support to build the net_test_osi target using GN + ninja.
The BUILD.gn file now pulls in gtest as a dependency. Missing libc
includes have been added to sources that prevented compilation on
Goobuntu (14.04).

The osi/include/log.h header has been modified to conditionally call the
Android log utilities vs plain-old printf on non-Android builds.

BUG=21339022

Change-Id: If3c356360c56c63b3bf551b41dc8d3269d8e7e09
parent ecff3f70
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -41,9 +41,12 @@ source_set("osi") {
    "include",
    "//"
  ]

  libs = [ "-lpthread", "-lrt" ]
}

executable("net_test_osi") {
  testonly = true
  sources = [
    "test/AlarmTestHarness.cpp",
    "test/AllocationTestHarness.cpp",
@@ -68,6 +71,7 @@ executable("net_test_osi") {

  deps = [
    "//osi",
    "//testing/gtest:gtest_main",
  ]

  libs = [ "-lpthread", "-lrt" ]
+22 −0
Original line number Diff line number Diff line
@@ -18,6 +18,25 @@

#pragma once

/*
 * TODO(armansito): Work-around until we figure out a way to generate logs in a
 * platform-independent manner.
 */
#if defined(OS_GENERIC)

/* syslog didn't work well here since we would be redefining LOG_DEBUG. */
#include <stdio.h>

#define LOGWRAPPER(fmt, args...) fprintf(stderr, fmt "\n", ## args)

#define LOG_VERBOSE(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_DEBUG(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_INFO(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_WARN(...) LOGWRAPPER(__VA_ARGS__)
#define LOG_ERROR(...) LOGWRAPPER(__VA_ARGS__)

#else

#include <cutils/log.h>

#define LOG_VERBOSE(...) ALOGV(__VA_ARGS__)
@@ -25,3 +44,6 @@
#define LOG_INFO(...)    ALOGI(__VA_ARGS__)
#define LOG_WARN(...)    ALOGW(__VA_ARGS__)
#define LOG_ERROR(...)   ALOGE(__VA_ARGS__)


#endif
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@
#include <string.h>
#include <signal.h>
#include <time.h>
#include <pthread.h>

#include "osi/include/alarm.h"
#include "osi/include/allocator.h"
+1 −0
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include "osi/include/allocator.h"
#include "osi/include/config.h"
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <errno.h>
#include <stddef.h>
#include <string.h>
#include <unistd.h>
#include <sys/eventfd.h>

#include "osi/include/allocator.h"
Loading