aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-27 10:55:21 -0400
committerNirbheek Chauhan <nirbheek@centricular.com>2021-10-28 11:08:35 +0530
commit9204c03fae80d66a14f48f50eb3861cd0184aaae (patch)
tree686451437a8b5d046378c4501f6b9edd4803f33e
parent2fea562eedfda7029e038500076aefac16d085b3 (diff)
downloadmeson-9204c03fae80d66a14f48f50eb3861cd0184aaae.zip
meson-9204c03fae80d66a14f48f50eb3861cd0184aaae.tar.gz
meson-9204c03fae80d66a14f48f50eb3861cd0184aaae.tar.bz2
test_clang_format: Do not assume meson source is in git
Fixes: #9437
-rw-r--r--unittests/allplatformstests.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index da461e4..57aa7c2 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -2536,6 +2536,14 @@ class AllPlatformTests(BasePlatformTests):
if self.backend is not Backend.ninja:
raise SkipTest(f'Clang-format is for now only supported on Ninja, not {self.backend.name}')
testdir = os.path.join(self.unit_test_dir, '54 clang-format')
+
+ # Ensure that test project is in git even when running meson from tarball.
+ srcdir = os.path.join(self.builddir, 'src')
+ shutil.copytree(testdir, srcdir)
+ _git_init(srcdir)
+ testdir = srcdir
+ self.new_builddir()
+
testfile = os.path.join(testdir, 'prog.c')
badfile = os.path.join(testdir, 'prog_orig_c')
goodfile = os.path.join(testdir, 'prog_expected_c')