Patchwork [v2] tests: add test-check-execute.t

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 30, 2015, 5:24 a.m.
Message ID <63d09cd37b59b153f832.1451453099@waste.org>
Download mbox | patch
Permalink /patch/12415/
State Accepted
Headers show

Comments

timeless@mozdev.org - Dec. 30, 2015, 5:24 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1450782356 0
#      Tue Dec 22 11:05:56 2015 +0000
# Node ID 63d09cd37b59b153f832992a5b26c7848e108f6b
# Parent  23541bdd1610c08af247f9c8719045cf247ce541
tests: add test-check-execute.t

Try to prevent people from adding files with incorrect execute bits
Yuya Nishihara - Dec. 30, 2015, 11:30 a.m.
On Tue, 29 Dec 2015 23:24:59 -0600, timeless wrote:
> # HG changeset patch
> # User timeless <timeless@mozdev.org>
> # Date 1450782356 0
> #      Tue Dec 22 11:05:56 2015 +0000
> # Node ID 63d09cd37b59b153f832992a5b26c7848e108f6b
> # Parent  23541bdd1610c08af247f9c8719045cf247ce541
> tests: add test-check-execute.t
> 
> Try to prevent people from adding files with incorrect execute bits

Thanks, pushed this version to the clowncopter.

Patch

diff --git a/tests/test-check-execute.t b/tests/test-check-execute.t
new file mode 100644
--- /dev/null
+++ b/tests/test-check-execute.t
@@ -0,0 +1,23 @@ 
+#require test-repo execbit
+
+  $ cd "`dirname "$TESTDIR"`"
+
+look for python scripts without the execute bit
+
+  $ hg files 'set:**.py and not exec() and grep(r"^#!.*?python")'
+  [1]
+
+look for python scripts with execute bit but not shbang
+
+  $ hg files 'set:**.py and exec() and not grep(r"^#!.*?python")'
+  [1]
+
+look for shell scripts with execute bit but not shbang
+
+  $ hg files 'set:**.sh and exec() and not grep(r"^#!.*(ba)?sh")'
+  [1]
+
+look for non scripts with no shbang
+
+  $ hg files 'set:exec() and not **.sh and not **.py and not grep(r"^#!")'
+  [1]