summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test_cases/deps/TARGETS15
-rw-r--r--tests/test_cases/deps/object/TARGETS36
-rw-r--r--tests/test_cases/deps/object/bar.cpp3
-rw-r--r--tests/test_cases/deps/object/bar.hpp9
-rw-r--r--tests/test_cases/deps/object/foo.cpp3
-rw-r--r--tests/test_cases/deps/object/foo.hpp8
-rw-r--r--tests/test_cases/deps/object/main.cpp8
7 files changed, 81 insertions, 1 deletions
diff --git a/tests/test_cases/deps/TARGETS b/tests/test_cases/deps/TARGETS
index 10a6749..7e4dd28 100644
--- a/tests/test_cases/deps/TARGETS
+++ b/tests/test_cases/deps/TARGETS
@@ -96,6 +96,19 @@
]
, "data": [["TREE", null, "shared"]]
}
+, "object":
+ { "type": ["test_rules", "test_case"]
+ , "name": ["deps_object"]
+ , "targets": ["+foo", "+bar", "+main", "+test_main", "+install_main"]
+ , "asserts":
+ [ "[ -f ./foo/libfoo.so ]"
+ , "[ -f ./bar/bar/bar.o ]"
+ , "[ -f ./install_main/lib/libfoo.so ]"
+ , "[ ! -f ./install_main/lib/bar/bar.o ]"
+ , "[ \"$(./install_main/bin/main)\" = 'Hello World and Galaxy' ]"
+ ]
+ , "data": [["TREE", null, "object"]]
+ }
, "prebuilt_tests":
{ "type": "tree"
, "deps":
@@ -191,7 +204,7 @@
}
, "ALL":
{ "type": "install"
- , "deps": ["private", "public", "shared", "prebuilt", "cmake"]
+ , "deps": ["private", "public", "shared", "object", "prebuilt", "cmake"]
, "tainted": ["test"]
}
}
diff --git a/tests/test_cases/deps/object/TARGETS b/tests/test_cases/deps/object/TARGETS
new file mode 100644
index 0000000..bd69478
--- /dev/null
+++ b/tests/test_cases/deps/object/TARGETS
@@ -0,0 +1,36 @@
+{ "foo":
+ { "type": ["@", "rules", "CC", "library"]
+ , "name": ["foo"]
+ , "shared": ["yes"]
+ , "hdrs": ["foo.hpp"]
+ , "srcs": ["foo.cpp"]
+ , "deps": ["bar"]
+ , "stage": ["foo"]
+ }
+, "bar":
+ { "type": ["@", "rules", "CC", "library"]
+ , "object_only": ["yes"]
+ , "hdrs": ["bar.hpp"]
+ , "srcs": ["bar.cpp"]
+ , "stage": ["bar"]
+ }
+, "main":
+ { "type": ["@", "rules", "CC", "binary"]
+ , "name": ["main"]
+ , "srcs": ["main.cpp"]
+ , "private-deps": ["foo"]
+ }
+, "test_main":
+ { "type": ["@", "rules", "shell/test", "script"]
+ , "name": ["test_main"]
+ , "test": ["test_main.sh"]
+ , "deps": ["main"]
+ }
+, "test_main.sh":
+ { "type": "file_gen"
+ , "name": "test.sh"
+ , "data": "set -e\n[ \"$(./main)\" = \"Hello World and Galaxy\" ]"
+ }
+, "install_main":
+ {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["main"]}
+}
diff --git a/tests/test_cases/deps/object/bar.cpp b/tests/test_cases/deps/object/bar.cpp
new file mode 100644
index 0000000..5d7c616
--- /dev/null
+++ b/tests/test_cases/deps/object/bar.cpp
@@ -0,0 +1,3 @@
+#include <string>
+
+std::string bar() { return "and Galaxy"; }
diff --git a/tests/test_cases/deps/object/bar.hpp b/tests/test_cases/deps/object/bar.hpp
new file mode 100644
index 0000000..9c97d54
--- /dev/null
+++ b/tests/test_cases/deps/object/bar.hpp
@@ -0,0 +1,9 @@
+#ifndef BAR_HPP
+#define BAR_HPP
+
+#include <string>
+
+// use this object lib to extend the public symbols of shared lib 'foo' by 'bar'
+std::string bar();
+
+#endif
diff --git a/tests/test_cases/deps/object/foo.cpp b/tests/test_cases/deps/object/foo.cpp
new file mode 100644
index 0000000..9687a6a
--- /dev/null
+++ b/tests/test_cases/deps/object/foo.cpp
@@ -0,0 +1,3 @@
+#include "foo.hpp"
+
+std::string foo() { return "Hello World"; }
diff --git a/tests/test_cases/deps/object/foo.hpp b/tests/test_cases/deps/object/foo.hpp
new file mode 100644
index 0000000..d880c27
--- /dev/null
+++ b/tests/test_cases/deps/object/foo.hpp
@@ -0,0 +1,8 @@
+#ifndef FOO_HPP
+#define FOO_HPP
+
+#include <string>
+
+std::string foo();
+
+#endif
diff --git a/tests/test_cases/deps/object/main.cpp b/tests/test_cases/deps/object/main.cpp
new file mode 100644
index 0000000..cfc2a4f
--- /dev/null
+++ b/tests/test_cases/deps/object/main.cpp
@@ -0,0 +1,8 @@
+#include "bar/bar.hpp"
+#include "foo/foo.hpp"
+#include <iostream>
+
+int main(int argc, char const *argv[]) {
+ std::cout << foo() << " " << bar() << std::endl;
+ return 0;
+}