diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-07-27 17:25:38 +0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-09-30 22:17:50 +0300 |
commit | 01569fee2e8130b3ac54659c119e73180d3dafee (patch) | |
tree | 7fc3b94f3aa921e548455caca7f118ad42b0f677 /run_unittests.py | |
parent | e32b0f8fbbd16b6cdd795a9a596eb56813620055 (diff) | |
download | meson-01569fee2e8130b3ac54659c119e73180d3dafee.zip meson-01569fee2e8130b3ac54659c119e73180d3dafee.tar.gz meson-01569fee2e8130b3ac54659c119e73180d3dafee.tar.bz2 |
Add depfile to configure_file()
In qemu, minikconf generates a depfile that meson could use to
automatically reconfigure on dependency change.
Note: someone clever can perhaps find a way to express this with a
ninja rule & depfile=. I didn't manage, so I wrote a simple depfile
parser.
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-x | run_unittests.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/run_unittests.py b/run_unittests.py index c85ae50..5281aa9 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -40,6 +40,7 @@ from pathlib import (PurePath, Path) from distutils.dir_util import copy_tree import mesonbuild.mlog +import mesonbuild.depfile import mesonbuild.compilers import mesonbuild.environment import mesonbuild.mesonlib @@ -1119,6 +1120,34 @@ class InternalTests(unittest.TestCase): self.assertEqual(quote_arg(arg), expected) self.assertEqual(split_args(expected)[0], arg) + def test_depfile(self): + for (f, target, expdeps) in [ + # empty, unknown target + ([''], 'unknown', set()), + # simple target & deps + (['meson/foo.o : foo.c foo.h'], 'meson/foo.o', set({'foo.c', 'foo.h'})), + (['meson/foo.o: foo.c foo.h'], 'foo.c', set()), + # get all deps + (['meson/foo.o: foo.c foo.h', + 'foo.c: gen.py'], 'meson/foo.o', set({'foo.c', 'foo.h', 'gen.py'})), + (['meson/foo.o: foo.c foo.h', + 'foo.c: gen.py'], 'foo.c', set({'gen.py'})), + # linue continuation, multiple targets + (['foo.o \\', 'foo.h: bar'], 'foo.h', set({'bar'})), + (['foo.o \\', 'foo.h: bar'], 'foo.o', set({'bar'})), + # \\ handling + (['foo: Program\\ F\\iles\\\\X'], 'foo', set({'Program Files\\X'})), + # $ handling + (['f$o.o: c/b'], 'f$o.o', set({'c/b'})), + (['f$$o.o: c/b'], 'f$o.o', set({'c/b'})), + # cycles + (['a: b', 'b: a'], 'a', set({'a', 'b'})), + (['a: b', 'b: a'], 'b', set({'a', 'b'})), + ]: + d = mesonbuild.depfile.DepFile(f) + deps = d.get_all_dependencies(target) + self.assertEqual(deps, expdeps) + @unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release') class DataTests(unittest.TestCase): |