aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Klumpp <matthias@tenstral.net>2016-08-20 18:56:54 +0200
committerMatthias Klumpp <matthias@tenstral.net>2016-08-21 01:38:10 +0200
commitd767d8ca3993f3cee47840542f35978f43d3a8ff (patch)
tree0f1f530efa3db98872f0c499f53666960f107763
parent57c54a678c8eec18df345a44075d59f6384be8f0 (diff)
downloadmeson-d767d8ca3993f3cee47840542f35978f43d3a8ff.zip
meson-d767d8ca3993f3cee47840542f35978f43d3a8ff.tar.gz
meson-d767d8ca3993f3cee47840542f35978f43d3a8ff.tar.bz2
Split D library test into static/shared tests
This allows us to disable the shared library test if the GNU D compiler is detected. This is useful, because gdc can not yet build proper shared libraries. We also add a new test here which tests versioning of D shared libraries.
-rw-r--r--test cases/d/2 library/installed_files.txt4
-rw-r--r--test cases/d/2 library/meson.build14
-rw-r--r--test cases/d/2 static library/app.d (renamed from test cases/d/2 library/app.d)0
-rw-r--r--test cases/d/2 static library/installed_files.txt2
-rw-r--r--test cases/d/2 static library/libstuff.d9
-rw-r--r--test cases/d/2 static library/meson.build5
-rw-r--r--test cases/d/3 shared library/app.d8
-rw-r--r--test cases/d/3 shared library/installed_files.txt2
-rw-r--r--test cases/d/3 shared library/libstuff.d (renamed from test cases/d/2 library/libstuff.d)0
-rw-r--r--test cases/d/3 shared library/meson.build12
-rw-r--r--test cases/d/3 shared library/no-installed-files0
-rw-r--r--test cases/d/4 library versions/installed_files.txt9
-rw-r--r--test cases/d/4 library versions/lib.d10
-rw-r--r--test cases/d/4 library versions/meson.build25
-rw-r--r--test cases/d/4 library versions/no-installed-files0
-rw-r--r--test cases/d/5 mixed/app.d (renamed from test cases/d/3 mixed/app.d)0
-rw-r--r--test cases/d/5 mixed/installed_files.txt (renamed from test cases/d/3 mixed/installed_files.txt)0
-rw-r--r--test cases/d/5 mixed/libstuff.c (renamed from test cases/d/3 mixed/libstuff.c)0
-rw-r--r--test cases/d/5 mixed/meson.build (renamed from test cases/d/3 mixed/meson.build)0
-rw-r--r--test cases/d/6 unittest/app.d (renamed from test cases/d/4 unittest/app.d)0
-rw-r--r--test cases/d/6 unittest/installed_files.txt (renamed from test cases/d/4 unittest/installed_files.txt)0
-rw-r--r--test cases/d/6 unittest/meson.build (renamed from test cases/d/4 unittest/meson.build)2
22 files changed, 83 insertions, 19 deletions
diff --git a/test cases/d/2 library/installed_files.txt b/test cases/d/2 library/installed_files.txt
deleted file mode 100644
index f062075..0000000
--- a/test cases/d/2 library/installed_files.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-usr/bin/app_d?exe
-?usr/lib/libstuff.so
-usr/bin/app_s?exe
-usr/lib/libstuff.a
diff --git a/test cases/d/2 library/meson.build b/test cases/d/2 library/meson.build
deleted file mode 100644
index 811131c..0000000
--- a/test cases/d/2 library/meson.build
+++ /dev/null
@@ -1,14 +0,0 @@
-project('D Library', 'd')
-
-if meson.get_compiler('d').get_id() != 'gcc'
- ldyn = shared_library('stuff', 'libstuff.d', install : true)
- ed = executable('app_d', 'app.d', link_with : ldyn, install : true)
- test('linktest_dyn', ed)
-
-else
- message('GDC can not build shared libraries. Build skipped.')
-endif
-
-lstatic = static_library('stuff', 'libstuff.d', install : true)
-es = executable('app_s', 'app.d', link_with : lstatic, install : true)
-test('linktest_static', es)
diff --git a/test cases/d/2 library/app.d b/test cases/d/2 static library/app.d
index 5d84a69..5d84a69 100644
--- a/test cases/d/2 library/app.d
+++ b/test cases/d/2 static library/app.d
diff --git a/test cases/d/2 static library/installed_files.txt b/test cases/d/2 static library/installed_files.txt
new file mode 100644
index 0000000..0f2bab4
--- /dev/null
+++ b/test cases/d/2 static library/installed_files.txt
@@ -0,0 +1,2 @@
+usr/bin/app_s?exe
+usr/lib/libstuff.a
diff --git a/test cases/d/2 static library/libstuff.d b/test cases/d/2 static library/libstuff.d
new file mode 100644
index 0000000..fd3b4d0
--- /dev/null
+++ b/test cases/d/2 static library/libstuff.d
@@ -0,0 +1,9 @@
+
+import std.stdio;
+import std.string : format;
+
+int printLibraryString (string str)
+{
+ writeln ("Static Library says: %s".format (str));
+ return 4;
+}
diff --git a/test cases/d/2 static library/meson.build b/test cases/d/2 static library/meson.build
new file mode 100644
index 0000000..88ed2cb
--- /dev/null
+++ b/test cases/d/2 static library/meson.build
@@ -0,0 +1,5 @@
+project('D Static Library', 'd')
+
+lstatic = static_library('stuff', 'libstuff.d', install : true)
+es = executable('app_s', 'app.d', link_with : lstatic, install : true)
+test('linktest_static', es)
diff --git a/test cases/d/3 shared library/app.d b/test cases/d/3 shared library/app.d
new file mode 100644
index 0000000..5d84a69
--- /dev/null
+++ b/test cases/d/3 shared library/app.d
@@ -0,0 +1,8 @@
+
+import libstuff;
+
+void main ()
+{
+ immutable ret = printLibraryString ("foo");
+ assert (ret == 4);
+}
diff --git a/test cases/d/3 shared library/installed_files.txt b/test cases/d/3 shared library/installed_files.txt
new file mode 100644
index 0000000..d6a4dad
--- /dev/null
+++ b/test cases/d/3 shared library/installed_files.txt
@@ -0,0 +1,2 @@
+usr/bin/app_d?exe
+usr/lib/libstuff.so
diff --git a/test cases/d/2 library/libstuff.d b/test cases/d/3 shared library/libstuff.d
index 676a643..676a643 100644
--- a/test cases/d/2 library/libstuff.d
+++ b/test cases/d/3 shared library/libstuff.d
diff --git a/test cases/d/3 shared library/meson.build b/test cases/d/3 shared library/meson.build
new file mode 100644
index 0000000..5dae66b
--- /dev/null
+++ b/test cases/d/3 shared library/meson.build
@@ -0,0 +1,12 @@
+project('D Shared Library', 'd')
+
+if meson.get_compiler('d').get_id() != 'gcc'
+
+ ldyn = shared_library('stuff', 'libstuff.d', install : true)
+ ed = executable('app_d', 'app.d', link_with : ldyn, install : true)
+ test('linktest_dyn', ed)
+
+else
+ message('GDC can not build shared libraries. Test skipped.')
+ install_data('no-installed-files', install_dir : '')
+endif
diff --git a/test cases/d/3 shared library/no-installed-files b/test cases/d/3 shared library/no-installed-files
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test cases/d/3 shared library/no-installed-files
diff --git a/test cases/d/4 library versions/installed_files.txt b/test cases/d/4 library versions/installed_files.txt
new file mode 100644
index 0000000..b997e53
--- /dev/null
+++ b/test cases/d/4 library versions/installed_files.txt
@@ -0,0 +1,9 @@
+usr/lib/libsome.so
+usr/lib/libsome.so.0
+usr/lib/libsome.so.1.2.3
+usr/lib/libnoversion.so
+usr/lib/libonlyversion.so
+usr/lib/libonlyversion.so.1
+usr/lib/libonlyversion.so.1.4.5
+usr/lib/libonlysoversion.so
+usr/lib/libonlysoversion.so.5
diff --git a/test cases/d/4 library versions/lib.d b/test cases/d/4 library versions/lib.d
new file mode 100644
index 0000000..94df91e
--- /dev/null
+++ b/test cases/d/4 library versions/lib.d
@@ -0,0 +1,10 @@
+
+import std.stdio;
+import std.string : format;
+
+@safe
+int printLibraryString (string str)
+{
+ writeln ("Library says: %s".format (str));
+ return 4;
+}
diff --git a/test cases/d/4 library versions/meson.build b/test cases/d/4 library versions/meson.build
new file mode 100644
index 0000000..26cc38a
--- /dev/null
+++ b/test cases/d/4 library versions/meson.build
@@ -0,0 +1,25 @@
+project('D library versions', 'd')
+
+if meson.get_compiler('d').get_id() == 'gcc'
+ message('GDC can not build shared libraries. Test skipped.')
+ install_data('no-installed-files', install_dir : '')
+else
+
+ shared_library('some', 'lib.d',
+ version : '1.2.3',
+ soversion : '0',
+ install : true)
+
+ shared_library('noversion', 'lib.d',
+ install : true)
+
+ shared_library('onlyversion', 'lib.d',
+ version : '1.4.5',
+ install : true)
+
+ shared_library('onlysoversion', 'lib.d',
+ # Also test that int soversion is acceptable
+ soversion : 5,
+ install : true)
+
+endif
diff --git a/test cases/d/4 library versions/no-installed-files b/test cases/d/4 library versions/no-installed-files
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test cases/d/4 library versions/no-installed-files
diff --git a/test cases/d/3 mixed/app.d b/test cases/d/5 mixed/app.d
index 6ab5d97..6ab5d97 100644
--- a/test cases/d/3 mixed/app.d
+++ b/test cases/d/5 mixed/app.d
diff --git a/test cases/d/3 mixed/installed_files.txt b/test cases/d/5 mixed/installed_files.txt
index 9e7fccc..9e7fccc 100644
--- a/test cases/d/3 mixed/installed_files.txt
+++ b/test cases/d/5 mixed/installed_files.txt
diff --git a/test cases/d/3 mixed/libstuff.c b/test cases/d/5 mixed/libstuff.c
index 92d6600..92d6600 100644
--- a/test cases/d/3 mixed/libstuff.c
+++ b/test cases/d/5 mixed/libstuff.c
diff --git a/test cases/d/3 mixed/meson.build b/test cases/d/5 mixed/meson.build
index 3dad66d..3dad66d 100644
--- a/test cases/d/3 mixed/meson.build
+++ b/test cases/d/5 mixed/meson.build
diff --git a/test cases/d/4 unittest/app.d b/test cases/d/6 unittest/app.d
index 751e754..751e754 100644
--- a/test cases/d/4 unittest/app.d
+++ b/test cases/d/6 unittest/app.d
diff --git a/test cases/d/4 unittest/installed_files.txt b/test cases/d/6 unittest/installed_files.txt
index e718389..e718389 100644
--- a/test cases/d/4 unittest/installed_files.txt
+++ b/test cases/d/6 unittest/installed_files.txt
diff --git a/test cases/d/4 unittest/meson.build b/test cases/d/6 unittest/meson.build
index ca39adf..1551e94 100644
--- a/test cases/d/4 unittest/meson.build
+++ b/test cases/d/6 unittest/meson.build
@@ -4,5 +4,5 @@ e = executable('dapp', 'app.d', install : true)
test('dapp_run', e, should_fail: true)
e_test = executable('dapp_test', 'app.d',
- d_args: meson.get_compiler('d').get_unittest_flag())
+ d_args: meson.get_compiler('d').unittest_args())
test('dapp_test', e_test)