summaryrefslogtreecommitdiffstats
path: root/test cases/common/102 extract same name
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-29 04:41:38 +0000
commit7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch)
tree4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/common/102 extract same name
parentInitial commit. (diff)
downloadmeson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.tar.xz
meson-7b6e527f440cd7e6f8be2b07cee320ee6ca18786.zip
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/common/102 extract same name')
-rw-r--r--test cases/common/102 extract same name/lib.c3
-rw-r--r--test cases/common/102 extract same name/main.c6
-rw-r--r--test cases/common/102 extract same name/meson.build19
-rw-r--r--test cases/common/102 extract same name/src/lib.c3
4 files changed, 31 insertions, 0 deletions
diff --git a/test cases/common/102 extract same name/lib.c b/test cases/common/102 extract same name/lib.c
new file mode 100644
index 0000000..f3d0417
--- /dev/null
+++ b/test cases/common/102 extract same name/lib.c
@@ -0,0 +1,3 @@
+int func1(void) {
+ return 23;
+}
diff --git a/test cases/common/102 extract same name/main.c b/test cases/common/102 extract same name/main.c
new file mode 100644
index 0000000..e5a0c1e
--- /dev/null
+++ b/test cases/common/102 extract same name/main.c
@@ -0,0 +1,6 @@
+int func1(void);
+int func2(void);
+
+int main(void) {
+ return !(func1() == 23 && func2() == 42);
+}
diff --git a/test cases/common/102 extract same name/meson.build b/test cases/common/102 extract same name/meson.build
new file mode 100644
index 0000000..08daa5b
--- /dev/null
+++ b/test cases/common/102 extract same name/meson.build
@@ -0,0 +1,19 @@
+project('object extraction', 'c')
+
+if meson.backend() == 'xcode'
+ # Xcode gives object files unique names but only if they would clash. For example
+ # two files named lib.o instead get the following names:
+ #
+ # lib-4fbe522d8ba4cb1f1b89cc2df640a2336b92e1a5565f0a4c5a79b5b5e2969eb9.o
+ # lib-4fbe522d8ba4cb1f1b89cc2df640a2336deeff2bc2297affaadbe20f5cbfee56.o
+ #
+ # No-one has reverse engineered the naming scheme so we would access them.
+ # IF you feel up to the challenge, patches welcome.
+ error('MESON_SKIP_TEST, Xcode can not extract objs when they would have the same filename.')
+endif
+
+lib = library('somelib', ['lib.c', 'src/lib.c'])
+# Also tests that the object list is flattened properly
+obj = lib.extract_objects(['lib.c', ['src/lib.c']])
+exe = executable('main', 'main.c', objects: obj)
+test('extraction', exe)
diff --git a/test cases/common/102 extract same name/src/lib.c b/test cases/common/102 extract same name/src/lib.c
new file mode 100644
index 0000000..a7d7e77
--- /dev/null
+++ b/test cases/common/102 extract same name/src/lib.c
@@ -0,0 +1,3 @@
+int func2(void) {
+ return 42;
+}