diff options
20 files changed, 202 insertions, 20 deletions
diff --git a/backends.py b/backends.py index e554488..3052ee6 100644 --- a/backends.py +++ b/backends.py @@ -20,7 +20,7 @@ from coredata import MesonException class TestSerialisation: def __init__(self, name, fname, is_cross, exe_wrapper, is_parallel, cmd_args, env, - should_fail, valgrind_args, timeout): + should_fail, valgrind_args, timeout, extra_paths): self.name = name self.fname = fname self.is_cross = is_cross @@ -31,6 +31,7 @@ class TestSerialisation: self.should_fail = should_fail self.valgrind_args = valgrind_args self.timeout = timeout + self.extra_paths = extra_paths # This class contains the basic functionality that is needed by all backends. # Feel free to move stuff in and out of it as you see fit. @@ -238,6 +239,17 @@ class Backend(): args += self.build_target_link_arguments(compiler, d.get_dependencies()) return args + def determine_windows_extra_paths(self, target): + '''On Windows there is no such thing as an rpath. + We must determine all locations of DLLs that this exe + links to and return them so they can be used in unit + tests.''' + if not isinstance(target, build.Executable): + print(target) + return [] + prospectives = target.get_transitive_rpaths() + return [os.path.join(self.environment.get_build_dir(), i) for i in prospectives if len(i) > 0] + def write_test_file(self, datafile): arr = [] for t in self.build.get_tests(): @@ -251,9 +263,13 @@ class Backend(): exe_wrapper = self.environment.cross_info.config['binaries'].get('exe_wrapper', None) else: exe_wrapper = None + if mesonlib.is_windows(): + extra_paths = self.determine_windows_extra_paths(exe) + else: + extra_paths = [] ts = TestSerialisation(t.get_name(), fname, is_cross, exe_wrapper, t.is_parallel, t.cmd_args, t.env, t.should_fail, t.valgrind_args, - t.timeout) + t.timeout, extra_paths) arr.append(ts) pickle.dump(arr, datafile) diff --git a/manual tests/7 vala composite widgets/meson.build b/manual tests/7 vala composite widgets/meson.build index 39a6348..6bfe7ad 100644 --- a/manual tests/7 vala composite widgets/meson.build +++ b/manual tests/7 vala composite widgets/meson.build @@ -16,5 +16,5 @@ executable( res, ], dependencies : deps, - vala_args : '--gresources=@0@/my-resources.xml'.format(meson.current_source_dir()), + vala_args : ['--gresources', res]), ) diff --git a/meson_test.py b/meson_test.py index 5dedd01..025571d 100755 --- a/meson_test.py +++ b/meson_test.py @@ -95,6 +95,8 @@ def run_single_test(wrap, test): starttime = time.time() child_env = os.environ.copy() child_env.update(test.env) + if len(test.extra_paths) > 0: + child_env['PATH'] = child_env['PATH'] + ';'.join([''] + test.extra_paths) p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=child_env) timed_out = False diff --git a/test cases/common/46 library chain/subdir/lib1.c b/test cases/common/46 library chain/subdir/lib1.c index a1fd5bc..499ef82 100644 --- a/test cases/common/46 library chain/subdir/lib1.c +++ b/test cases/common/46 library chain/subdir/lib1.c @@ -1,6 +1,17 @@ int lib2fun(); int lib3fun(); -int libfun() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC libfun() { return lib2fun() + lib3fun(); } diff --git a/test cases/common/46 library chain/subdir/subdir2/lib2.c b/test cases/common/46 library chain/subdir/subdir2/lib2.c index 490e444..34fadf2 100644 --- a/test cases/common/46 library chain/subdir/subdir2/lib2.c +++ b/test cases/common/46 library chain/subdir/subdir2/lib2.c @@ -1,3 +1,14 @@ -int lib2fun() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC lib2fun() { return 0; } diff --git a/test cases/common/46 library chain/subdir/subdir3/lib3.c b/test cases/common/46 library chain/subdir/subdir3/lib3.c index fed00d5..7bd88af 100644 --- a/test cases/common/46 library chain/subdir/subdir3/lib3.c +++ b/test cases/common/46 library chain/subdir/subdir3/lib3.c @@ -1,3 +1,14 @@ -int lib3fun() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC lib3fun() { return 0; } diff --git a/test cases/common/49 subproject/subprojects/sublib/include/subdefs.h b/test cases/common/49 subproject/subprojects/sublib/include/subdefs.h index 9261c78..681c7b8 100644 --- a/test cases/common/49 subproject/subprojects/sublib/include/subdefs.h +++ b/test cases/common/49 subproject/subprojects/sublib/include/subdefs.h @@ -1,6 +1,21 @@ #ifndef SUBDEFS_H_ #define SUBDEFS_H_ -int subfunc(); +#if defined _WIN32 || defined __CYGWIN__ +#if defined BUILDING_SUB + #define DLL_PUBLIC __declspec(dllexport) +#else + #define DLL_PUBLIC __declspec(dllimport) +#endif +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC subfunc(); #endif diff --git a/test cases/common/49 subproject/subprojects/sublib/meson.build b/test cases/common/49 subproject/subprojects/sublib/meson.build index d8e4140..0b6911d 100644 --- a/test cases/common/49 subproject/subprojects/sublib/meson.build +++ b/test cases/common/49 subproject/subprojects/sublib/meson.build @@ -5,6 +5,7 @@ if not meson.is_subproject() endif i = include_directories('include') -l = shared_library('sublib', 'sublib.c', include_directories : i, install : true) +l = shared_library('sublib', 'sublib.c', include_directories : i, install : true, + c_args : '-DBUILDING_SUB=2') t = executable('simpletest', 'simpletest.c', include_directories : i, link_with : l) test('plain', t) diff --git a/test cases/common/49 subproject/subprojects/sublib/sublib.c b/test cases/common/49 subproject/subprojects/sublib/sublib.c index 7045c61..c13326b 100644 --- a/test cases/common/49 subproject/subprojects/sublib/sublib.c +++ b/test cases/common/49 subproject/subprojects/sublib/sublib.c @@ -1,5 +1,5 @@ #include<subdefs.h> -int subfunc() { +int DLL_PUBLIC subfunc() { return 42; } diff --git a/test cases/common/53 subproject subproject/subprojects/a/a.c b/test cases/common/53 subproject subproject/subprojects/a/a.c index 751749d..7ac3e5e 100644 --- a/test cases/common/53 subproject subproject/subprojects/a/a.c +++ b/test cases/common/53 subproject subproject/subprojects/a/a.c @@ -1,4 +1,15 @@ int func2(); -int func() { return func2(); } +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func() { return func2(); } diff --git a/test cases/common/53 subproject subproject/subprojects/b/b.c b/test cases/common/53 subproject subproject/subprojects/b/b.c index 68e6ab9..a95651b 100644 --- a/test cases/common/53 subproject subproject/subprojects/b/b.c +++ b/test cases/common/53 subproject subproject/subprojects/b/b.c @@ -1,3 +1,14 @@ -int func2() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC func2() { return 42; } diff --git a/test cases/common/60 install script/meson.build b/test cases/common/60 install script/meson.build index f140dd0..ed415b6 100644 --- a/test cases/common/60 install script/meson.build +++ b/test cases/common/60 install script/meson.build @@ -1,4 +1,8 @@ project('custom install script', 'c') -meson.set_install_script('myinstall.sh') +if meson.get_compiler('c').get_id() == 'msvc' + meson.set_install_script('myinstall.bat') +else + meson.set_install_script('myinstall.sh') +endif executable('prog', 'prog.c', install : true) diff --git a/test cases/common/62 exe static shared/subdir/shlib.c b/test cases/common/62 exe static shared/subdir/shlib.c index b513e13..d649c7d 100644 --- a/test cases/common/62 exe static shared/subdir/shlib.c +++ b/test cases/common/62 exe static shared/subdir/shlib.c @@ -1,3 +1,14 @@ -int shlibfunc() { +#if defined _WIN32 || defined __CYGWIN__ + #define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +int DLL_PUBLIC shlibfunc() { return 42; } diff --git a/test cases/common/79 shared subproject/subprojects/B/b.c b/test cases/common/79 shared subproject/subprojects/B/b.c index 03b0cc7..a1f3a51 100644 --- a/test cases/common/79 shared subproject/subprojects/B/b.c +++ b/test cases/common/79 shared subproject/subprojects/B/b.c @@ -1,7 +1,19 @@ #include<stdlib.h> +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + + char func_c(); -char func_b() { +char DLL_PUBLIC func_b() { if(func_c() != 'c') { exit(3); } diff --git a/test cases/common/79 shared subproject/subprojects/C/c.c b/test cases/common/79 shared subproject/subprojects/C/c.c index 3bbac08..eebfb9f 100644 --- a/test cases/common/79 shared subproject/subprojects/C/c.c +++ b/test cases/common/79 shared subproject/subprojects/C/c.c @@ -1,3 +1,14 @@ -char func_c() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { return 'c'; } diff --git a/test cases/common/80 shared subproject 2/subprojects/B/b.c b/test cases/common/80 shared subproject 2/subprojects/B/b.c index 03b0cc7..4c94ee9 100644 --- a/test cases/common/80 shared subproject 2/subprojects/B/b.c +++ b/test cases/common/80 shared subproject 2/subprojects/B/b.c @@ -1,7 +1,18 @@ #include<stdlib.h> char func_c(); -char func_b() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_b() { if(func_c() != 'c') { exit(3); } diff --git a/test cases/common/80 shared subproject 2/subprojects/C/c.c b/test cases/common/80 shared subproject 2/subprojects/C/c.c index 3bbac08..eebfb9f 100644 --- a/test cases/common/80 shared subproject 2/subprojects/C/c.c +++ b/test cases/common/80 shared subproject 2/subprojects/C/c.c @@ -1,3 +1,14 @@ -char func_c() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { return 'c'; } diff --git a/test cases/common/82 custom subproject dir/custom_subproject_dir/B/b.c b/test cases/common/82 custom subproject dir/custom_subproject_dir/B/b.c index 03b0cc7..4c94ee9 100644 --- a/test cases/common/82 custom subproject dir/custom_subproject_dir/B/b.c +++ b/test cases/common/82 custom subproject dir/custom_subproject_dir/B/b.c @@ -1,7 +1,18 @@ #include<stdlib.h> char func_c(); -char func_b() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_b() { if(func_c() != 'c') { exit(3); } diff --git a/test cases/common/82 custom subproject dir/custom_subproject_dir/C/c.c b/test cases/common/82 custom subproject dir/custom_subproject_dir/C/c.c index 3bbac08..eebfb9f 100644 --- a/test cases/common/82 custom subproject dir/custom_subproject_dir/C/c.c +++ b/test cases/common/82 custom subproject dir/custom_subproject_dir/C/c.c @@ -1,3 +1,14 @@ -char func_c() { +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + +char DLL_PUBLIC func_c() { return 'c'; } diff --git a/test cases/common/86 same basename/lib.c b/test cases/common/86 same basename/lib.c index 11ce3b3..6fd432e 100644 --- a/test cases/common/86 same basename/lib.c +++ b/test cases/common/86 same basename/lib.c @@ -1,5 +1,16 @@ +#if defined _WIN32 || defined __CYGWIN__ +#define DLL_PUBLIC __declspec(dllexport) +#else + #if defined __GNUC__ + #define DLL_PUBLIC __attribute__ ((visibility("default"))) + #else + #pragma message ("Compiler does not support symbol visibility.") + #define DLL_PUBLIC + #endif +#endif + #if defined SHAR -int func() { +int DLL_PUBLIC func() { return 1; } #elif defined STAT |