summaryrefslogtreecommitdiff
path: root/test cases/unit
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2018-07-18 17:11:57 +0300
committerJussi Pakkanen <jpakkane@gmail.com>2018-08-27 23:35:29 +0300
commitfb770e1e3d17d548c34817001733f2a13f24ce9f (patch)
tree7e9bf40d6ff7cc23256ec913fb831b35be126906 /test cases/unit
parent1ffc8de5e8cc79dbaa54fd1ac02b6b4c5edac7a1 (diff)
downloadmeson-fb770e1e3d17d548c34817001733f2a13f24ce9f.tar.gz
Add support for custom dist scripts.
Diffstat (limited to 'test cases/unit')
-rw-r--r--test cases/unit/35 dist script/meson.build7
-rw-r--r--test cases/unit/35 dist script/prog.c7
-rwxr-xr-xtest cases/unit/35 dist script/replacer.py12
3 files changed, 26 insertions, 0 deletions
diff --git a/test cases/unit/35 dist script/meson.build b/test cases/unit/35 dist script/meson.build
new file mode 100644
index 000000000..3415ec483
--- /dev/null
+++ b/test cases/unit/35 dist script/meson.build
@@ -0,0 +1,7 @@
+project('dist script', 'c',
+ version : '1.0.0')
+
+exe = executable('comparer', 'prog.c')
+test('compare', exe)
+
+meson.add_dist_script('replacer.py')
diff --git a/test cases/unit/35 dist script/prog.c b/test cases/unit/35 dist script/prog.c
new file mode 100644
index 000000000..1bb6b053e
--- /dev/null
+++ b/test cases/unit/35 dist script/prog.c
@@ -0,0 +1,7 @@
+#include<string.h>
+
+#define REPLACEME "incorrect"
+
+int main(int argc, char **argv) {
+ return strcmp(REPLACEME, "correct");
+}
diff --git a/test cases/unit/35 dist script/replacer.py b/test cases/unit/35 dist script/replacer.py
new file mode 100755
index 000000000..92bcef0d3
--- /dev/null
+++ b/test cases/unit/35 dist script/replacer.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+
+import os, sys
+import pathlib
+
+source_root = pathlib.Path(os.environ['MESON_DIST_ROOT'])
+
+modfile = source_root / 'prog.c'
+
+contents = modfile.read_text()
+contents = contents.replace('"incorrect"', '"correct"')
+modfile.write_text(contents)