All of lore.kernel.org
 help / color / mirror / Atom feed
* + selftests-cachestat-add-tests-for-mmap-refactor-and-enhance-mmap-test-for-cachestat-validation-checkpatch-fixes.patch added to mm-new branch
@ 2025-07-22 22:24 Andrew Morton
  0 siblings, 0 replies; only message in thread
From: Andrew Morton @ 2025-07-22 22:24 UTC (permalink / raw)
  To: mm-commits, suresh.k.chandrappa, shuah, nphamcs, joshua.hahnjy,
	hannes, akpm, akpm


The patch titled
     Subject: selftests-cachestat-add-tests-for-mmap-refactor-and-enhance-mmap-test-for-cachestat-validation-checkpatch-fixes
has been added to the -mm mm-new branch.  Its filename is
     selftests-cachestat-add-tests-for-mmap-refactor-and-enhance-mmap-test-for-cachestat-validation-checkpatch-fixes.patch

This patch will shortly appear at
     https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/selftests-cachestat-add-tests-for-mmap-refactor-and-enhance-mmap-test-for-cachestat-validation-checkpatch-fixes.patch

This patch will later appear in the mm-new branch at
    git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

Note, mm-new is a provisional staging ground for work-in-progress
patches, and acceptance into mm-new is a notification for others take
notice and to finish up reviews.  Please do not hesitate to respond to
review feedback and post updated versions to replace or incrementally
fixup patches in mm-new.

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/process/submit-checklist.rst when testing your code ***

The -mm tree is included into linux-next via the mm-everything
branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
and is updated there every 2-3 working days

------------------------------------------------------
From: Andrew Morton <akpm@linux-foundation.org>
Subject: selftests-cachestat-add-tests-for-mmap-refactor-and-enhance-mmap-test-for-cachestat-validation-checkpatch-fixes
Date: Tue Jul 22 03:21:42 PM PDT 2025

ERROR: "foo* bar" should be "foo *bar"
#41: FILE: tools/testing/selftests/cachestat/test_cachestat.c:209:
+const char* file_type_str(enum file_type type) {

ERROR: open brace '{' following function definitions go on the next line
#41: FILE: tools/testing/selftests/cachestat/test_cachestat.c:209:
+const char* file_type_str(enum file_type type) {

ERROR: switch and case should be at the same indent
#42: FILE: tools/testing/selftests/cachestat/test_cachestat.c:210:
+	switch (type) {
+		case FILE_SHMEM:
[...]
+		case FILE_MMAP:
[...]
+		default:

ERROR: space required after that ',' (ctx:VxV)
#72: FILE: tools/testing/selftests/cachestat/test_cachestat.c:239:
+		ksft_print_msg("Unable to create %s file.\n",file_type_str(type));
 		                                            ^

ERROR: space required after that ',' (ctx:VxV)
#79: FILE: tools/testing/selftests/cachestat/test_cachestat.c:245:
+		ksft_print_msg("Unable to truncate %s file.\n",file_type_str(type));
 		                                              ^

ERROR: switch and case should be at the same indent
#88: FILE: tools/testing/selftests/cachestat/test_cachestat.c:249:
+	switch (type){
+		case FILE_SHMEM:
[...]
+		case FILE_MMAP:
[...]
+		default:

ERROR: space required before the open brace '{'
#88: FILE: tools/testing/selftests/cachestat/test_cachestat.c:249:
+	switch (type){

WARNING: Missing a blank line after declarations
#98: FILE: tools/testing/selftests/cachestat/test_cachestat.c:259:
+			char *map = mmap(NULL, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+			if (map == MAP_FAILED) {

WARNING: braces {} are not necessary for single statement blocks
#103: FILE: tools/testing/selftests/cachestat/test_cachestat.c:264:
+			for (int i = 0; i < filesize; i++) {
+				map[i] = 'A';
+			}

WARNING: break is not useful after a goto
#111: FILE: tools/testing/selftests/cachestat/test_cachestat.c:272:
+			goto close_fd;
+			break;

total: 7 errors, 3 warnings, 108 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

./patches/selftests-cachestat-add-tests-for-mmap-refactor-and-enhance-mmap-test-for-cachestat-validation.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.

Please run checkpatch prior to sending patches

Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: Suresh K C <suresh.k.chandrappa@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 tools/testing/selftests/cachestat/test_cachestat.c |   62 +++++------
 1 file changed, 32 insertions(+), 30 deletions(-)

--- a/tools/testing/selftests/cachestat/test_cachestat.c~selftests-cachestat-add-tests-for-mmap-refactor-and-enhance-mmap-test-for-cachestat-validation-checkpatch-fixes
+++ a/tools/testing/selftests/cachestat/test_cachestat.c
@@ -206,14 +206,15 @@ out1:
 out:
 	return ret;
 }
-const char* file_type_str(enum file_type type) {
+const char *file_type_str(enum file_type type)
+{
 	switch (type) {
-		case FILE_SHMEM:
-			return "shmem";
-		case FILE_MMAP:
-			return "mmap";
-		default:
-			return "unknown";
+	case FILE_SHMEM:
+		return "shmem";
+	case FILE_MMAP:
+		return "mmap";
+	default:
+		return "unknown";
 	}
 }
 
@@ -236,7 +237,8 @@ bool run_cachestat_test(enum file_type t
 		fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0666);
 
 	if (fd < 0) {
-		ksft_print_msg("Unable to create %s file.\n",file_type_str(type));
+		ksft_print_msg("Unable to create %s file.\n",
+				file_type_str(type));
 		ret = false;
 		goto out;
 	}
@@ -246,30 +248,30 @@ bool run_cachestat_test(enum file_type t
 		ret = false;
 		goto close_fd;
 	}
-	switch (type){
-		case FILE_SHMEM:
-			if (!write_exactly(fd, filesize)) {
-				ksft_print_msg("Unable to write to file.\n");
-				ret = false;
-				goto close_fd;
-			}
-			break;
-		case FILE_MMAP:
-			char *map = mmap(NULL, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-			if (map == MAP_FAILED) {
-				ksft_print_msg("mmap failed.\n");
-				ret = false;
-				goto close_fd;
-			}
-			for (int i = 0; i < filesize; i++) {
-				map[i] = 'A';
-			}
-			break;
-		default:
-			ksft_print_msg("Unsupported file type.\n");
+	switch (type) {
+	case FILE_SHMEM:
+		if (!write_exactly(fd, filesize)) {
+			ksft_print_msg("Unable to write to file.\n");
 			ret = false;
 			goto close_fd;
-			break;
+		}
+		break;
+	case FILE_MMAP:
+		char *map = mmap(NULL, filesize, PROT_READ | PROT_WRITE,
+				 MAP_SHARED, fd, 0);
+
+		if (map == MAP_FAILED) {
+			ksft_print_msg("mmap failed.\n");
+			ret = false;
+			goto close_fd;
+		}
+		for (int i = 0; i < filesize; i++)
+			map[i] = 'A';
+		break;
+	default:
+		ksft_print_msg("Unsupported file type.\n");
+		ret = false;
+		goto close_fd;
 	}
 	syscall_ret = syscall(__NR_cachestat, fd, &cs_range, &cs, 0);
 
_

Patches currently in -mm which might be from akpm@linux-foundation.org are

mm-shmem-swap-simplify-swapin-path-and-result-handling-fix.patch
mm-shmem-swap-simplify-swapin-path-and-result-handling-fix-fix.patch
mm-shmem-swap-rework-swap-entry-and-index-calculation-for-large-swapin-fix.patch
selftests-cachestat-add-tests-for-mmap-refactor-and-enhance-mmap-test-for-cachestat-validation-checkpatch-fixes.patch
init-kconfig-restore-config_broken-help-text.patch


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-07-22 22:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 22:24 + selftests-cachestat-add-tests-for-mmap-refactor-and-enhance-mmap-test-for-cachestat-validation-checkpatch-fixes.patch added to mm-new branch Andrew Morton

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.