Whamcloud - gitweb
LU-7195 jobstats: Allow setting static content for jobid_var
[fs/lustre-release.git] / lustre / tests / llapi_layout_test.c
index 98a812a..60d3ab8 100644 (file)
@@ -173,7 +173,6 @@ void test1(void)
        llapi_layout_free(layout);
 }
 
-
 #define T2_DESC                "Read test0 file by FD and verify attributes"
 void test2(void)
 {
@@ -219,7 +218,6 @@ void test3(void)
        llapi_layout_free(layout);
 }
 
-
 #define T4FILE                 "t4"
 #define T4_STRIPE_COUNT                2
 #define T4_STRIPE_SIZE         2097152
@@ -302,7 +300,6 @@ void test6(void)
        ASSERTF(layout == NULL && errno == EBADF, "errno = %d", errno);
 }
 
-
 #define T7FILE         "t7"
 #define T7_DESC                "llapi_layout_get_by_path EACCES handling"
 void test7(void)
@@ -345,7 +342,6 @@ void test7(void)
        ASSERTF(rc == 0, "errno = %d", errno);
 }
 
-
 /* llapi_layout_get_by_path() returns default layout for file with no
  * striping attributes. */
 #define T8FILE         "t8"
@@ -388,8 +384,8 @@ void test8(void)
        llapi_layout_free(layout);
 }
 
-/* Setting pattern > 0 returns EOPNOTSUPP in errno. */
-#define T9_DESC                "llapi_layout_pattern_set() EOPNOTSUPP handling"
+/* Verify llapi_layout_patter_set() return values for various inputs. */
+#define T9_DESC                "verify llapi_layout_pattern_set() return values"
 void test9(void)
 {
        struct llapi_layout *layout;
@@ -397,14 +393,28 @@ void test9(void)
 
        layout = llapi_layout_alloc();
        ASSERTF(layout != NULL, "errno = %d\n", errno);
+
        errno = 0;
-       rc = llapi_layout_pattern_set(layout, 1);
+       rc = llapi_layout_pattern_set(layout, LLAPI_LAYOUT_INVALID);
        ASSERTF(rc == -1 && errno == EOPNOTSUPP, "rc = %d, errno = %d", rc,
                errno);
+
+       errno = 0;
+       rc = llapi_layout_pattern_set(NULL, LLAPI_LAYOUT_DEFAULT);
+       ASSERTF(rc == -1 && errno == EINVAL, "rc = %d, errno = %d", rc,
+               errno);
+
+       errno = 0;
+       rc = llapi_layout_pattern_set(layout, LLAPI_LAYOUT_DEFAULT);
+       ASSERTF(rc == 0, "rc = %d, errno = %d", rc, errno);
+
+       errno = 0;
+       rc = llapi_layout_pattern_set(layout, LLAPI_LAYOUT_RAID0);
+       ASSERTF(rc == 0, "rc = %d, errno = %d", rc, errno);
+
        llapi_layout_free(layout);
 }
 
-
 /* Verify stripe_count interfaces return errors as expected */
 #define T10_DESC       "stripe_count error handling"
 void test10(void)
@@ -523,7 +533,7 @@ void test12(void)
 
        /* Pool name too long*/
        errno = 0;
-       rc = llapi_layout_pool_name_set(layout, "0123456789abcdef0");
+       rc = llapi_layout_pool_name_set(layout, "0123456789abcdef");
        ASSERTF(rc == -1 && errno == EINVAL, "rc = %d, errno = %d", rc, errno);
 
        llapi_layout_free(layout);
@@ -824,7 +834,7 @@ void test18(void)
 void test19(void)
 {
        struct llapi_layout *layout;
-       char *name = "0123456789abcdef";
+       char *name = "0123456789abcde";
        char mypool[LOV_MAXPOOLNAME + 1] = { '\0' };
        int rc;
 
@@ -1313,7 +1323,7 @@ int main(int argc, char *argv[])
        int rc = 0;
        int i;
        struct stat s;
-       char fsname[8];
+       char fsname[8 + 1];
 
        llapi_msg_set_level(LLAPI_MSG_OFF);