summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-12-17 17:41:27 -0800
committerThiago Macieira <thiago.macieira@intel.com>2012-12-19 09:02:22 +0100
commit376a28e542212800eb6925240a5c1191f0e7ac9d (patch)
tree8f821e606b00b0394d38037c65f2194d46d95d3f
parent6bcf66cb7e9a34670597bacc7ce2e4bc0fdb9999 (diff)
Make it easier to test by building a separate test application
Change-Id: Icff0b46578a5b857fcebbdb731e533c6e98e4f6f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
-rw-r--r--Makefile3
-rw-r--r--src/qtchooser/Makefile13
-rw-r--r--tests/auto/qtchooser/tst_qtchooser.cpp4
3 files changed, 15 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 06b1690..8654809 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,8 @@ uninstall:
tests/auto/Makefile: tests/auto/auto.pro
cd tests/auto && qmake -o Makefile auto.pro
-check: all tests/auto/Makefile
+check: tests/auto/Makefile
+ cd src/qtchooser && $(MAKE) check
cd tests/auto && $(MAKE) check
.PHONY: all install uninstall check
diff --git a/src/qtchooser/Makefile b/src/qtchooser/Makefile
index acd22fa..974474a 100644
--- a/src/qtchooser/Makefile
+++ b/src/qtchooser/Makefile
@@ -11,8 +11,11 @@ SOURCES = main.cpp
OBJECTS = main.o
TARGET = qtchooser
+OBJECTS_TEST = main-test.o
+TARGET_TEST = qtchooser-test
first: all
+check: $(TARGET_TEST)
####### Build rules
@@ -21,12 +24,15 @@ all: Makefile $(TARGET)
$(TARGET): $(OBJECTS)
$(CXX) $(LFLAGS) -o $(TARGET) $(OBJECTS)
+$(TARGET_TEST): $(OBJECTS_TEST)
+ $(CXX) $(LFLAGS) -o $(TARGET_TEST) $(OBJECTS_TEST)
+
clean:
- -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) $(OBJECTS) $(OBJECTS_TEST)
-$(DEL_FILE) *~ core *.core
distclean: clean
- -$(DEL_FILE) $(TARGET)
+ -$(DEL_FILE) $(TARGET) $(TARGET_TEST)
-$(DEL_FILE) Makefile
@@ -35,6 +41,9 @@ distclean: clean
main.o: main.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
+main-test.o: main.cpp
+ $(CXX) -c -DQTCHOOSER_TEST_MODE -g $(CXXFLAGS) $(INCPATH) -o main-test.o main.cpp
+
####### Install
install: FORCE
diff --git a/tests/auto/qtchooser/tst_qtchooser.cpp b/tests/auto/qtchooser/tst_qtchooser.cpp
index 85ec734..9e5bf93 100644
--- a/tests/auto/qtchooser/tst_qtchooser.cpp
+++ b/tests/auto/qtchooser/tst_qtchooser.cpp
@@ -104,9 +104,9 @@ tst_ToolChooser::tst_ToolChooser()
pathsWithDefault.prepend(testData + "/default" LIST_SEP);
#ifdef Q_OS_WIN
- toolPath = QCoreApplication::applicationDirPath() + "/../../../src/qtchooser/qtchooser.exe";
+ toolPath = QCoreApplication::applicationDirPath() + "/../../../src/qtchooser/qtchooser-test.exe";
#else
- toolPath = QCoreApplication::applicationDirPath() + "/../../../src/qtchooser/qtchooser";
+ toolPath = QCoreApplication::applicationDirPath() + "/../../../src/qtchooser/qtchooser-test";
#endif
QVERIFY(QFile::exists(toolPath));