Commit f8884501 authored by Marco Bubke's avatar Marco Bubke

Clang: Add Google Benchmark unit tests

Change-Id: I5d137aebd3e94f5d2f867d8ec007973a827491ec
Reviewed-by: default avatarTim Jenssen <tim.jenssen@theqtcompany.com>
parent 1eac1e60
GOOGLEBENCHMARK_DIR = $$(GOOGLEBENCHMARK_DIR)
exists($$GOOGLEBENCHMARK_DIR) {
INCLUDEPATH += $$GOOGLEBENCHMARK_DIR/include
DEFINES += HAVE_STD_REGEX WITH_BENCHMARKS
SOURCES += \
$$GOOGLEBENCHMARK_DIR/src/benchmark.cc \
$$GOOGLEBENCHMARK_DIR/src/colorprint.cc \
$$GOOGLEBENCHMARK_DIR/src/commandlineflags.cc \
$$GOOGLEBENCHMARK_DIR/src/console_reporter.cc \
$$GOOGLEBENCHMARK_DIR/src/csv_reporter.cc \
$$GOOGLEBENCHMARK_DIR/src/json_reporter.cc \
$$GOOGLEBENCHMARK_DIR/src/log.cc \
$$GOOGLEBENCHMARK_DIR/src/reporter.cc \
$$GOOGLEBENCHMARK_DIR/src/re_std.cc \
$$GOOGLEBENCHMARK_DIR/src/sleep.cc \
$$GOOGLEBENCHMARK_DIR/src/string_util.cc \
$$GOOGLEBENCHMARK_DIR/src/sysinfo.cc \
$$GOOGLEBENCHMARK_DIR/src/walltime.cc
win32:LIBS += -lShlwapi
}
......@@ -31,6 +31,10 @@
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
#ifdef WITH_BENCHMARKS
#include <benchmark/benchmark_api.h>
#endif
int main(int argc, char *argv[])
{
Sqlite::registerTypes();
......@@ -39,6 +43,17 @@ int main(int argc, char *argv[])
QLoggingCategory::setFilterRules(QStringLiteral("*.info=false\n*.debug=false\n*.warning=false"));
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
testing::InitGoogleTest(&argc, argv);
#ifdef WITH_BENCHMARKS
benchmark::Initialize(&argc, argv);
#endif
int testsHaveErrors = RUN_ALL_TESTS();
#ifdef WITH_BENCHMARKS
if (testsHaveErrors == 0 && application.arguments().contains(QStringLiteral("--with-benchmarks")))
benchmark::RunSpecifiedBenchmarks();
#endif
return testsHaveErrors;
}
......@@ -3,11 +3,14 @@ INCLUDEPATH += ../mockup
include(gmock_dependency.pri)
include(clang_dependency.pri)
include(creator_dependency.pri)
include(benchmark_dependency.pri)
QT += core network testlib widgets
CONFIG += console c++14 testcase
CONFIG += console c++14 testcase object_parallel_to_source
CONFIG -= app_bundle
OBJECTS_DIR = $$OUT_PWD/obj # workaround for qmake bug in object_parallel_to_source
osx:QMAKE_CXXFLAGS = -stdlib=libc++
DEFINES += \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment