summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-09 12:14:17 +0200
committerKlaus Aehlig <klaus.aehlig@huawei.com>2024-08-09 15:14:18 +0200
commitb68c73a1938d382d891ace12938e990a60fc2ec0 (patch)
tree2f98fa1b1d76fe2bc230cccf2b2c83321667cb68
parent02411c104132c45f8e7f0592a3b23b500a7d26fb (diff)
downloadrules-cc-b68c73a1938d382d891ace12938e990a60fc2ec0.tar.gz
components: add test on dependencies
Components themselves can have public dependencies; those need to be available (as compile deps) for the combined library. Verify this by extending the test such that the public dependency is actually used in the header file. While there, also increase coverage by assertions.
-rw-r--r--tests/test_cases/deps/TARGETS25
-rw-r--r--tests/test_cases/deps/components/TARGETS8
-rw-r--r--tests/test_cases/deps/components/foo.hpp4
-rw-r--r--tests/test_cases/deps/components/foodep.cpp2
-rw-r--r--tests/test_cases/deps/components/foodep.hpp4
5 files changed, 40 insertions, 3 deletions
diff --git a/tests/test_cases/deps/TARGETS b/tests/test_cases/deps/TARGETS
index 662eea2..b9b1344 100644
--- a/tests/test_cases/deps/TARGETS
+++ b/tests/test_cases/deps/TARGETS
@@ -288,6 +288,8 @@
, "+combined_shared_lib"
, "+main"
, "+main-dynamic"
+ , "+installed_static"
+ , "+installed_shared"
]
, "asserts":
[ "test -f foo/foo.hpp"
@@ -301,13 +303,19 @@
, "test -f combined_static_lib/bar.hpp"
, "! test -f combined_static_lib/libfoo.a"
, "! test -f combined_static_lib/libbar.a"
+ , "! test -f combined_static_lib/foodep.hpp"
+ , "! test -f combined_static_lib/foo.o"
+ , "! test -f combined_static_lib/bar.o"
, "test -f combined_shared_lib/libcombshared.so"
, "test -f combined_shared_lib/foo.hpp"
, "test -f combined_shared_lib/bar.hpp"
+ , "! test -f combined_shared_lib/foodep.hpp"
, "! test -f combined_shared_lib/libfoo.a"
, "! test -f combined_shared_lib/libbar.a"
, "! test -f combined_shared_lib/libfoo.so"
, "! test -f combined_shared_lib/libbar.so"
+ , "! test -f combined_shared_lib/foo.o"
+ , "! test -f combined_shared_lib/bar.o"
, "./main/main"
, "./main/main | grep 'Hello-from-main'"
, "./main/main | grep 'bar.3'"
@@ -316,6 +324,23 @@
, "./main-dynamic/bin/main | grep 'Hello-from-main'"
, "./main-dynamic/bin/main | grep 'bar.3'"
, "./main-dynamic/bin/main | grep 'foo.15'"
+ , "test -f installed_static/include/bar.hpp"
+ , "test -f installed_static/include/foo.hpp"
+ , "test -f installed_static/include/foodep.hpp"
+ , "test -f installed_static/lib/libcombstatic.a"
+ , "test -f installed_static/lib/libfoodep.a"
+ , "! test -f installed_static/lib/libbar.a"
+ , "! test -f installed_static/lib/libfoo.a"
+ , "test -f installed_shared/include/bar.hpp"
+ , "test -f installed_shared/include/foo.hpp"
+ , "test -f installed_shared/include/foodep.hpp"
+ , "test -f installed_shared/lib/libcombshared.so"
+ , "! test -f installed_shared/lib/libfoodep.a"
+ , "! test -f installed_shared/lib/libfoodep.so"
+ , "! test -f installed_shared/lib/libbar.a"
+ , "! test -f installed_shared/lib/libbar.so"
+ , "! test -f installed_shared/lib/libfoo.a"
+ , "! test -f installed_shared/lib/libfoo.so"
]
, "data": [["TREE", null, "components"]]
}
diff --git a/tests/test_cases/deps/components/TARGETS b/tests/test_cases/deps/components/TARGETS
index edd62db..62a599c 100644
--- a/tests/test_cases/deps/components/TARGETS
+++ b/tests/test_cases/deps/components/TARGETS
@@ -44,4 +44,12 @@
{ "type": ["@", "rules", "CC", "install-with-deps"]
, "targets": ["main-shared"]
}
+, "installed_static":
+ { "type": ["@", "rules", "CC", "install-with-deps"]
+ , "targets": ["combined_static_lib"]
+ }
+, "installed_shared":
+ { "type": ["@", "rules", "CC", "install-with-deps"]
+ , "targets": ["combined_shared_lib"]
+ }
}
diff --git a/tests/test_cases/deps/components/foo.hpp b/tests/test_cases/deps/components/foo.hpp
index f919ea3..45c286c 100644
--- a/tests/test_cases/deps/components/foo.hpp
+++ b/tests/test_cases/deps/components/foo.hpp
@@ -1,6 +1,8 @@
#ifndef FOO_HPP
#define FOO_HPP
-int foo(int);
+#include "foodep.hpp"
+
+foo_t foo(foo_t);
#endif
diff --git a/tests/test_cases/deps/components/foodep.cpp b/tests/test_cases/deps/components/foodep.cpp
index 70dc491..e26c335 100644
--- a/tests/test_cases/deps/components/foodep.cpp
+++ b/tests/test_cases/deps/components/foodep.cpp
@@ -3,7 +3,7 @@
#include <iostream>
#include <ostream>
-int foodep(int x) {
+foo_t foodep(foo_t x) {
std::cout << "foodep(" << x << ")" << std::endl;
return x + 2;
}
diff --git a/tests/test_cases/deps/components/foodep.hpp b/tests/test_cases/deps/components/foodep.hpp
index 792c63b..ea16bb0 100644
--- a/tests/test_cases/deps/components/foodep.hpp
+++ b/tests/test_cases/deps/components/foodep.hpp
@@ -1,6 +1,8 @@
#ifndef FOODEP_HPP
#define FOODEP_HPP
-int foodep(int);
+typedef int foo_t;
+
+foo_t foodep(foo_t);
#endif