From 15609703e4e29d14024f1dcf3ec094abe50bdd94 Mon Sep 17 00:00:00 2001 From: Mikkel Krautz Date: Thu, 2 Mar 2017 02:28:19 +0100 Subject: [PATCH] src/tests: make all test .pro files 'inherit' from common test.pri file. This refactors a lot of the common code from each test file into a test.pri file, which is then included by all of our tests. --- src/tests/TestCrypt/TestCrypt.pro | 18 ++---------- .../TestCryptographicHash.pro | 18 +----------- .../TestCryptographicRandom.pro | 22 +++------------ .../TestPacketDataStream.pro | 11 +++----- .../TestPasswordGenerator.pro | 24 +++------------- src/tests/TestTimer/TestTimer.pro | 18 +----------- src/tests/test.pri | 28 +++++++++++++++++++ 7 files changed, 44 insertions(+), 95 deletions(-) create mode 100644 src/tests/test.pri diff --git a/src/tests/TestCrypt/TestCrypt.pro b/src/tests/TestCrypt/TestCrypt.pro index 44a0ccf32..480fb8421 100644 --- a/src/tests/TestCrypt/TestCrypt.pro +++ b/src/tests/TestCrypt/TestCrypt.pro @@ -3,25 +3,11 @@ # that can be found in the LICENSE file at the root of the # Mumble source tree or at . -include(../../../compiler.pri) +include(../test.pri) include(../../../qmake/openssl.pri) -TEMPLATE = app -QT = core network testlib -CONFIG += testcase -CONFIG += thread warn_on -CONFIG -= app_bundle +QT *= network -# We build this test with 'gui' in QT, -# but we include the QtGui headers from -# murmur_pch.h. Define QT_NO_OPENGL to -# avoid build errors about a missing GLES/gles2.h -# header. -DEFINES += QT_NO_OPENGL - -LANGUAGE = C++ TARGET = TestCrypt HEADERS = Timer.h CryptState.h SOURCES = TestCrypt.cpp CryptState.cpp Timer.cpp -VPATH += ../.. -INCLUDEPATH += ../.. ../../murmur ../../mumble diff --git a/src/tests/TestCryptographicHash/TestCryptographicHash.pro b/src/tests/TestCryptographicHash/TestCryptographicHash.pro index ab4f16e31..377a7e3af 100644 --- a/src/tests/TestCryptographicHash/TestCryptographicHash.pro +++ b/src/tests/TestCryptographicHash/TestCryptographicHash.pro @@ -3,25 +3,9 @@ # that can be found in the LICENSE file at the root of the # Mumble source tree or at . -include(../../../compiler.pri) +include(../test.pri) include(../../../qmake/openssl.pri) -TEMPLATE = app -QT = core testlib -CONFIG += testcase -CONFIG += warn_on -CONFIG -= app_bundle - -# We build this test with 'gui' in QT, -# but we include the QtGui headers from -# murmur_pch.h. Define QT_NO_OPENGL to -# avoid build errors about a missing GLES/gles2.h -# header. -DEFINES += QT_NO_OPENGL - -LANGUAGE = C++ TARGET = TestCryptographicHash SOURCES = TestCryptographicHash.cpp CryptographicHash.cpp HEADERS = CryptographicHash.h -VPATH += ../.. -INCLUDEPATH += ../.. ../../murmur ../../mumble diff --git a/src/tests/TestCryptographicRandom/TestCryptographicRandom.pro b/src/tests/TestCryptographicRandom/TestCryptographicRandom.pro index 628436798..fc397bf20 100644 --- a/src/tests/TestCryptographicRandom/TestCryptographicRandom.pro +++ b/src/tests/TestCryptographicRandom/TestCryptographicRandom.pro @@ -3,26 +3,12 @@ # that can be found in the LICENSE file at the root of the # Mumble source tree or at . -include(../../../compiler.pri) +include(../test.pri) include(../../../qmake/openssl.pri) -TEMPLATE = app -QT = core testlib -CONFIG += testcase -CONFIG += qt warn_on -CONFIG -= app_bundle -LANGUAGE = C++ - -# We build this test with 'gui' in QT, -# but we include the QtGui headers from -# murmur_pch.h. Define QT_NO_OPENGL to -# avoid build errors about a missing GLES/gles2.h -# header. -DEFINES += QT_NO_OPENGL - TARGET = TestCryptographicRandom SOURCES = TestCryptographicRandom.cpp CryptographicRandom.cpp arc4random_uniform.cpp HEADERS = CryptographicHash.h -VPATH += ../.. -VPATH += ../../../3rdparty/arc4random-src -INCLUDEPATH += ../.. ../../murmur ../../mumble ../../../3rdparty/arc4random-src + +VPATH *= ../../../3rdparty/arc4random-src +INCLUDEPATH *= ../../../3rdparty/arc4random-src diff --git a/src/tests/TestPacketDataStream/TestPacketDataStream.pro b/src/tests/TestPacketDataStream/TestPacketDataStream.pro index d12fc5432..f3a5ac92f 100644 --- a/src/tests/TestPacketDataStream/TestPacketDataStream.pro +++ b/src/tests/TestPacketDataStream/TestPacketDataStream.pro @@ -3,12 +3,9 @@ # that can be found in the LICENSE file at the root of the # Mumble source tree or at . -TEMPLATE = app -QT = core network testlib -CONFIG += testcase -CONFIG += qt thread warn_on -CONFIG -= app_bundle -LANGUAGE = C++ +include(../test.pri) + +QT *= network + TARGET = TestPacketDataStream SOURCES = TestPacketDataStream.cpp -INCLUDEPATH += ../.. ../../murmur ../../mumble diff --git a/src/tests/TestPasswordGenerator/TestPasswordGenerator.pro b/src/tests/TestPasswordGenerator/TestPasswordGenerator.pro index 27f0cc89c..dc76d9181 100644 --- a/src/tests/TestPasswordGenerator/TestPasswordGenerator.pro +++ b/src/tests/TestPasswordGenerator/TestPasswordGenerator.pro @@ -3,28 +3,12 @@ # that can be found in the LICENSE file at the root of the # Mumble source tree or at . -include(../../../compiler.pri) +include(../test.pri) include(../../../qmake/openssl.pri) -TEMPLATE = app -QT = core testlib -CONFIG += testcase -CONFIG += warn_on -CONFIG -= app_bundle - -# We build this test without 'gui' in QT, -# but we include the QtGui headers from -# murmur_pch.h. This causes an error when Qt -# tries to find the OpenGL headers to use, since -# we're missing the include paths from QtGui's -# .pri files. Define QT_NO_OPENGL to avoid these -# build errors. -DEFINES += QT_NO_OPENGL - -LANGUAGE = C++ TARGET = TestPasswordGenerator SOURCES = TestPasswordGenerator.cpp PasswordGenerator.cpp CryptographicRandom.cpp arc4random_uniform.cpp HEADERS = PasswordGenerator.h CryptographicHash.h -VPATH += ../.. -VPATH += ../../../3rdparty/arc4random-src -INCLUDEPATH += ../.. ../../murmur ../../mumble ../../../3rdparty/arc4random-src + +VPATH *= ../../../3rdparty/arc4random-src +INCLUDEPATH *= ../../../3rdparty/arc4random-src diff --git a/src/tests/TestTimer/TestTimer.pro b/src/tests/TestTimer/TestTimer.pro index 71255fcba..3fad09e1e 100644 --- a/src/tests/TestTimer/TestTimer.pro +++ b/src/tests/TestTimer/TestTimer.pro @@ -3,24 +3,8 @@ # that can be found in the LICENSE file at the root of the # Mumble source tree or at . -include(../../../compiler.pri) +include(../test.pri) -TEMPLATE = app -QT = core testlib -CONFIG += testcase -CONFIG += warn_on -CONFIG -= app_bundle - -# We build this test with 'gui' in QT, -# but we include the QtGui headers from -# murmur_pch.h. Define QT_NO_OPENGL to -# avoid build errors about a missing GLES/gles2.h -# header. -DEFINES += QT_NO_OPENGL - -LANGUAGE = C++ TARGET = TestTimer SOURCES = TestTimer.cpp Timer.cpp HEADERS = Timer.h -VPATH += ../.. -INCLUDEPATH += ../.. ../../murmur ../../mumble diff --git a/src/tests/test.pri b/src/tests/test.pri new file mode 100644 index 000000000..394f9fa7b --- /dev/null +++ b/src/tests/test.pri @@ -0,0 +1,28 @@ +# Copyright 2005-2017 The Mumble Developers. All rights reserved. +# Use of this source code is governed by a BSD-style license +# that can be found in the LICENSE file at the root of the +# Mumble source tree or at . + +# Common include file for tests. + +include(../../compiler.pri) + +TEMPLATE = app +QT = core testlib +CONFIG += testcase +CONFIG += thread warn_on +CONFIG -= app_bundle + +# We build this test without 'gui' in QT, +# but we include the QtGui headers from +# murmur_pch.h. This causes an error when Qt +# tries to find the OpenGL headers to use, since +# we're missing the include paths from QtGui's +# .pri files. Define QT_NO_OPENGL to avoid these +# build errors. +DEFINES += QT_NO_OPENGL + +LANGUAGE = C++ + +VPATH *= ../.. +INCLUDEPATH *= ../.. ../../murmur ../../mumble