All of lore.kernel.org
 help / color / mirror / Atom feed
From: Muhammad Usama Anjum <usama.anjum@collabora.com>
To: Eric Biederman <ebiederm@xmission.com>,
	Kees Cook <keescook@chromium.org>, Shuah Khan <shuah@kernel.org>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
	kernel@collabora.com, kernelci@groups.io,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/exec: Rename file binfmt_script to binfmt_script.py
Date: Fri, 11 Feb 2022 00:28:45 +0500	[thread overview]
Message-ID: <20220210192845.1533204-1-usama.anjum@collabora.com> (raw)

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


WARNING: multiple messages have this Message-ID (diff)
From: "Usama" <usama.anjum@collabora.com>
To: Eric Biederman <ebiederm@xmission.com>,
	Kees Cook <keescook@chromium.org>, Shuah Khan <shuah@kernel.org>
Cc: Muhammad Usama Anjum <usama.anjum@collabora.com>,
	kernel@collabora.com, kernelci@groups.io,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] selftests/exec: Rename file binfmt_script to binfmt_script.py
Date: Fri, 11 Feb 2022 00:28:45 +0500	[thread overview]
Message-ID: <20220210192845.1533204-1-usama.anjum@collabora.com> (raw)

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


             reply	other threads:[~2022-02-10 19:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-10 19:28 Muhammad Usama Anjum [this message]
2022-02-10 19:28 ` [PATCH] selftests/exec: Rename file binfmt_script to binfmt_script.py Usama
2022-02-10 21:15 ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220210192845.1533204-1-usama.anjum@collabora.com \
    --to=usama.anjum@collabora.com \
    --cc=ebiederm@xmission.com \
    --cc=keescook@chromium.org \
    --cc=kernel@collabora.com \
    --cc=kernelci@groups.io \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.