[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] maint: make some shell and perl scripts executable in 'tests
From: |
Bernhard Voelker |
Subject: |
Re: [PATCH] maint: make some shell and perl scripts executable in 'tests/' |
Date: |
Mon, 22 Jul 2013 01:14:21 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 |
On 07/22/2013 12:22 AM, Pádraig Brady wrote:
> How about something like this instead?
>
> find tests/ \( -name '*.sh' -o -name '*.pl' \) \! -perm /111 -print |
> grep . && { echo ...; exit 1; }
Good idea! I knew it was ugly.
Thanks for the review!
2 nits:
a) find ! -perm /111 will find only files with *any* of ugo=x set;
we need ! -perm -111, don't we?
b) we one other file extension (besides .sh and .pl), see tests/cfg.mk,
line 26:
TEST_EXTENSIONS = .sh .pl .xpl
I used that one in the following amendment.
Have a nice day,
Berny
>From 0c452fe97a395a1ecc2cacce3609ea6be366ac8e Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <address@hidden>
Date: Mon, 22 Jul 2013 01:07:52 +0200
Subject: [PATCH] maint: make some shell and perl scripts executable in
'tests/'
Some newer test scripts - partially ones from me - are not executable.
It does not seem to be a problem, but for consistency and to avoid
future problems on unusual platforms or shells change the permissions
by adding the executable bit.
* cfg.mk (sc_tests_executable): Add new syntax-check rule to ensure
that all test scripts are executable.
* tests/df/df-output.sh: Change file mode from 644 to 755.
* tests/du/threshold.sh: Likewise.
* tests/factor/run.sh: Likewise.
* tests/init.sh: Likewise.
* tests/misc/csplit-suppress-matched.pl: Likewise.
* tests/misc/numfmt.pl: Likewise.
* tests/tail-2/retry.sh: Likewise.
---
cfg.mk | 8 ++++++++
tests/df/df-output.sh | 0
tests/du/threshold.sh | 0
tests/factor/run.sh | 0
tests/init.sh | 0
tests/misc/csplit-suppress-matched.pl | 0
tests/misc/numfmt.pl | 0
tests/tail-2/retry.sh | 0
8 files changed, 8 insertions(+)
mode change 100644 => 100755 tests/df/df-output.sh
mode change 100644 => 100755 tests/du/threshold.sh
mode change 100644 => 100755 tests/factor/run.sh
mode change 100644 => 100755 tests/init.sh
mode change 100644 => 100755 tests/misc/csplit-suppress-matched.pl
mode change 100644 => 100755 tests/misc/numfmt.pl
mode change 100644 => 100755 tests/tail-2/retry.sh
diff --git a/cfg.mk b/cfg.mk
index 7b14c07..a4f36ff 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -115,6 +115,14 @@ sc_tests_list_consistency:
| $(EGREP) "$$test_extensions_rx\$$"; \
} | sort | uniq -u | grep . && exit 1; :
+# Ensure that all version-controlled test scripts are executable.
+sc_tests_executable:
+ @test_extensions_rx=`echo $(TEST_EXTENSIONS) \
+ | sed -e "s/ / -o -name */g" -e "s/^/-name */"`; \
+ find tests/ \( $$test_extensions_rx \) \! -perm -111 -print \
+ | sed -e "s/^/$(ME): Please make test executable: /" | grep . \
+ && exit 1; :
+
# Create a list of regular expressions matching the names
# of files included from system.h. Exclude a couple.
.re-list:
diff --git a/tests/df/df-output.sh b/tests/df/df-output.sh
old mode 100644
new mode 100755
diff --git a/tests/du/threshold.sh b/tests/du/threshold.sh
old mode 100644
new mode 100755
diff --git a/tests/factor/run.sh b/tests/factor/run.sh
old mode 100644
new mode 100755
diff --git a/tests/init.sh b/tests/init.sh
old mode 100644
new mode 100755
diff --git a/tests/misc/csplit-suppress-matched.pl
b/tests/misc/csplit-suppress-matched.pl
old mode 100644
new mode 100755
diff --git a/tests/misc/numfmt.pl b/tests/misc/numfmt.pl
old mode 100644
new mode 100755
diff --git a/tests/tail-2/retry.sh b/tests/tail-2/retry.sh
old mode 100644
new mode 100755
--
1.8.3.1