* [PATCH] selftests/exec: Rename file binfmt_script to binfmt_script.py
@ 2022-02-10 19:28 ` Usama
0 siblings, 0 replies; 3+ messages in thread
From: Muhammad Usama Anjum @ 2022-02-10 19:28 UTC (permalink / raw)
To: Eric Biederman, Kees Cook, Shuah Khan
Cc: Muhammad Usama Anjum, kernel, kernelci, linux-kselftest, linux-kernel
Rename file for readability purpose. Update its usage and references.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
This path was suggested while review of the following patch. Please
apply it after applying that one first:
selftests/exec: Add non-regular to TEST_GEN_PROGS
---
tools/testing/selftests/exec/Makefile | 2 +-
.../exec/{binfmt_script => binfmt_script.py} | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)
rename tools/testing/selftests/exec/{binfmt_script => binfmt_script.py} (90%)
diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
index a89ba6de79870..a0b8688b08369 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -3,7 +3,7 @@ CFLAGS = -Wall
CFLAGS += -Wno-nonnull
CFLAGS += -D_GNU_SOURCE
-TEST_PROGS := binfmt_script
+TEST_PROGS := binfmt_script.py
TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular
TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
# Makefile is a run-time dependency, since it's accessed by the execveat test
diff --git a/tools/testing/selftests/exec/binfmt_script b/tools/testing/selftests/exec/binfmt_script.py
similarity index 90%
rename from tools/testing/selftests/exec/binfmt_script
rename to tools/testing/selftests/exec/binfmt_script.py
index 05f94a741c7aa..6f717fedc97bd 100755
--- a/tools/testing/selftests/exec/binfmt_script
+++ b/tools/testing/selftests/exec/binfmt_script.py
@@ -28,11 +28,11 @@ foreach my $a (@ARGV) {
'''
##
-# test - produce a binfmt_script hashbang line for testing
+# test - produce a binfmt_script.py hashbang line for testing
#
# @size: bytes for bprm->buf line, including hashbang but not newline
# @good: whether this script is expected to execute correctly
-# @hashbang: the special 2 bytes for running binfmt_script
+# @hashbang: the special 2 bytes for running binfmt_script.py
# @leading: any leading whitespace before the executable path
# @root: start of executable pathname
# @target: end of executable pathname
@@ -45,7 +45,7 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
global test_num, tests, NAME_MAX
test_num += 1
if test_num > tests:
- raise ValueError("more binfmt_script tests than expected! (want %d, expected %d)"
+ raise ValueError("more binfmt_script.py tests than expected! (want %d, expected %d)"
% (test_num, tests))
middle = ""
@@ -68,7 +68,7 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
if len(newline) > 0:
buf += 'echo this is not really perl\n'
- script = "binfmt_script-%s" % (name)
+ script = "binfmt_script.py-%s" % (name)
open(script, "w").write(buf)
os.chmod(script, 0o755)
@@ -78,17 +78,17 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
if proc.returncode == 0 and b'Executed interpreter' in stdout:
if good:
- print("ok %d - binfmt_script %s (successful good exec)"
+ print("ok %d - binfmt_script.py %s (successful good exec)"
% (test_num, name))
else:
- print("not ok %d - binfmt_script %s succeeded when it should have failed"
+ print("not ok %d - binfmt_script.py %s succeeded when it should have failed"
% (test_num, name))
else:
if good:
- print("not ok %d - binfmt_script %s failed when it should have succeeded (rc:%d)"
+ print("not ok %d - binfmt_script.py %s failed when it should have succeeded (rc:%d)"
% (test_num, name, proc.returncode))
else:
- print("ok %d - binfmt_script %s (correctly failed bad exec)"
+ print("ok %d - binfmt_script.py %s (correctly failed bad exec)"
% (test_num, name))
# Clean up crazy binaries
@@ -167,5 +167,5 @@ test(name="two-under-leading", size=int(SIZE/2), leading=" ")
test(name="two-under-lead-trunc-arg", size=int(SIZE/2), leading=" ", arg=" ")
if test_num != tests:
- raise ValueError("fewer binfmt_script tests than expected! (ran %d, expected %d"
+ raise ValueError("fewer binfmt_script.py tests than expected! (ran %d, expected %d"
% (test_num, tests))
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] selftests/exec: Rename file binfmt_script to binfmt_script.py
@ 2022-02-10 19:28 ` Usama
0 siblings, 0 replies; 3+ messages in thread
From: Usama @ 2022-02-10 19:28 UTC (permalink / raw)
To: Eric Biederman, Kees Cook, Shuah Khan
Cc: Muhammad Usama Anjum, kernel, kernelci, linux-kselftest, linux-kernel
Rename file for readability purpose. Update its usage and references.
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
This path was suggested while review of the following patch. Please
apply it after applying that one first:
selftests/exec: Add non-regular to TEST_GEN_PROGS
---
tools/testing/selftests/exec/Makefile | 2 +-
.../exec/{binfmt_script => binfmt_script.py} | 18 +++++++++---------
2 files changed, 10 insertions(+), 10 deletions(-)
rename tools/testing/selftests/exec/{binfmt_script => binfmt_script.py} (90%)
diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
index a89ba6de79870..a0b8688b08369 100644
--- a/tools/testing/selftests/exec/Makefile
+++ b/tools/testing/selftests/exec/Makefile
@@ -3,7 +3,7 @@ CFLAGS = -Wall
CFLAGS += -Wno-nonnull
CFLAGS += -D_GNU_SOURCE
-TEST_PROGS := binfmt_script
+TEST_PROGS := binfmt_script.py
TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular
TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
# Makefile is a run-time dependency, since it's accessed by the execveat test
diff --git a/tools/testing/selftests/exec/binfmt_script b/tools/testing/selftests/exec/binfmt_script.py
similarity index 90%
rename from tools/testing/selftests/exec/binfmt_script
rename to tools/testing/selftests/exec/binfmt_script.py
index 05f94a741c7aa..6f717fedc97bd 100755
--- a/tools/testing/selftests/exec/binfmt_script
+++ b/tools/testing/selftests/exec/binfmt_script.py
@@ -28,11 +28,11 @@ foreach my $a (@ARGV) {
'''
##
-# test - produce a binfmt_script hashbang line for testing
+# test - produce a binfmt_script.py hashbang line for testing
#
# @size: bytes for bprm->buf line, including hashbang but not newline
# @good: whether this script is expected to execute correctly
-# @hashbang: the special 2 bytes for running binfmt_script
+# @hashbang: the special 2 bytes for running binfmt_script.py
# @leading: any leading whitespace before the executable path
# @root: start of executable pathname
# @target: end of executable pathname
@@ -45,7 +45,7 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
global test_num, tests, NAME_MAX
test_num += 1
if test_num > tests:
- raise ValueError("more binfmt_script tests than expected! (want %d, expected %d)"
+ raise ValueError("more binfmt_script.py tests than expected! (want %d, expected %d)"
% (test_num, tests))
middle = ""
@@ -68,7 +68,7 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
if len(newline) > 0:
buf += 'echo this is not really perl\n'
- script = "binfmt_script-%s" % (name)
+ script = "binfmt_script.py-%s" % (name)
open(script, "w").write(buf)
os.chmod(script, 0o755)
@@ -78,17 +78,17 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
if proc.returncode == 0 and b'Executed interpreter' in stdout:
if good:
- print("ok %d - binfmt_script %s (successful good exec)"
+ print("ok %d - binfmt_script.py %s (successful good exec)"
% (test_num, name))
else:
- print("not ok %d - binfmt_script %s succeeded when it should have failed"
+ print("not ok %d - binfmt_script.py %s succeeded when it should have failed"
% (test_num, name))
else:
if good:
- print("not ok %d - binfmt_script %s failed when it should have succeeded (rc:%d)"
+ print("not ok %d - binfmt_script.py %s failed when it should have succeeded (rc:%d)"
% (test_num, name, proc.returncode))
else:
- print("ok %d - binfmt_script %s (correctly failed bad exec)"
+ print("ok %d - binfmt_script.py %s (correctly failed bad exec)"
% (test_num, name))
# Clean up crazy binaries
@@ -167,5 +167,5 @@ test(name="two-under-leading", size=int(SIZE/2), leading=" ")
test(name="two-under-lead-trunc-arg", size=int(SIZE/2), leading=" ", arg=" ")
if test_num != tests:
- raise ValueError("fewer binfmt_script tests than expected! (ran %d, expected %d"
+ raise ValueError("fewer binfmt_script.py tests than expected! (ran %d, expected %d"
% (test_num, tests))
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] selftests/exec: Rename file binfmt_script to binfmt_script.py
2022-02-10 19:28 ` Usama
(?)
@ 2022-02-10 21:15 ` Kees Cook
-1 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2022-02-10 21:15 UTC (permalink / raw)
To: Muhammad Usama Anjum
Cc: Eric Biederman, Shuah Khan, kernel, kernelci, linux-kselftest,
linux-kernel
On Fri, Feb 11, 2022 at 12:28:45AM +0500, Muhammad Usama Anjum wrote:
> Rename file for readability purpose. Update its usage and references.
>
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> This path was suggested while review of the following patch. Please
> apply it after applying that one first:
> selftests/exec: Add non-regular to TEST_GEN_PROGS
> ---
> tools/testing/selftests/exec/Makefile | 2 +-
> .../exec/{binfmt_script => binfmt_script.py} | 18 +++++++++---------
> 2 files changed, 10 insertions(+), 10 deletions(-)
> rename tools/testing/selftests/exec/{binfmt_script => binfmt_script.py} (90%)
>
> diff --git a/tools/testing/selftests/exec/Makefile b/tools/testing/selftests/exec/Makefile
> index a89ba6de79870..a0b8688b08369 100644
> --- a/tools/testing/selftests/exec/Makefile
> +++ b/tools/testing/selftests/exec/Makefile
> @@ -3,7 +3,7 @@ CFLAGS = -Wall
> CFLAGS += -Wno-nonnull
> CFLAGS += -D_GNU_SOURCE
>
> -TEST_PROGS := binfmt_script
> +TEST_PROGS := binfmt_script.py
> TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular
> TEST_GEN_FILES := execveat.symlink execveat.denatured script subdir
> # Makefile is a run-time dependency, since it's accessed by the execveat test
> diff --git a/tools/testing/selftests/exec/binfmt_script b/tools/testing/selftests/exec/binfmt_script.py
> similarity index 90%
> rename from tools/testing/selftests/exec/binfmt_script
> rename to tools/testing/selftests/exec/binfmt_script.py
Everything from here up, yes. Thank you! :)
All the rest aren't right: it's talking about the binfmt_script subsystem
of the kernel, rather than the binfmt_script.py test script file itself.
> index 05f94a741c7aa..6f717fedc97bd 100755
> --- a/tools/testing/selftests/exec/binfmt_script
> +++ b/tools/testing/selftests/exec/binfmt_script.py
> @@ -28,11 +28,11 @@ foreach my $a (@ARGV) {
> '''
>
> ##
> -# test - produce a binfmt_script hashbang line for testing
> +# test - produce a binfmt_script.py hashbang line for testing
> #
> # @size: bytes for bprm->buf line, including hashbang but not newline
> # @good: whether this script is expected to execute correctly
> -# @hashbang: the special 2 bytes for running binfmt_script
> +# @hashbang: the special 2 bytes for running binfmt_script.py
> # @leading: any leading whitespace before the executable path
> # @root: start of executable pathname
> # @target: end of executable pathname
> @@ -45,7 +45,7 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
> global test_num, tests, NAME_MAX
> test_num += 1
> if test_num > tests:
> - raise ValueError("more binfmt_script tests than expected! (want %d, expected %d)"
> + raise ValueError("more binfmt_script.py tests than expected! (want %d, expected %d)"
> % (test_num, tests))
>
> middle = ""
> @@ -68,7 +68,7 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
> if len(newline) > 0:
> buf += 'echo this is not really perl\n'
>
> - script = "binfmt_script-%s" % (name)
> + script = "binfmt_script.py-%s" % (name)
> open(script, "w").write(buf)
> os.chmod(script, 0o755)
>
> @@ -78,17 +78,17 @@ def test(name, size, good=True, leading="", root="./", target="/perl",
>
> if proc.returncode == 0 and b'Executed interpreter' in stdout:
> if good:
> - print("ok %d - binfmt_script %s (successful good exec)"
> + print("ok %d - binfmt_script.py %s (successful good exec)"
> % (test_num, name))
> else:
> - print("not ok %d - binfmt_script %s succeeded when it should have failed"
> + print("not ok %d - binfmt_script.py %s succeeded when it should have failed"
> % (test_num, name))
> else:
> if good:
> - print("not ok %d - binfmt_script %s failed when it should have succeeded (rc:%d)"
> + print("not ok %d - binfmt_script.py %s failed when it should have succeeded (rc:%d)"
> % (test_num, name, proc.returncode))
> else:
> - print("ok %d - binfmt_script %s (correctly failed bad exec)"
> + print("ok %d - binfmt_script.py %s (correctly failed bad exec)"
> % (test_num, name))
>
> # Clean up crazy binaries
> @@ -167,5 +167,5 @@ test(name="two-under-leading", size=int(SIZE/2), leading=" ")
> test(name="two-under-lead-trunc-arg", size=int(SIZE/2), leading=" ", arg=" ")
>
> if test_num != tests:
> - raise ValueError("fewer binfmt_script tests than expected! (ran %d, expected %d"
> + raise ValueError("fewer binfmt_script.py tests than expected! (ran %d, expected %d"
> % (test_num, tests))
> --
> 2.30.2
>
--
Kees Cook
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-10 21:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 19:28 [PATCH] selftests/exec: Rename file binfmt_script to binfmt_script.py Muhammad Usama Anjum
2022-02-10 19:28 ` Usama
2022-02-10 21:15 ` Kees Cook
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.