]> www.infradead.org Git - mtd-utils.git/commitdiff
fs-tests: fix max file name length in integrity test
authorAdrian Hunter <ext-adrian.hunter@nokia.com>
Tue, 12 Aug 2008 11:08:11 +0000 (14:08 +0300)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 13 Aug 2008 15:43:36 +0000 (18:43 +0300)
Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
tests/fs-tests/integrity/integck.c
tests/fs-tests/lib/tests.c
tests/fs-tests/lib/tests.h

index be93d3e0cc2881edd544dfc20eb83c5148c2b21f..8cdbfb427e3fe132ccaea38ba94259a08f99b47e 100644 (file)
@@ -1388,7 +1388,7 @@ static char *make_name(struct dir_info *dir)
        do {
                found = 0;
                if (tests_random_no(5) == 1) {
-                       int i, n = tests_random_no(255) + 1;
+                       int i, n = tests_random_no(tests_max_fname_len) + 1;
 
                        CHECK(n > 0 && n < 256);
                        for (i = 0; i < n; i++)
index 97e5207c04eaf09880a848392e9355638cb5c6e2..570672f706beee19416976d925e31c4f4e09570f 100644 (file)
@@ -83,6 +83,9 @@ int tests_hole_flag = 0;
 /* Whether it is ok to test on the root file system */
 static int rootok = 0;
 
+/* Maximum file name length of test file system (from statfs) */
+long tests_max_fname_len = 255;
+
 /* Function invoked by the CHECK macro */
 void tests_test(int test,const char *msg,const char *file,unsigned line)
 {
@@ -370,6 +373,7 @@ void tests_check_test_file_system(void)
                        "TEST_FILE_SYSTEM_MOUNT_DIR\n");
                CHECK(0);
        }
+       tests_max_fname_len = fs_info.f_namelen;
        if (strcmp(tests_file_system_type, "jffs2") == 0 &&
                        fs_info.f_type != JFFS2_SUPER_MAGIC) {
                fprintf(stderr, "File system type is not jffs2\n");
index 04c834d83e8034f48b43767bc7595b4fe886fd12..01849bccacbf1482deec3e01e1b8c1cdf3ed4060 100644 (file)
@@ -202,4 +202,7 @@ extern int tests_hole_flag;
 /* Program name from argv[0] */
 extern char *program_name;
 
+/* Maximum file name length of test file system (from statfs) */
+extern long tests_max_fname_len;
+
 #endif