summaryrefslogtreecommitdiff
path: root/test cases/common/22 object extraction
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2021-04-26 16:52:13 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2021-04-26 23:39:15 +0100
commite75e3976facda7de244fbb9a02eebf0d043ea1c8 (patch)
treedab22f95b5c837a70b1b4164d97ff351a49ffd81 /test cases/common/22 object extraction
parent53fe7c2f0a51697cd57628753852dd3f8711becf (diff)
downloadmeson-e75e3976facda7de244fbb9a02eebf0d043ea1c8.tar.gz
Condense test directory names.
Diffstat (limited to 'test cases/common/22 object extraction')
-rw-r--r--test cases/common/22 object extraction/lib.c3
-rw-r--r--test cases/common/22 object extraction/lib2.c3
-rw-r--r--test cases/common/22 object extraction/main.c5
-rw-r--r--test cases/common/22 object extraction/meson.build23
-rw-r--r--test cases/common/22 object extraction/src/lib.c3
5 files changed, 37 insertions, 0 deletions
diff --git a/test cases/common/22 object extraction/lib.c b/test cases/common/22 object extraction/lib.c
new file mode 100644
index 000000000..81805512f
--- /dev/null
+++ b/test cases/common/22 object extraction/lib.c
@@ -0,0 +1,3 @@
+int func(void) {
+ return 42;
+}
diff --git a/test cases/common/22 object extraction/lib2.c b/test cases/common/22 object extraction/lib2.c
new file mode 100644
index 000000000..5020593c6
--- /dev/null
+++ b/test cases/common/22 object extraction/lib2.c
@@ -0,0 +1,3 @@
+int retval(void) {
+ return 43;
+}
diff --git a/test cases/common/22 object extraction/main.c b/test cases/common/22 object extraction/main.c
new file mode 100644
index 000000000..27162c5e0
--- /dev/null
+++ b/test cases/common/22 object extraction/main.c
@@ -0,0 +1,5 @@
+int func(void);
+
+int main(void) {
+ return func() == 42 ? 0 : 1;
+}
diff --git a/test cases/common/22 object extraction/meson.build b/test cases/common/22 object extraction/meson.build
new file mode 100644
index 000000000..18be1dbeb
--- /dev/null
+++ b/test cases/common/22 object extraction/meson.build
@@ -0,0 +1,23 @@
+project('object extraction', 'c')
+
+if meson.is_unity()
+ message('Skipping extraction test because this is a Unity build.')
+else
+ lib1 = shared_library('somelib', 'src/lib.c')
+ lib2 = shared_library('somelib2', 'lib.c', 'lib2.c')
+
+ obj1 = lib1.extract_objects('src/lib.c')
+ obj2 = lib2.extract_objects(['lib.c'])
+ obj3 = lib2.extract_objects(files('lib.c'))
+ obj4 = lib2.extract_objects(['lib.c', 'lib.c'])
+
+ e1 = executable('main1', 'main.c', objects : obj1)
+ e2 = executable('main2', 'main.c', objects : obj2)
+ e3 = executable('main3', 'main.c', objects : obj3)
+ e4 = executable('main4', 'main.c', objects : obj4)
+
+ test('extraction test 1', e1)
+ test('extraction test 2', e2)
+ test('extraction test 3', e3)
+ test('extraction test 4', e4)
+endif
diff --git a/test cases/common/22 object extraction/src/lib.c b/test cases/common/22 object extraction/src/lib.c
new file mode 100644
index 000000000..81805512f
--- /dev/null
+++ b/test cases/common/22 object extraction/src/lib.c
@@ -0,0 +1,3 @@
+int func(void) {
+ return 42;
+}