diff options
Diffstat (limited to 'tests/test_cases/deps')
53 files changed, 1131 insertions, 0 deletions
diff --git a/tests/test_cases/deps/TARGETS b/tests/test_cases/deps/TARGETS new file mode 100644 index 0000000..b1047a8 --- /dev/null +++ b/tests/test_cases/deps/TARGETS @@ -0,0 +1,287 @@ +{ "private": + { "type": ["test_rules", "test_case"] + , "name": ["deps_private"] + , "targets": + [ "+foo" + , "-main_includes_foo" + , "+main_links_foo" + , "+main_links_bar_foo" + , "+install_bar" + ] + , "asserts": + [ "test -f foo/foo/libfoo.a" + , "test -f foo/foo/foo.hpp" + , "! test -f foo/bar/bar.hpp" + , "./main_links_foo/main | grep foo" + , "./main_links_bar_foo/main | grep bar" + , "./main_links_bar_foo/main | grep foo" + , "test -f install_bar/lib/bar/libbar.a" + , "test -f install_bar/include/bar/bar.hpp" + , "test -f install_bar/lib/foo/libfoo.a" + , "! test -f install_bar/include/foo/foo.hpp" + ] + , "data": [["TREE", null, "private"]] + } +, "public": + { "type": ["test_rules", "test_case"] + , "name": ["deps_public"] + , "targets": + [ "+foo" + , "+main_includes_foo" + , "+main_links_foo" + , "+main_links_bar_foo" + , "+install_bar" + ] + , "asserts": + [ "test -f foo/foo/libfoo.a" + , "test -f foo/foo/foo.hpp" + , "! test -f foo/bar/bar.hpp" + , "./main_includes_foo/main | grep main" + , "./main_links_foo/main | grep foo" + , "./main_links_bar_foo/main | grep bar" + , "./main_links_bar_foo/main | grep foo" + , "test -f install_bar/lib/bar/libbar.a" + , "test -f install_bar/include/bar/bar.hpp" + , "test -f install_bar/lib/foo/libfoo.a" + , "test -f install_bar/include/foo/foo.hpp" + ] + , "data": [["TREE", null, "public"]] + } +, "shared": + { "type": ["test_rules", "test_case"] + , "name": ["deps_shared"] + , "targets": + [ "+foo" + , "+bar" + , "+main_uses_foo" + , "+test_uses_foo" + , "+main_uses_bar" + , "+test_uses_bar" + , "+test_uses_bar_s" + , "+test_uses_baz" + , "+test_uses_main" + , "+test_diamond" + , "+install_foo" + , "+install_bar_s" + , "+install_baz" + , "+install_main" + ] + , "asserts": + [ "test -f foo/libfoo.so.1.2.3" + , "test -f foo/foo/foo.hpp" + , "test -f bar/libbar.so" + , "test -f bar/bar/bar.hpp" + , "! test -f bar/foo/foo.hpp" + , "test -f install_foo/lib/libfoo.so.1.2.3" + , "test -f install_foo/include/foo/foo.hpp" + , "grep 'Name: foo' install_foo/lib/pkgconfig/foo.pc" + , "grep 'Version: 1.2.3' install_foo/lib/pkgconfig/foo.pc" + , "grep -- '-L${libdir}' install_foo/lib/pkgconfig/foo.pc" + , "grep -- '-l:libfoo.so.1.2.3' install_foo/lib/pkgconfig/foo.pc" + , "test -f install_bar_s/lib/bar/libbar.a" + , "test -f install_bar_s/include/bar/bar.hpp" + , "test -f install_bar_s/lib/libfoo.so.1.2.3" + , "! test -f install_bar_s/include/foo/foo.hpp" + , "grep 'Name: bar' install_bar_s/lib/pkgconfig/bar.pc" + , "grep '${libdir}/bar/libbar.a' install_bar_s/lib/pkgconfig/bar.pc" + , "grep '${libdir}/libfoo.so.1.2.3' install_bar_s/lib/pkgconfig/bar.pc" + , "test -f install_baz/lib/libbaz.so" + , "test -f install_baz/include/baz/baz.hpp" + , "! test -f install_baz/lib/foo/libfoo.a" + , "! test -f install_baz/include/foo/foo.hpp" + , "./install_main/bin/main_uses_bar | grep main" + , "./install_main/bin/main_uses_bar | grep bar" + , "./install_main/bin/main_uses_bar | grep foo" + , "! test -d install_main/include" + ] + , "data": [["TREE", null, "shared"]] + } +, "object": + { "type": ["test_rules", "test_case"] + , "name": ["deps_object"] + , "targets": ["+foo", "+bar", "+baz", "+main", "+test_main", "+install_main"] + , "asserts": + [ "[ -f ./foo/libfoo.so ]" + , "[ -f ./bar/bar/bar.o ]" + , "[ -f ./baz/libbaz.so ]" + , "[ -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": + [ ["test_cases/deps/prebuilt", "foo.hpp"] + , ["test_cases/deps/prebuilt", "bar.hpp"] + , ["test_cases/deps/prebuilt", "TARGETS"] + , ["TREE", null, "shared"] + ] + } +, "prebuilt": + { "type": ["test_rules", "test_case"] + , "name": ["deps_prebuilt"] + , "targets": + [ "+foo" + , "+bar" + , "+main_uses_foo" + , "+test_uses_foo" + , "+main_uses_bar" + , "+test_uses_bar" + , "+test_uses_bar_s" + , "+test_uses_main" + , "+install_foo" + , "+install_bar" + , "+install_main" + , "+test_uses_foobar" + , "+test_uses_foobar_s" + , "+install_foobar" + ] + , "asserts": + [ "test -f foo/libfoo.so.1.2.3" + , "test -f foo/foo/foo.hpp" + , "test -f bar/libbar.so" + , "test -f bar/bar/bar.hpp" + , "test -f install_foo/lib/pkgconfig/foo/foo.cflags" + , "test -f install_foo/lib/pkgconfig/foo/foo.ldflags" + , "test -f install_bar/lib/pkgconfig/foo/foo.cflags" + , "test -f install_bar/lib/pkgconfig/foo/foo.ldflags" + , "test -f install_bar/lib/pkgconfig/bar/bar.cflags" + , "test -f install_bar/lib/pkgconfig/bar/bar.ldflags" + , "./install_main/bin/main_uses_bar | grep main" + , "./install_main/bin/main_uses_bar | grep bar" + , "./install_main/bin/main_uses_bar | grep foo" + , "test -f install_foobar/lib/libfoo.so.1.2.3" + , "test -f install_foobar/lib/libbar.so" + , "test -f install_foobar/lib/pkgconfig/foobar.pc" + , "grep 'Cflags:.*@${prefix}/lib/pkgconfig/bar/foobar.cflags' install_foobar/lib/pkgconfig/foobar.pc" + , "grep -- '-DUSE_BAR=1 -DUSE_FOO=1' install_foobar/lib/pkgconfig/bar/foobar.cflags" + , "grep 'Libs:.*@${prefix}/lib/pkgconfig/bar/foobar.ldflags' install_foobar/lib/pkgconfig/foobar.pc" + , "grep -- '-lm -lpthread' install_foobar/lib/pkgconfig/bar/foobar.ldflags" + ] + , "data": ["prebuilt_tests"] + } +, "cmake": + { "type": ["test_rules", "test_case"] + , "name": ["deps_cmake"] + , "libs": ["googletest", "libz", "libcurl"] + , "targets": + [ "+gtest" + , "+test" + , "+gtest_main" + , "+testbin" + , "+shell_test" + , "+install_gtest" + , "+install_gtest_main" + , "+install_testbin" + , "+install_libcurl" + ] + , "asserts": + [ "test -f gtest/libgtest.a" + , "test -f gtest/gtest/gtest.h" + , "grep 'PASSED.*1 test' test/stdout" + , "test -f gtest_main/libgtest.so.1.13.0" + , "test -f gtest_main/libgtest_main.so.1.13.0" + , "test -f gtest_main/gtest/gtest.h" + , "test -f ./testbin/test" + , "grep 'PASSED.*1 test' shell_test/stdout" + , "test -f install_gtest/lib/libgtest.a" + , "test -f install_gtest/include/gtest/gtest.h" + , "grep 'Cflags.*lib/pkgconfig/gtest.cflags' install_gtest/lib/pkgconfig/gtest.pc" + , "grep 'Libs.*libgtest.a' install_gtest/lib/pkgconfig/gtest.pc" + , "grep 'Libs.*lib/pkgconfig/gtest.ldflags' install_gtest/lib/pkgconfig/gtest.pc" + , "test -f install_gtest_main/lib/libgtest.so.1.13.0" + , "test -f install_gtest_main/lib/libgtest_main.so.1.13.0" + , "test -f install_gtest_main/include/gtest/gtest.h" + , "grep 'Cflags.*lib/pkgconfig/gtest_main.cflags' install_gtest_main/lib/pkgconfig/gtest_main.pc" + , "grep 'Libs.*libgtest.so.1.13.0' install_gtest_main/lib/pkgconfig/gtest_main.pc" + , "grep 'Libs.*libgtest_main.so.1.13.0' install_gtest_main/lib/pkgconfig/gtest_main.pc" + , "grep 'Libs.*lib/pkgconfig/gtest_main.ldflags' install_gtest_main/lib/pkgconfig/gtest_main.pc" + , "./install_testbin/bin/test | grep 'PASSED.*1 test'" + , "path=$(ldd install_libcurl/lib/libcurl.so.4.8.0 | awk '/libz/{print $3}') && test -z \"${path##$(pwd)*}\"" + ] + , "data": [["TREE", null, "cmake"]] + } +, "install": + { "type": ["test_rules", "test_case"] + , "name": ["deps_install"] + , "targets": + [ "+install_bar_release" + , "+install_main_release" + , "+install_bar_debug" + , "+install_main_debug" + , "+install_bar_debug_slim" + , "+install_main_debug_slim" + ] + , "asserts": + [ "test -f install_bar_release/lib/bar/libbar.a" + , "test -f install_bar_release/lib/foo/libfoo.a" + , "test -f install_bar_release/lib/baz/libbaz.a" + , "test -f install_bar_release/lib/pkgconfig/bar.pc" + , "test -f install_bar_release/include/bar/bar.hpp" + , "test -f install_bar_release/include/foo/foo.hpp" + , "! test -f install_bar_release/include/baz/baz.hpp" + , "! test -d install_bar_release/work" + , "test -f install_main_release/bin/main" + , "! test -f install_main_release/lib/bar/libbar.a" + , "! test -f install_main_release/lib/foo/libfoo.a" + , "! test -f install_main_release/lib/baz/libbaz.a" + , "! test -d install_main_release/lib/pkgconfig" + , "! test -d install_main_release/include" + , "! test -d install_main_release/work" + , "test -f install_bar_debug/lib/bar/libbar.a" + , "test -f install_bar_debug/lib/foo/libfoo.a" + , "test -f install_bar_debug/lib/baz/libbaz.a" + , "test -f install_bar_debug/lib/pkgconfig/bar.pc" + , "test -f install_bar_debug/include/bar/bar.hpp" + , "test -f install_bar_debug/include/foo/foo.hpp" + , "test -f install_bar_debug/include/baz/baz.hpp" + , "test -f install_bar_debug/work/bar/bar.cpp" + , "test -f install_bar_debug/work/bar/bar.hpp" + , "test -f install_bar_debug/work/foo/foo.cpp" + , "test -f install_bar_debug/work/foo/foo.hpp" + , "test -f install_bar_debug/work/foo/qux.hpp" + , "test -f install_bar_debug/work/baz/baz.cpp" + , "test -f install_bar_debug/work/baz/baz.hpp" + , "test -f install_main_debug/bin/main" + , "test -f install_main_debug/include/bar/bar.hpp" + , "test -f install_main_debug/include/foo/foo.hpp" + , "test -f install_main_debug/include/baz/baz.hpp" + , "test -f install_main_debug/work/bar/bar.cpp" + , "test -f install_main_debug/work/bar/bar.hpp" + , "test -f install_main_debug/work/foo/foo.cpp" + , "test -f install_main_debug/work/foo/foo.hpp" + , "test -f install_main_debug/work/foo/qux.hpp" + , "test -f install_main_debug/work/baz/baz.cpp" + , "test -f install_main_debug/work/baz/baz.hpp" + , "test -f install_main_debug/work/main.cpp" + , "! test -f install_main_debug/lib/bar/libbar.a" + , "! test -f install_main_debug/lib/foo/libfoo.a" + , "! test -f install_main_debug/lib/baz/libbaz.a" + , "! test -d install_main_debug/lib/pkgconfig" + , "test -f install_bar_debug_slim/lib/bar/libbar.a" + , "test -f install_bar_debug_slim/lib/foo/libfoo.a" + , "test -f install_bar_debug_slim/lib/baz/libbaz.a" + , "test -f install_bar_debug_slim/lib/pkgconfig/bar.pc" + , "test -f install_bar_debug_slim/include/bar/bar.hpp" + , "test -f install_bar_debug_slim/include/foo/foo.hpp" + , "! test -f install_bar_debug_slim/include/baz/baz.hpp" + , "! test -d install_bar_debug_slim/work" + , "test -f install_main_debug_slim/bin/main" + , "! test -f install_main_debug_slim/lib/bar/libbar.a" + , "! test -f install_main_debug_slim/lib/foo/libfoo.a" + , "! test -f install_main_debug_slim/lib/baz/libbaz.a" + , "! test -d install_main_debug_slim/lib/pkgconfig" + , "! test -d install_main_debug_slim/include" + , "! test -d install_main_debug_slim/work" + ] + , "data": [["TREE", null, "install"]] + } +, "ALL": + { "type": "install" + , "deps": + ["private", "public", "shared", "object", "prebuilt", "cmake", "install"] + , "tainted": ["test"] + } +} diff --git a/tests/test_cases/deps/cmake/TARGETS b/tests/test_cases/deps/cmake/TARGETS new file mode 100644 index 0000000..2c02f53 --- /dev/null +++ b/tests/test_cases/deps/cmake/TARGETS @@ -0,0 +1,76 @@ +{ "gtest": + { "type": ["@", "rules", "CC/foreign/cmake", "library"] + , "name": ["gtest"] + , "version": ["1", "13", "0"] + , "project": [["@", "googletest", "", "tree"]] + , "out_hdr_dirs": ["gtest"] + , "out_libs": ["libgtest.a"] + , "pkg-config": ["gtest.pc"] + } +, "testlib": + { "type": ["@", "rules", "CC", "library"] + , "name": ["testlib"] + , "shared": ["yes"] + , "srcs": ["main.cpp"] + , "private-deps": ["gtest"] + } +, "test": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test"] + , "private-deps": ["testlib", "gtest"] + } +, "gtest_main": + { "type": ["@", "rules", "CC/foreign/cmake", "library"] + , "name": ["gtest_main"] + , "version": ["1", "13", "0"] + , "project": [["@", "googletest", "", "tree"]] + , "defines": ["BUILD_SHARED_LIBS=ON"] + , "out_hdr_dirs": ["gtest"] + , "out_libs": ["libgtest_main.so.1.13.0", "libgtest.so.1.13.0"] + , "pkg-config": ["gtest_main.pc", "gtest.pc"] + } +, "testbin": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["test"] + , "srcs": ["test.cpp"] + , "private-deps": ["gtest_main"] + } +, "shell_test": + { "type": ["@", "rules", "shell/test", "script"] + , "name": ["shell_test"] + , "test": ["test.sh"] + , "deps": ["testbin"] + } +, "install_gtest": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["gtest"]} +, "install_gtest_main": + { "type": ["@", "rules", "CC", "install-with-deps"] + , "targets": ["gtest_main"] + } +, "install_testbin": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["testbin"]} +, "libz": + { "type": ["@", "rules", "CC/foreign/cmake", "library"] + , "name": ["libz"] + , "version": ["1", "2", "13"] + , "project": [["@", "libz", "", "tree"]] + , "defines": ["BUILD_SHARED_LIBS=ON"] + , "out_hdrs": ["zconf.h", "zlib.h"] + , "out_libs": ["libz.so", "libz.so.1", "libz.so.1.2.13"] + , "pc_prefix": ["share/pkgconfig"] + , "pkg-config": ["zlib.pc"] + } +, "libcurl": + { "type": ["@", "rules", "CC/foreign/cmake", "library"] + , "name": ["libcurl"] + , "version": ["8", "0", "1"] + , "project": [["@", "libcurl", "", "tree"]] + , "defines": ["BUILD_SHARED_LIBS=ON", "CURL_ENABLE_SSL=OFF", "USE_ZLIB=ON"] + , "out_hdr_dirs": ["curl"] + , "out_libs": ["libcurl.so.4.8.0"] + , "pkg-config": ["libcurl.pc"] + , "deps": ["libz"] + } +, "install_libcurl": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["libcurl"]} +} diff --git a/tests/test_cases/deps/cmake/main.cpp b/tests/test_cases/deps/cmake/main.cpp new file mode 100644 index 0000000..575a358 --- /dev/null +++ b/tests/test_cases/deps/cmake/main.cpp @@ -0,0 +1,8 @@ +#include <gtest/gtest.h> + +TEST(CastTest, float) { EXPECT_EQ(42.0f, float(42)); } + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/tests/test_cases/deps/cmake/test.cpp b/tests/test_cases/deps/cmake/test.cpp new file mode 100644 index 0000000..b1811d8 --- /dev/null +++ b/tests/test_cases/deps/cmake/test.cpp @@ -0,0 +1,3 @@ +#include <gtest/gtest.h> + +TEST(CastTest, double) { EXPECT_EQ(42.0, double(42)); } diff --git a/tests/test_cases/deps/cmake/test.sh b/tests/test_cases/deps/cmake/test.sh new file mode 100644 index 0000000..80b7965 --- /dev/null +++ b/tests/test_cases/deps/cmake/test.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +set -e + +./test | grep PASSED diff --git a/tests/test_cases/deps/install/TARGETS b/tests/test_cases/deps/install/TARGETS new file mode 100644 index 0000000..c2cab52 --- /dev/null +++ b/tests/test_cases/deps/install/TARGETS @@ -0,0 +1,69 @@ +{ "baz": + { "type": ["@", "rules", "CC", "library"] + , "name": ["baz"] + , "hdrs": ["baz.hpp"] + , "srcs": ["baz.cpp"] + , "stage": ["baz"] + } +, "foo": + { "type": ["@", "rules", "CC", "library"] + , "name": ["foo"] + , "hdrs": ["foo.hpp"] + , "private-hdrs": ["qux.hpp"] + , "srcs": ["foo.cpp"] + , "private-deps": ["baz"] + , "stage": ["foo"] + } +, "bar": + { "type": ["@", "rules", "CC", "library"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "srcs": ["bar.cpp"] + , "deps": ["foo"] + , "stage": ["bar"] + } +, "main": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main.cpp"] + , "private-deps": ["bar"] + } +, "install_bar_release": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["bar"]} +, "install_main_release": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["main"]} +, "bar debug": + { "type": "configure" + , "target": "bar" + , "config": + { "type": "let*" + , "bindings": [["DEBUG", true], ["ADD_CXXFLAGS", ["-g"]]] + , "body": {"type": "env", "vars": ["DEBUG", "ADD_CXXFLAGS"]} + } + } +, "main debug": + { "type": "configure" + , "target": "main" + , "config": + { "type": "let*" + , "bindings": [["DEBUG", true], ["ADD_CXXFLAGS", ["-g"]]] + , "body": {"type": "env", "vars": ["DEBUG", "ADD_CXXFLAGS"]} + } + } +, "install_bar_debug": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["bar debug"]} +, "install_main_debug": + { "type": ["@", "rules", "CC", "install-with-deps"] + , "targets": ["main debug"] + } +, "install_bar_debug_slim": + { "type": ["@", "rules", "CC", "install-with-deps"] + , "skip-debug-stage": ["yes"] + , "targets": ["bar debug"] + } +, "install_main_debug_slim": + { "type": ["@", "rules", "CC", "install-with-deps"] + , "skip-debug-stage": ["yes"] + , "targets": ["main debug"] + } +} diff --git a/tests/test_cases/deps/install/bar.cpp b/tests/test_cases/deps/install/bar.cpp new file mode 100644 index 0000000..6cc1260 --- /dev/null +++ b/tests/test_cases/deps/install/bar.cpp @@ -0,0 +1,7 @@ +#include "bar.hpp" +#include <iostream> + +int bar(Foo *foo) { + std::cout << "bar" << std::endl; + return (foo == nullptr) ? -1 : foo->foo(); +} diff --git a/tests/test_cases/deps/install/bar.hpp b/tests/test_cases/deps/install/bar.hpp new file mode 100644 index 0000000..ec9c165 --- /dev/null +++ b/tests/test_cases/deps/install/bar.hpp @@ -0,0 +1,8 @@ +#ifndef BAR_HPP +#define BAR_HPP + +#include "foo/foo.hpp" + +int bar(Foo *foo); + +#endif diff --git a/tests/test_cases/deps/install/baz.cpp b/tests/test_cases/deps/install/baz.cpp new file mode 100644 index 0000000..c2c26f0 --- /dev/null +++ b/tests/test_cases/deps/install/baz.cpp @@ -0,0 +1,7 @@ +#include "baz.hpp" +#include <iostream> + +int baz() { + std::cout << baz_str() << std::endl; + return 0; +} diff --git a/tests/test_cases/deps/install/baz.hpp b/tests/test_cases/deps/install/baz.hpp new file mode 100644 index 0000000..f0f8377 --- /dev/null +++ b/tests/test_cases/deps/install/baz.hpp @@ -0,0 +1,10 @@ +#ifndef BAZ_HPP +#define BAZ_HPP + +int baz(); + +#include <string> + +static inline std::string baz_str() { return "baz"; } + +#endif diff --git a/tests/test_cases/deps/install/foo.cpp b/tests/test_cases/deps/install/foo.cpp new file mode 100644 index 0000000..4a3b17a --- /dev/null +++ b/tests/test_cases/deps/install/foo.cpp @@ -0,0 +1,10 @@ +#include "foo.hpp" +#include "baz/baz.hpp" +#include "qux.hpp" +#include <iostream> + +int Foo::foo() { + std::cout << "foo & inline " << baz_str() << std::endl; + qux(); + return baz(); +} diff --git a/tests/test_cases/deps/install/foo.hpp b/tests/test_cases/deps/install/foo.hpp new file mode 100644 index 0000000..025f3ef --- /dev/null +++ b/tests/test_cases/deps/install/foo.hpp @@ -0,0 +1,8 @@ +#ifndef FOO_HPP +#define FOO_HPP + +struct Foo { + int foo(); +}; + +#endif diff --git a/tests/test_cases/deps/install/main.cpp b/tests/test_cases/deps/install/main.cpp new file mode 100644 index 0000000..2e46d75 --- /dev/null +++ b/tests/test_cases/deps/install/main.cpp @@ -0,0 +1,10 @@ +// test binary consuming libraries + +#include "bar/bar.hpp" +#include <iostream> + +int main() { + std::cout << "main" << std::endl; + Foo foo{}; + return bar(&foo); +} diff --git a/tests/test_cases/deps/install/qux.hpp b/tests/test_cases/deps/install/qux.hpp new file mode 100644 index 0000000..b2f1611 --- /dev/null +++ b/tests/test_cases/deps/install/qux.hpp @@ -0,0 +1,8 @@ +#ifndef QUX_HPP +#define QUX_HPP + +#include <iostream> + +void qux() { std::cout << "qux" << std::endl; } + +#endif
\ No newline at end of file diff --git a/tests/test_cases/deps/object/TARGETS b/tests/test_cases/deps/object/TARGETS new file mode 100644 index 0000000..98d7bdb --- /dev/null +++ b/tests/test_cases/deps/object/TARGETS @@ -0,0 +1,43 @@ +{ "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"] + } +, "baz": + { "type": ["@", "rules", "CC", "library"] + , "name": ["baz"] + , "shared": ["yes"] + , "deps": ["bar"] + , "stage": ["baz"] + } +, "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; +} diff --git a/tests/test_cases/deps/prebuilt/TARGETS b/tests/test_cases/deps/prebuilt/TARGETS new file mode 100644 index 0000000..c923995 --- /dev/null +++ b/tests/test_cases/deps/prebuilt/TARGETS @@ -0,0 +1,158 @@ +{ "foo.pc": + { "type": "file_gen" + , "name": "foo.pc" + , "data": + { "type": "join" + , "separator": "\n" + , "$1": + [ "Name: foo" + , "Version: 1.2.3" + , "Description: test prebuilt foo" + , "URL: unknown" + , "Cflags: -I/usr/include -DUSE_FOO=1" + , "Libs: -L/usr/lib -lfoo -lpthread" + ] + } + } +, "foo": + { "type": ["@", "rules", "CC/prebuilt", "library"] + , "name": ["foo"] + , "version": ["1", "2", "3"] + , "hdrs": ["foo.hpp"] + , "lib": [["shared", "foo"]] + , "pkg-config": ["foo.pc"] + , "stage": ["foo"] + } +, "foo_s": + { "type": ["@", "rules", "CC/prebuilt", "library"] + , "name": ["foo"] + , "version": ["1", "2", "3"] + , "hdrs": ["foo.hpp"] + , "lib": [["shared", "foo_s"]] + , "pkg-config": ["foo.pc"] + , "stage": ["foo"] + } +, "bar.pc": + { "type": "file_gen" + , "name": "bar.pc" + , "data": + { "type": "join" + , "separator": "\n" + , "$1": + [ "Name: bar" + , "Version: unknown" + , "Description: test prebuilt bar" + , "URL: unknown" + , "Cflags: -I/usr/include -DUSE_BAR=1" + , "Libs: -L/usr/lib -lbar -lpthread -lm" + ] + } + } +, "bar": + { "type": ["@", "rules", "CC/prebuilt", "library"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "lib": [["shared", "bar"]] + , "pkg-config": ["bar.pc"] + , "stage": ["bar"] + , "deps": ["foo"] + } +, "bar_s": + { "type": ["@", "rules", "CC/prebuilt", "library"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "lib": [["shared", "bar_s"]] + , "pkg-config": ["bar.pc"] + , "stage": ["bar"] + , "deps": ["foo"] + } +, "main_uses_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main_uses_foo"] + , "srcs": [["shared", "main_uses_foo.cpp"]] + , "private-deps": ["foo"] + } +, "test_uses_foo": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_foo"] + , "srcs": [["shared", "test_uses_foo.cpp"]] + , "private-deps": ["foo"] + } +, "main_uses_bar": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main_uses_bar"] + , "srcs": [["shared", "main_uses_bar.cpp"]] + , "private-deps": ["bar"] + } +, "test_uses_bar": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_bar"] + , "srcs": [["shared", "test_uses_bar.cpp"]] + , "private-deps": ["bar"] + } +, "test_uses_bar_s": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_bar"] + , "srcs": [["shared", "test_uses_bar.cpp"]] + , "private-deps": ["bar_s"] + } +, "test_uses_main": + { "type": ["@", "rules", "shell/test", "script"] + , "name": ["test_uses_main"] + , "test": [["shared", "test_uses_main.sh"]] + , "deps": ["main_uses_bar"] + } +, "install_foo": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["foo"]} +, "install_bar": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["bar"]} +, "install_main": + { "type": ["@", "rules", "CC", "install-with-deps"] + , "targets": ["main_uses_bar"] + } +, "foobar.pc": + { "type": "file_gen" + , "name": "foobar.pc" + , "data": + { "type": "join" + , "separator": "\n" + , "$1": + [ "Name: foobar" + , "Version: unknown" + , "Description: test compound prebuilt foobar" + , "URL: unknown" + , "Requires: bar, foo >= 1.2.3" + ] + } + } +, "foobar": + { "type": ["@", "rules", "CC/prebuilt", "library"] + , "name": ["foobar"] + , "hdrs": ["bar.hpp"] + , "lib": [["shared", "bar"], ["shared", "foo"]] + , "pkg-config": ["foobar.pc", "foo.pc", "bar.pc"] + , "stage": ["bar"] + } +, "foobar_s": + { "type": ["@", "rules", "CC/prebuilt", "library"] + , "name": ["foobar"] + , "hdrs": ["bar.hpp"] + , "lib": [["shared", "bar_s"], ["shared", "foo_s"]] + , "pkg-config": ["foobar.pc", "foo.pc", "bar.pc"] + , "stage": ["bar"] + } +, "test_uses_foobar": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_bar"] + , "srcs": [["shared", "test_uses_bar.cpp"]] + , "private-deps": ["foobar"] + } +, "test_uses_foobar_s": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_bar"] + , "srcs": [["shared", "test_uses_bar.cpp"]] + , "private-deps": ["foobar_s"] + } +, "install_foobar": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["foobar"]} +} diff --git a/tests/test_cases/deps/prebuilt/bar.hpp b/tests/test_cases/deps/prebuilt/bar.hpp new file mode 100644 index 0000000..243dba6 --- /dev/null +++ b/tests/test_cases/deps/prebuilt/bar.hpp @@ -0,0 +1,8 @@ +#ifndef BAR_HPP +#define BAR_HPP + +#ifdef USE_BAR +int bar(); +#endif + +#endif diff --git a/tests/test_cases/deps/prebuilt/foo.hpp b/tests/test_cases/deps/prebuilt/foo.hpp new file mode 100644 index 0000000..4f040d4 --- /dev/null +++ b/tests/test_cases/deps/prebuilt/foo.hpp @@ -0,0 +1,8 @@ +#ifndef FOO_HPP +#define FOO_HPP + +#ifdef USE_FOO +int foo(); +#endif + +#endif diff --git a/tests/test_cases/deps/private/TARGETS b/tests/test_cases/deps/private/TARGETS new file mode 100644 index 0000000..dd72948 --- /dev/null +++ b/tests/test_cases/deps/private/TARGETS @@ -0,0 +1,36 @@ +{ "foo": + { "type": ["@", "rules", "CC", "library"] + , "name": ["foo"] + , "hdrs": ["foo.hpp"] + , "srcs": ["foo.cpp"] + , "stage": ["foo"] + } +, "bar": + { "type": ["@", "rules", "CC", "library"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "srcs": ["bar.cpp"] + , "private-deps": ["foo"] + , "stage": ["bar"] + } +, "main_includes_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_includes_foo.cpp"] + , "private-deps": ["bar"] + } +, "main_links_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_links_foo.cpp"] + , "private-deps": ["bar"] + } +, "main_links_bar_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_links_bar_foo.cpp"] + , "private-deps": ["bar"] + } +, "install_bar": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["bar"]} +} diff --git a/tests/test_cases/deps/private/bar.cpp b/tests/test_cases/deps/private/bar.cpp new file mode 100644 index 0000000..dfce0e8 --- /dev/null +++ b/tests/test_cases/deps/private/bar.cpp @@ -0,0 +1,8 @@ +#include "foo/foo.hpp" +#include "bar.hpp" +#include <iostream> + +int bar() { + std::cout << "bar\n"; + return foo(); +} diff --git a/tests/test_cases/deps/private/bar.hpp b/tests/test_cases/deps/private/bar.hpp new file mode 100644 index 0000000..94d4f16 --- /dev/null +++ b/tests/test_cases/deps/private/bar.hpp @@ -0,0 +1,6 @@ +#ifndef BAR_HPP +#define BAR_HPP + +int bar(); + +#endif diff --git a/tests/test_cases/deps/private/foo.cpp b/tests/test_cases/deps/private/foo.cpp new file mode 100644 index 0000000..f985022 --- /dev/null +++ b/tests/test_cases/deps/private/foo.cpp @@ -0,0 +1,7 @@ +#include "foo.hpp" +#include <iostream> + +int foo() { + std::cout << "foo\n"; + return 0; +} diff --git a/tests/test_cases/deps/private/foo.hpp b/tests/test_cases/deps/private/foo.hpp new file mode 100644 index 0000000..1a28686 --- /dev/null +++ b/tests/test_cases/deps/private/foo.hpp @@ -0,0 +1,6 @@ +#ifndef FOO_HPP +#define FOO_HPP + +int foo(); + +#endif diff --git a/tests/test_cases/deps/private/main_includes_foo.cpp b/tests/test_cases/deps/private/main_includes_foo.cpp new file mode 100644 index 0000000..16701c7 --- /dev/null +++ b/tests/test_cases/deps/private/main_includes_foo.cpp @@ -0,0 +1,9 @@ +// test that foo.hpp not available + +#include "foo/foo.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + return 0; +} diff --git a/tests/test_cases/deps/private/main_links_bar_foo.cpp b/tests/test_cases/deps/private/main_links_bar_foo.cpp new file mode 100644 index 0000000..e936074 --- /dev/null +++ b/tests/test_cases/deps/private/main_links_bar_foo.cpp @@ -0,0 +1,9 @@ +// test that foo is linked after bar + +#include "bar/bar.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + return bar(); +} diff --git a/tests/test_cases/deps/private/main_links_foo.cpp b/tests/test_cases/deps/private/main_links_foo.cpp new file mode 100644 index 0000000..1e1e07a --- /dev/null +++ b/tests/test_cases/deps/private/main_links_foo.cpp @@ -0,0 +1,10 @@ +// test that foo is linked + +#include <iostream> + +int foo(); // forward declare + +int main() { + std::cout << "main\n"; + return foo(); +} diff --git a/tests/test_cases/deps/public/TARGETS b/tests/test_cases/deps/public/TARGETS new file mode 100644 index 0000000..bc1807a --- /dev/null +++ b/tests/test_cases/deps/public/TARGETS @@ -0,0 +1,36 @@ +{ "foo": + { "type": ["@", "rules", "CC", "library"] + , "name": ["foo"] + , "hdrs": ["foo.hpp"] + , "srcs": ["foo.cpp"] + , "stage": ["foo"] + } +, "bar": + { "type": ["@", "rules", "CC", "library"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "srcs": ["bar.cpp"] + , "deps": ["foo"] + , "stage": ["bar"] + } +, "main_includes_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_includes_foo.cpp"] + , "private-deps": ["bar"] + } +, "main_links_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_links_foo.cpp"] + , "private-deps": ["bar"] + } +, "main_links_bar_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main"] + , "srcs": ["main_links_bar_foo.cpp"] + , "private-deps": ["bar"] + } +, "install_bar": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["bar"]} +} diff --git a/tests/test_cases/deps/public/bar.cpp b/tests/test_cases/deps/public/bar.cpp new file mode 100644 index 0000000..f2a779a --- /dev/null +++ b/tests/test_cases/deps/public/bar.cpp @@ -0,0 +1,7 @@ +#include "bar.hpp" +#include <iostream> + +int bar(Foo *foo) { + std::cout << "bar\n"; + return (foo == nullptr) ? -1 : foo->foo(); +} diff --git a/tests/test_cases/deps/public/bar.hpp b/tests/test_cases/deps/public/bar.hpp new file mode 100644 index 0000000..ec9c165 --- /dev/null +++ b/tests/test_cases/deps/public/bar.hpp @@ -0,0 +1,8 @@ +#ifndef BAR_HPP +#define BAR_HPP + +#include "foo/foo.hpp" + +int bar(Foo *foo); + +#endif diff --git a/tests/test_cases/deps/public/foo.cpp b/tests/test_cases/deps/public/foo.cpp new file mode 100644 index 0000000..6899c7a --- /dev/null +++ b/tests/test_cases/deps/public/foo.cpp @@ -0,0 +1,7 @@ +#include "foo.hpp" +#include <iostream> + +int Foo::foo() { + std::cout << "foo\n"; + return 0; +} diff --git a/tests/test_cases/deps/public/foo.hpp b/tests/test_cases/deps/public/foo.hpp new file mode 100644 index 0000000..025f3ef --- /dev/null +++ b/tests/test_cases/deps/public/foo.hpp @@ -0,0 +1,8 @@ +#ifndef FOO_HPP +#define FOO_HPP + +struct Foo { + int foo(); +}; + +#endif diff --git a/tests/test_cases/deps/public/main_includes_foo.cpp b/tests/test_cases/deps/public/main_includes_foo.cpp new file mode 100644 index 0000000..e8a85b6 --- /dev/null +++ b/tests/test_cases/deps/public/main_includes_foo.cpp @@ -0,0 +1,9 @@ +// test that foo.hpp is available (despite unused here) + +#include "foo/foo.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + return 0; +} diff --git a/tests/test_cases/deps/public/main_links_bar_foo.cpp b/tests/test_cases/deps/public/main_links_bar_foo.cpp new file mode 100644 index 0000000..02c2966 --- /dev/null +++ b/tests/test_cases/deps/public/main_links_bar_foo.cpp @@ -0,0 +1,10 @@ +// test that foo is linked after bar + +#include "bar/bar.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + Foo foo{}; + return bar(&foo); +} diff --git a/tests/test_cases/deps/public/main_links_foo.cpp b/tests/test_cases/deps/public/main_links_foo.cpp new file mode 100644 index 0000000..f9cc308 --- /dev/null +++ b/tests/test_cases/deps/public/main_links_foo.cpp @@ -0,0 +1,10 @@ +// test that foo is linked + +#include "foo/foo.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + Foo{}.foo(); + return 0; +} diff --git a/tests/test_cases/deps/shared/TARGETS b/tests/test_cases/deps/shared/TARGETS new file mode 100644 index 0000000..9db7fb8 --- /dev/null +++ b/tests/test_cases/deps/shared/TARGETS @@ -0,0 +1,104 @@ +{ "foo": + { "type": ["@", "rules", "CC", "library"] + , "shared": ["yes"] + , "name": ["foo"] + , "soversion": ["1", "2", "3"] + , "hdrs": ["foo.hpp"] + , "srcs": ["foo.cpp"] + , "stage": ["foo"] + } +, "foo_s": + { "type": ["@", "rules", "CC", "library"] + , "name": ["foo"] + , "hdrs": ["foo.hpp"] + , "srcs": ["foo.cpp"] + , "stage": ["foo"] + } +, "bar": + { "type": ["@", "rules", "CC", "library"] + , "shared": ["yes"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "srcs": ["bar.cpp"] + , "stage": ["bar"] + , "private-deps": ["foo"] + } +, "bar_s": + { "type": ["@", "rules", "CC", "library"] + , "name": ["bar"] + , "hdrs": ["bar.hpp"] + , "srcs": ["bar.cpp"] + , "stage": ["bar"] + , "private-deps": ["foo"] + } +, "baz": + { "type": ["@", "rules", "CC", "library"] + , "name": ["baz"] + , "shared": ["yes"] + , "hdrs": ["baz.hpp"] + , "srcs": ["baz.cpp"] + , "stage": ["baz"] + , "private-deps": ["foo_s"] + } +, "main_uses_foo": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main_uses_foo"] + , "srcs": ["main_uses_foo.cpp"] + , "private-deps": ["foo"] + } +, "test_uses_foo": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_foo"] + , "srcs": ["test_uses_foo.cpp"] + , "private-deps": ["foo"] + } +, "main_uses_bar": + { "type": ["@", "rules", "CC", "binary"] + , "name": ["main_uses_bar"] + , "srcs": ["main_uses_bar.cpp"] + , "private-deps": ["bar"] + } +, "test_uses_bar": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_bar"] + , "srcs": ["test_uses_bar.cpp"] + , "private-deps": ["bar"] + } +, "test_uses_bar_s": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_bar_s"] + , "srcs": ["test_uses_bar.cpp"] + , "private-deps": ["bar_s"] + } +, "test_uses_baz": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_uses_baz"] + , "srcs": ["test_uses_baz.cpp"] + , "private-deps": ["baz"] + } +, "test_uses_main": + { "type": ["@", "rules", "shell/test", "script"] + , "name": ["test_uses_main"] + , "test": ["test_uses_main.sh"] + , "deps": ["main_uses_bar"] + } +, "test_diamond": + { "type": ["@", "rules", "CC/test", "test"] + , "name": ["test_diamond"] + , "srcs": ["test_diamond.cpp"] + , "private-deps": ["foo_s", "baz"] + } +, "install_foo": + { "type": ["@", "rules", "CC", "install-with-deps"] + , "targets": ["foo"] + , "flat-libs": ["yes"] + } +, "install_bar_s": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["bar_s"]} +, "install_baz": + {"type": ["@", "rules", "CC", "install-with-deps"], "targets": ["baz"]} +, "install_main": + { "type": ["@", "rules", "CC", "install-with-deps"] + , "targets": ["main_uses_bar"] + } +} diff --git a/tests/test_cases/deps/shared/bar.cpp b/tests/test_cases/deps/shared/bar.cpp new file mode 100644 index 0000000..dfce0e8 --- /dev/null +++ b/tests/test_cases/deps/shared/bar.cpp @@ -0,0 +1,8 @@ +#include "foo/foo.hpp" +#include "bar.hpp" +#include <iostream> + +int bar() { + std::cout << "bar\n"; + return foo(); +} diff --git a/tests/test_cases/deps/shared/bar.hpp b/tests/test_cases/deps/shared/bar.hpp new file mode 100644 index 0000000..94d4f16 --- /dev/null +++ b/tests/test_cases/deps/shared/bar.hpp @@ -0,0 +1,6 @@ +#ifndef BAR_HPP +#define BAR_HPP + +int bar(); + +#endif diff --git a/tests/test_cases/deps/shared/baz.cpp b/tests/test_cases/deps/shared/baz.cpp new file mode 100644 index 0000000..fae4845 --- /dev/null +++ b/tests/test_cases/deps/shared/baz.cpp @@ -0,0 +1,8 @@ +#include "foo/foo.hpp" +#include "baz.hpp" +#include <iostream> + +int baz() { + std::cout << "baz\n"; + return foo(); +} diff --git a/tests/test_cases/deps/shared/baz.hpp b/tests/test_cases/deps/shared/baz.hpp new file mode 100644 index 0000000..643cf65 --- /dev/null +++ b/tests/test_cases/deps/shared/baz.hpp @@ -0,0 +1,6 @@ +#ifndef BAZ_HPP +#define BAZ_HPP + +int baz(); + +#endif diff --git a/tests/test_cases/deps/shared/foo.cpp b/tests/test_cases/deps/shared/foo.cpp new file mode 100644 index 0000000..f985022 --- /dev/null +++ b/tests/test_cases/deps/shared/foo.cpp @@ -0,0 +1,7 @@ +#include "foo.hpp" +#include <iostream> + +int foo() { + std::cout << "foo\n"; + return 0; +} diff --git a/tests/test_cases/deps/shared/foo.hpp b/tests/test_cases/deps/shared/foo.hpp new file mode 100644 index 0000000..1a28686 --- /dev/null +++ b/tests/test_cases/deps/shared/foo.hpp @@ -0,0 +1,6 @@ +#ifndef FOO_HPP +#define FOO_HPP + +int foo(); + +#endif diff --git a/tests/test_cases/deps/shared/main_uses_bar.cpp b/tests/test_cases/deps/shared/main_uses_bar.cpp new file mode 100644 index 0000000..9cfc855 --- /dev/null +++ b/tests/test_cases/deps/shared/main_uses_bar.cpp @@ -0,0 +1,8 @@ +#include "bar/bar.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + bar(); + return 0; +} diff --git a/tests/test_cases/deps/shared/main_uses_foo.cpp b/tests/test_cases/deps/shared/main_uses_foo.cpp new file mode 100644 index 0000000..0fb3bb6 --- /dev/null +++ b/tests/test_cases/deps/shared/main_uses_foo.cpp @@ -0,0 +1,8 @@ +#include "foo/foo.hpp" +#include <iostream> + +int main() { + std::cout << "main\n"; + foo(); + return 0; +} diff --git a/tests/test_cases/deps/shared/test_diamond.cpp b/tests/test_cases/deps/shared/test_diamond.cpp new file mode 100644 index 0000000..9298230 --- /dev/null +++ b/tests/test_cases/deps/shared/test_diamond.cpp @@ -0,0 +1,4 @@ +#include "baz/baz.hpp" +#include "foo/foo.hpp" + +int main() { return foo() + baz(); } diff --git a/tests/test_cases/deps/shared/test_uses_bar.cpp b/tests/test_cases/deps/shared/test_uses_bar.cpp new file mode 100644 index 0000000..c2076ec --- /dev/null +++ b/tests/test_cases/deps/shared/test_uses_bar.cpp @@ -0,0 +1,3 @@ +#include "bar/bar.hpp" + +int main() { return bar(); } diff --git a/tests/test_cases/deps/shared/test_uses_baz.cpp b/tests/test_cases/deps/shared/test_uses_baz.cpp new file mode 100644 index 0000000..02d67f9 --- /dev/null +++ b/tests/test_cases/deps/shared/test_uses_baz.cpp @@ -0,0 +1,3 @@ +#include "baz/baz.hpp" + +int main() { return baz(); } diff --git a/tests/test_cases/deps/shared/test_uses_foo.cpp b/tests/test_cases/deps/shared/test_uses_foo.cpp new file mode 100644 index 0000000..88feb93 --- /dev/null +++ b/tests/test_cases/deps/shared/test_uses_foo.cpp @@ -0,0 +1,3 @@ +#include "foo/foo.hpp" + +int main() { return foo(); } diff --git a/tests/test_cases/deps/shared/test_uses_main.sh b/tests/test_cases/deps/shared/test_uses_main.sh new file mode 100644 index 0000000..ab8672f --- /dev/null +++ b/tests/test_cases/deps/shared/test_uses_main.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -e + +./main_uses_bar | grep main +./main_uses_bar | grep bar +./main_uses_bar | grep foo |