File: 0008-skip-tests-that-depend-on-git-if-not-in-a-repo.patch

package info (click to toggle)
os-autoinst 4.6.1731418769.97d9a7fd-4~bpo12%2B1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-backports
  • size: 37,984 kB
  • sloc: perl: 23,257; cpp: 1,640; sh: 432; python: 232; makefile: 72; xml: 59
file content (28 lines) | stat: -rw-r--r-- 1,228 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
From: Philip Hands <phil@hands.com>
Date: Mon, 15 Jan 2024 11:53:24 +0100
Subject: skip tests that depend on git if not in a repo.

during a standard Debian build, the source is unpacked from a source
package (effectively a tarball) so one is not in a git repo, and cannot
use git grep.
---
 xt/01-style.t | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xt/01-style.t b/xt/01-style.t
index 3afb4b4..c114325 100755
--- a/xt/01-style.t
+++ b/xt/01-style.t
@@ -7,6 +7,12 @@ use Test::Most;
 use FindBin '$Bin';
 chdir "$Bin/..";
 
+if (not -e "$Bin/../.git") {
+    pass("Skipping all tests, not in a git repository");    # uncoverable statement
+    done_testing;    # uncoverable statement
+    exit;    # uncoverable statement
+}
+
 ok system(qq{git grep -I -l 'Copyright \((C)\|(c)\|©\)' ':!COPYING' ':!external/'}) != 0, 'No redundant copyright character';
 ok system(qq{git grep -I -l 'This program is free software.*if not, see <http://www.gnu.org/licenses/' ':!COPYING' ':!external/' ':!xt/01-style.t'}) != 0, 'No verbatim licenses in source files';
 ok system(qq{git grep -I -l '[#/ ]*SPDX-License-Identifier ' ':!COPYING' ':!external/' ':!xt/01-style.t'}) != 0, 'SPDX-License-Identifier correctly terminated';