Add test and release notes.

pull/1669/head
Jussi Pakkanen 8 years ago
parent 6e59d84534
commit 8068fc0d1d
  1. 15
      docs/markdown/Release-notes-for-0.41.0.md
  2. 2
      mesonbuild/scripts/dist.py
  3. 42
      run_unittests.py

@ -38,3 +38,18 @@ pkg.generate(libraries : libs,
description : 'A simple demo library.',
variables : ['datadir=${prefix}/data'])
```
## A target for creating tarballs
Creating distribution tarballs is simple:
ninja dist
This will create a `.tar.xz` archive of the source code including
submodules without any revision control information. This command also
verifies that the resulting archive can be built, tested and
installed. This is roughly equivalent to the `distcheck` target in
other build systems. Currently this only works for projects using Git
and only with the Ninja backend.

@ -98,7 +98,7 @@ def check_dist(packagename, meson_command):
tf = tarfile.open(packagename)
tf.extractall(unpackdir)
srcdir = glob(os.path.join(unpackdir, '*'))[0]
if subprocess.call(meson_command + [srcdir, builddir]) != 0:
if subprocess.call(meson_command + ['--backend=ninja', srcdir, builddir]) != 0:
print('Running Meson on distribution package failed')
return 1
if subprocess.call([ninja_bin], cwd=builddir) != 0:

@ -331,6 +331,7 @@ class BasePlatformTests(unittest.TestCase):
self.prefix = '/usr'
self.libdir = os.path.join(self.prefix, 'lib')
self.installdir = os.path.join(self.builddir, 'install')
self.distdir = os.path.join(self.builddir, 'meson-dist')
# Get the backend
# FIXME: Extract this from argv?
self.backend = getattr(Backend, os.environ.get('MESON_UNIT_TEST_BACKEND', 'ninja'))
@ -1065,6 +1066,47 @@ class AllPlatformTests(BasePlatformTests):
self.build()
self.run_tests()
def test_dist(self):
if not shutil.which('git'):
raise unittest.SkipTest('Git not found')
try:
self.dist_impl()
except PermissionError:
# When run under Windows CI, something (virus scanner?)
# holds on to the git files so cleaning up the dir
# fails sometimes.
pass
def dist_impl(self):
# Create this on the fly because having rogue .git directories inside
# the source tree leads to all kinds of trouble.
with tempfile.TemporaryDirectory() as project_dir:
with open(os.path.join(project_dir, 'meson.build'), 'w') as ofile:
ofile.write('''project('disttest', 'c', version : '1.4.3')
e = executable('distexe', 'distexe.c')
test('dist test', e)
''')
with open(os.path.join(project_dir, 'distexe.c'), 'w') as ofile:
ofile.write('''#include<stdio.h>
int main(int argc, char **argv) {
printf("I am a distribution test.\\n");
return 0;
}
''')
subprocess.check_call(['git', 'init'], cwd=project_dir)
subprocess.check_call(['git', 'config',
'user.name', 'Author Person'], cwd=project_dir)
subprocess.check_call(['git', 'config',
'user.email', 'teh_coderz@example.com'], cwd=project_dir)
subprocess.check_call(['git', 'add', 'meson.build', 'distexe.c'], cwd=project_dir)
subprocess.check_call(['git', 'commit', '-a', '-m', 'I am a project'], cwd=project_dir)
self.init(project_dir)
self.build('dist')
distfile = os.path.join(self.distdir, 'disttest-1.4.3.tar.xz')
checksumfile = distfile + '.sha256sum'
self.assertTrue(os.path.exists(distfile))
self.assertTrue(os.path.exists(checksumfile))
class WindowsTests(BasePlatformTests):
'''

Loading…
Cancel
Save