diff --git a/CMakeLists.txt b/CMakeLists.txt index 56eadf738..cb57de364 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -144,6 +144,7 @@ add_subdirectory(src) if (BUILD_TESTING) add_subdirectory(autotests) + add_subdirectory(tests/benchmarks) endif() feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/tests/benchmarks/CMakeLists.txt b/tests/benchmarks/CMakeLists.txt new file mode 100644 index 000000000..d9aa15a8c --- /dev/null +++ b/tests/benchmarks/CMakeLists.txt @@ -0,0 +1,18 @@ +set(falkon_benchmarks_SRCS ) + +qt5_add_resources(falkon_benchmarks_SRCS benchmarks.qrc) + +macro(falkon_benchmarks) + foreach(_benchmarkname ${ARGN}) + add_executable(${_benchmarkname} ${_benchmarkname}.cpp ${falkon_benchmarks_SRCS}) + target_link_libraries(${_benchmarkname} Qt5::Test FalkonPrivate) + #add_test(NAME falkon-${_benchmarkname} COMMAND ${_benchmarkname}) + #ecm_mark_as_test(${_benchmarkname}) + #set_tests_properties(falkon-${_benchmarkname} PROPERTIES RUN_SERIAL TRUE) + endforeach(_benchmarkname) +endmacro() + +falkon_benchmarks( + #adblockmatchrule + adblockparserule +) diff --git a/tests/benchmarks/adblockmatchrule/adblockmatchrule.cpp b/tests/benchmarks/adblockmatchrule.cpp similarity index 100% rename from tests/benchmarks/adblockmatchrule/adblockmatchrule.cpp rename to tests/benchmarks/adblockmatchrule.cpp diff --git a/tests/benchmarks/adblockmatchrule/.gitignore b/tests/benchmarks/adblockmatchrule/.gitignore deleted file mode 100644 index e58d018aa..000000000 --- a/tests/benchmarks/adblockmatchrule/.gitignore +++ /dev/null @@ -1 +0,0 @@ -adblockmatchrule diff --git a/tests/benchmarks/adblockmatchrule/adblockmatchrule.pro b/tests/benchmarks/adblockmatchrule/adblockmatchrule.pro deleted file mode 100644 index 5ee9ebea8..000000000 --- a/tests/benchmarks/adblockmatchrule/adblockmatchrule.pro +++ /dev/null @@ -1,4 +0,0 @@ -include(../benchmarks.pri) - -TARGET = adblockmatchrule -SOURCES = adblockmatchrule.cpp diff --git a/tests/benchmarks/adblockparserule/adblockparserule.cpp b/tests/benchmarks/adblockparserule.cpp similarity index 94% rename from tests/benchmarks/adblockparserule/adblockparserule.cpp rename to tests/benchmarks/adblockparserule.cpp index fb32f2d02..864222305 100644 --- a/tests/benchmarks/adblockparserule/adblockparserule.cpp +++ b/tests/benchmarks/adblockparserule.cpp @@ -29,11 +29,12 @@ private slots: }; +#include "qztools.h" void AdBlockParseRule::parseEasyList() { QBENCHMARK { AdBlockSubscription* subscription = new AdBlockSubscription("EasyList", this); - subscription->setFilePath("../files/easylist.txt"); + subscription->setFilePath(":/files/easylist.txt"); subscription->loadSubscription(QStringList()); } } diff --git a/tests/benchmarks/adblockparserule/.gitignore b/tests/benchmarks/adblockparserule/.gitignore deleted file mode 100644 index c21ac8d53..000000000 --- a/tests/benchmarks/adblockparserule/.gitignore +++ /dev/null @@ -1 +0,0 @@ -adblockparserule diff --git a/tests/benchmarks/adblockparserule/adblockparserule.pro b/tests/benchmarks/adblockparserule/adblockparserule.pro deleted file mode 100644 index bb54e59c2..000000000 --- a/tests/benchmarks/adblockparserule/adblockparserule.pro +++ /dev/null @@ -1,4 +0,0 @@ -include(../benchmarks.pri) - -TARGET = adblockparserule -SOURCES = adblockparserule.cpp diff --git a/tests/benchmarks/benchmarks.pri b/tests/benchmarks/benchmarks.pri deleted file mode 100644 index 459613a1e..000000000 --- a/tests/benchmarks/benchmarks.pri +++ /dev/null @@ -1,43 +0,0 @@ -include($$PWD/../../src/defines.pri) - -isEqual(QT_MAJOR_VERSION, 5) { - QT += webkitwidgets network widgets printsupport sql script gui-private testlib -} else { - QT += core gui webkit sql network script - CONFIG += qtestlib -} - -!unix|mac: LIBS += -L$$PWD/../../bin -lFalkon -!mac:unix: LIBS += $$PWD/../../bin/libFalkon.so - -QMAKE_LFLAGS+=$${QMAKE_LFLAGS_RPATH}$$PWD/../../bin - -DESTDIR = -OBJECTS_DIR = build -MOC_DIR = build -RCC_DIR = build -UI_DIR = build - -INCLUDEPATH += $$PWD/../../src/lib/3rdparty \ - $$PWD/../../src/lib/adblock \ - $$PWD/../../src/lib/app \ - $$PWD/../../src/lib/autofill \ - $$PWD/../../src/lib/bookmarks \ - $$PWD/../../src/lib/cookies \ - $$PWD/../../src/lib/downloads \ - $$PWD/../../src/lib/history \ - $$PWD/../../src/lib/navigation \ - $$PWD/../../src/lib/network \ - $$PWD/../../src/lib/notifications \ - $$PWD/../../src/lib/opensearch \ - $$PWD/../../src/lib/other \ - $$PWD/../../src/lib/plugins \ - $$PWD/../../src/lib/popupwindow \ - $$PWD/../../src/lib/preferences \ - $$PWD/../../src/lib/rss \ - $$PWD/../../src/lib/session \ - $$PWD/../../src/lib/sidebar \ - $$PWD/../../src/lib/tabwidget \ - $$PWD/../../src/lib/tools \ - $$PWD/../../src/lib/webkit \ - $$PWD/../../src/lib/webtab \ diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro deleted file mode 100644 index 87cb72de8..000000000 --- a/tests/benchmarks/benchmarks.pro +++ /dev/null @@ -1,18 +0,0 @@ -TEMPLATE = subdirs - -defineTest(addSubdir) { - for(subdir, 1) { - entries = $$files($$subdir/*) - for(entry, entries) { - fullPath = $$replace(entry, ;,"") - fullPath = $$replace(fullPath, \\\\, /) - name = $$replace(fullPath, $$re_escape("$$subdir/"), "") - os2|win32: fullPath = $$lower($$fullPath) - exists($$fullPath/*.pro): SUBDIRS += $$fullPath - } - } - - export (SUBDIRS) -} - -addSubdir($$PWD) diff --git a/tests/benchmarks/benchmarks.qrc b/tests/benchmarks/benchmarks.qrc new file mode 100644 index 000000000..c414641e1 --- /dev/null +++ b/tests/benchmarks/benchmarks.qrc @@ -0,0 +1,5 @@ + + + files/easylist.txt + +