aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/api/testdata
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2015-07-14 17:11:38 +0200
committerChristian Kandeler <christian.kandeler@theqtcompany.com>2015-07-15 11:47:52 +0000
commitd69b32061f2cc97892ba1a2f7d851e21f0787a8d (patch)
tree60e6ee463f697ba96675a754caeee760846fb96a /tests/auto/api/testdata
parenta6b2d50df466bce2f15ae7f98b6d707bba23b90b (diff)
Fix library linking order.
Also tighten the autotest. Change-Id: Ibdf678de3654bfe85e3c75dce5fab50ce8fa0232 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'tests/auto/api/testdata')
-rw-r--r--tests/auto/api/testdata/static-lib-deps/d.cpp21
-rw-r--r--tests/auto/api/testdata/static-lib-deps/e.cpp6
-rw-r--r--tests/auto/api/testdata/static-lib-deps/main.cpp22
-rw-r--r--tests/auto/api/testdata/static-lib-deps/project.qbs22
4 files changed, 37 insertions, 34 deletions
diff --git a/tests/auto/api/testdata/static-lib-deps/d.cpp b/tests/auto/api/testdata/static-lib-deps/d.cpp
index a7a2b9f85..081f73158 100644
--- a/tests/auto/api/testdata/static-lib-deps/d.cpp
+++ b/tests/auto/api/testdata/static-lib-deps/d.cpp
@@ -1,9 +1,26 @@
+#ifdef WITH_PTHREAD
+#include <pthread.h>
+#elif defined(WITH_SETUPAPI)
+#include <windows.h>
+#include <Setupapi.h>
+#endif
+
void b();
void c();
-void d()
+int d()
{
b();
c();
-}
+#ifdef WITH_PTHREAD
+ pthread_t self = pthread_self();
+ return static_cast<int>(self);
+#elif defined(WITH_SETUPAPI)
+ CABINET_INFO ci;
+ ci.SetId = 0;
+ return ci.SetId;
+#else
+ return 0;
+#endif
+}
diff --git a/tests/auto/api/testdata/static-lib-deps/e.cpp b/tests/auto/api/testdata/static-lib-deps/e.cpp
index af7d24682..ca5a84809 100644
--- a/tests/auto/api/testdata/static-lib-deps/e.cpp
+++ b/tests/auto/api/testdata/static-lib-deps/e.cpp
@@ -1,7 +1,7 @@
-void d();
+int d();
-void e()
+int e()
{
- d();
+ return d();
}
diff --git a/tests/auto/api/testdata/static-lib-deps/main.cpp b/tests/auto/api/testdata/static-lib-deps/main.cpp
index 76c9436c9..4f017fe33 100644
--- a/tests/auto/api/testdata/static-lib-deps/main.cpp
+++ b/tests/auto/api/testdata/static-lib-deps/main.cpp
@@ -1,25 +1,7 @@
-#ifdef WITH_PTHREAD
-#include <pthread.h>
-#elif defined(WITH_SETUPAPI)
-#include <windows.h>
-#include <Setupapi.h>
-#endif
-
-void e();
+int e();
int main()
{
- e();
-
-#ifdef WITH_PTHREAD
- pthread_t self = pthread_self();
- return static_cast<int>(self);
-#elif defined(WITH_SETUPAPI)
- CABINET_INFO ci;
- ci.SetId = 0;
- return ci.SetId;
-#else
- return 0;
-#endif
+ return e();
}
diff --git a/tests/auto/api/testdata/static-lib-deps/project.qbs b/tests/auto/api/testdata/static-lib-deps/project.qbs
index 198de78d8..2b698c42a 100644
--- a/tests/auto/api/testdata/static-lib-deps/project.qbs
+++ b/tests/auto/api/testdata/static-lib-deps/project.qbs
@@ -45,6 +45,15 @@ Project {
"d.cpp",
]
+ Properties {
+ condition: qbs.targetOS.contains("windows")
+ cpp.defines: ["WITH_SETUPAPI"]
+ }
+ Properties {
+ condition: qbs.targetOS.contains("unix")
+ cpp.defines: ["WITH_PTHREAD"]
+ }
+
Export {
Depends { name: "cpp" }
Properties {
@@ -52,7 +61,7 @@ Project {
cpp.staticLibraries: ["pthread"]
}
Properties {
- condition: qbs.toolchain.contains("msvc")
+ condition: qbs.targetOS.contains("windows")
cpp.staticLibraries: ["setupapi"]
}
}
@@ -73,17 +82,12 @@ Project {
type: "application"
consoleApplication: true
+ Depends { name: "e" }
+
Properties {
- condition: qbs.targetOS.contains("linux")
- cpp.defines: ["WITH_PTHREAD"]
+ condition: qbs.targetOS.contains("unix")
cpp.linkerFlags: ["-static"]
}
- Properties {
- condition: qbs.toolchain.contains("msvc")
- cpp.defines: ["WITH_SETUPAPI"]
- }
-
- Depends { name: "e" }
files: [
"main.cpp",