devel/android-tools-adb-devel: add unit tests like simpleperf

This commit is contained in:
Jan Beich 2015-09-18 15:42:48 +00:00
parent da558e943d
commit f29768c111
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=397252
6 changed files with 64 additions and 1 deletions

View file

@ -18,5 +18,14 @@ BUILD_WRKSRC= ${WRKSRC}/adb
INSTALL_WRKSRC= ${BUILD_WRKSRC}
MAKE_ENV= FILESDIR="${FILESDIR}"
CFLAGS+= -DADB_REVISION='\"${DISTVERSIONFULL}\"'
ALL_TARGET= all
OPTIONS_DEFINE= TEST
TEST_BUILD_DEPENDS=googletest>=1.6.0:${PORTSDIR}/devel/googletest
TEST_ALL_TARGET=adb_test
pre-install-TEST-on:
${BUILD_WRKSRC}/adb_test
.include "${MASTERDIR}/Makefile"

View file

@ -22,6 +22,13 @@ SRCS+= transport.cpp
SRCS+= transport_local.cpp
SRCS+= transport_usb.cpp
TEST_SRCS+= adb_io_test.cpp
TEST_SRCS+= adb_utils_test.cpp
TEST_SRCS+= fdevent_test.cpp
TEST_SRCS+= shell_service_protocol_test.cpp
TEST_SRCS+= transport_test.cpp
CFLAGS.shell_service_protocol_test.cpp+= -Dsighandler_t=sig_t
.PATH: ${.CURDIR}/client
SRCS+= main.cpp
@ -34,6 +41,12 @@ SRCS+= file.cpp
SRCS+= logging.cpp
SRCS+= strings.cpp
SRCS+= stringprintf.cpp
TEST_SRCS+= file_test.cpp
TEST_SRCS+= logging_test.cpp
TEST_SRCS+= stringprintf_test.cpp
TEST_SRCS+= strings_test.cpp
TEST_SRCS+= test_main.cpp
TEST_SRCS+= test_utils.cpp
.PATH: ${.CURDIR}/../libcutils
SRCS+= socket_inaddr_any_server.c
@ -65,7 +78,18 @@ CFLAGS+=${CFLAGS.${.IMPSRC:T}}
CXXFLAGS+= -std=gnu++11
CXXFLAGS+= ${CFLAGS:N-std*}
TEST_CFLAGS+= $$(${GTEST_CONFIG} --cppflags)
.for f in ${TEST_SRCS}
CFLAGS.${f}+= ${TEST_CFLAGS}
.endfor
LDADD+= -lcrypto -lpthread -lusb -lz
DPADD+= ${LIBCRYPTO} ${LIBPTHREAD} ${LIBUSB} ${LIBZ}
TEST_LDADD+= $$(${GTEST_CONFIG} --libs --ldflags)
GTEST_CONFIG?= gtest-config
adb_test: ${SRCS:R:S/$/.o/:Nmain.o:Ncommandline.o} ${TEST_SRCS:R:S/$/.o/}
${CXX} ${CXXFLAGS} ${LDFLAGS} -o $@ $> ${LDADD} ${TEST_LDADD}
.include <bsd.prog.mk>

View file

@ -0,0 +1,10 @@
--- adb/adb_io_test.cpp.orig 2015-09-05 00:01:27 UTC
+++ adb/adb_io_test.cpp
@@ -18,6 +18,7 @@
#include <gtest/gtest.h>
+#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>

View file

@ -0,0 +1,10 @@
--- base/logging_test.cpp.orig 2015-09-17 22:58:36 UTC
+++ base/logging_test.cpp
@@ -16,6 +16,7 @@
#include "base/logging.h"
+#include <errno.h>
#include <libgen.h>
#include <regex>

View file

@ -0,0 +1,10 @@
--- base/stringprintf_test.cpp.orig 2015-09-17 22:58:36 UTC
+++ base/stringprintf_test.cpp
@@ -18,6 +18,7 @@
#include <gtest/gtest.h>
+#include <errno.h>
#include <string>
TEST(StringPrintfTest, HexSizeT) {

View file

@ -32,7 +32,7 @@ PLIST_FILES= bin/adb \
%%BASH%%etc/bash_completion.d/adb
PORTDOCS= *.txt *.TXT
OPTIONS_DEFINE= BASH DOCS
OPTIONS_DEFINE+=BASH DOCS
OPTIONS_SUB= yes
BASH_VARS= LICENSE+=MIT LICENSE_COMB=multi # debian/copyright