summaryrefslogtreecommitdiffstats
path: root/test cases/unit/15 prebuilt object
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/unit/15 prebuilt object
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/unit/15 prebuilt object')
-rw-r--r--test cases/unit/15 prebuilt object/cp.py5
-rw-r--r--test cases/unit/15 prebuilt object/main.c5
-rw-r--r--test cases/unit/15 prebuilt object/meson.build40
-rw-r--r--test cases/unit/15 prebuilt object/source.c8
4 files changed, 58 insertions, 0 deletions
diff --git a/test cases/unit/15 prebuilt object/cp.py b/test cases/unit/15 prebuilt object/cp.py
new file mode 100644
index 0000000..cb09cf3
--- /dev/null
+++ b/test cases/unit/15 prebuilt object/cp.py
@@ -0,0 +1,5 @@
+#! /usr/bin/env python3
+
+import sys
+from shutil import copyfile
+copyfile(*sys.argv[1:])
diff --git a/test cases/unit/15 prebuilt object/main.c b/test cases/unit/15 prebuilt object/main.c
new file mode 100644
index 0000000..480bda5
--- /dev/null
+++ b/test cases/unit/15 prebuilt object/main.c
@@ -0,0 +1,5 @@
+int func();
+
+int main(int argc, char **argv) {
+ return func() == 42 ? 0 : 99;
+}
diff --git a/test cases/unit/15 prebuilt object/meson.build b/test cases/unit/15 prebuilt object/meson.build
new file mode 100644
index 0000000..b542d1c
--- /dev/null
+++ b/test cases/unit/15 prebuilt object/meson.build
@@ -0,0 +1,40 @@
+# This test is on its own because it is special.
+# To run the test you need the prebuilt object
+# file for the given platform.
+#
+# Combined with cross compilation this would make
+# the state space explode so let's just keep this
+# in its own subdir so it's not run during cross
+# compilation tests.
+
+project('prebuilt object', 'c')
+
+if host_machine.system() == 'windows'
+ prebuilt = 'prebuilt.obj'
+else
+ prebuilt = 'prebuilt.o'
+endif
+
+# Remember: do not put source.c in this
+# declaration. run_tests.py generates the
+# prebuilt object before running this test.
+
+e = []
+
+e += executable('exe1', sources: 'main.c', objects: prebuilt)
+e += executable('exe2', sources: 'main.c', objects: files(prebuilt))
+
+sl1 = static_library('lib3', objects: prebuilt)
+e += executable('exe3', sources: 'main.c', objects: sl1.extract_all_objects(recursive: true))
+
+ct = custom_target(output: 'copy-' + prebuilt, input: prebuilt,
+ command: [find_program('cp.py'), '@INPUT@', '@OUTPUT@'])
+e += executable('exe4', 'main.c', ct)
+e += executable('exe5', 'main.c', ct[0])
+
+sl2 = static_library('lib6', sources: ct)
+e += executable('exe6', sources: 'main.c', objects: sl2.extract_all_objects(recursive: true))
+
+foreach i : e
+ test(i.name(), i)
+endforeach
diff --git a/test cases/unit/15 prebuilt object/source.c b/test cases/unit/15 prebuilt object/source.c
new file mode 100644
index 0000000..f39b4f3
--- /dev/null
+++ b/test cases/unit/15 prebuilt object/source.c
@@ -0,0 +1,8 @@
+/*
+ * Compile this manually on new platforms and add the
+ * object file to revision control and Meson configuration.
+ */
+
+int func() {
+ return 42;
+}