Changeset 8722
- Timestamp:
- 02/02/11 18:00:11 (2 years ago)
- Location:
- branches/windows-client/src/client/windows/client-test
- Files:
-
- 3 modified
-
client-test.c (modified) (2 diffs)
-
create.c (modified) (3 diffs)
-
test-support.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/windows-client/src/client/windows/client-test/client-test.c
r8721 r8722 17 17 18 18 /* test prototypes */ 19 extern int test_test(op_options *options, int fatal); 19 /* extern int test_test(op_options *options, int fatal); */ 20 extern int create_dir(op_options *options, int fatal); 21 extern int create_subdir(op_options *options, int fatal); 20 22 21 23 typedef struct _list_node … … 34 36 test_operation op_table[] = 35 37 { 36 {"test-test", test_test, FALSE}, 38 /*{"test-test", test_test, FALSE}, */ 39 {"create-dir", create_dir, TRUE}, 40 {"create-subdir", create_subdir, TRUE}, 37 41 {NULL, NULL, 0} 38 42 }; -
branches/windows-client/src/client/windows/client-test/create.c
r8721 r8722 14 14 } 15 15 16 char randchar() 17 { 18 return rand() % 26 + 'a'; 19 } 20 16 21 int create_dir(op_options *options, int fatal) 17 22 { … … 24 29 code = errno; 25 30 26 report_result(options, "create-dir", RESULT_SUCCESS, 0, OPER_EQUAL, errno);31 report_result(options, "create-dir", RESULT_SUCCESS, 0, OPER_EQUAL, code); 27 32 28 33 create_dir_cleanup(dir); … … 40 45 int create_subdir(op_options *options, int fatal) 41 46 { 42 int rem_size = MAX_SIZE; 47 int rem_size = MAX_SIZE, dir_size, i, 48 code = 0; 49 char path[MAX_SIZE*2], dir[9]; 43 50 44 rem_size -= strlen(options->root_dir); 45 46 while (rem_size > 0) 51 /* copy root into path */ 52 strcpy(path, options->root_dir); 53 /* rem_size -= strlen(options->root_dir); */ 54 /* add backslash if necessary */ 55 if (strlen(options->root_dir) && 56 options->root_dir[strlen(options->root_dir)-1] != '\\') 47 57 { 48 49 58 strcat(path, "\\"); 59 /* rem_size--; */ 50 60 } 51 61 52 62 /* note--root dir is not included in the path size */ 63 64 while (rem_size > 0 && code == 0) 65 { 66 /* generate subdir */ 67 dir_size = rem_size > 8 ? 8 : rem_size; 68 for (i = 0; i < dir_size-1; i++) 69 dir[i] = randchar(); 70 dir[dir_size-1] = '\\'; 71 dir[dir_size] = '\0'; 72 73 /* append the path */ 74 strcat(path, dir); 75 76 /* create the sub-directory */ 77 _mkdir(path); 78 code = errno; 79 80 rem_size -= dir_size; 81 } 82 83 report_result(options, "create-subdir", RESULT_SUCCESS, 0, OPER_EQUAL, code); 84 85 if (code != 0 && fatal) 86 return CODE_FATAL; 87 88 return 0; 53 89 } -
branches/windows-client/src/client/windows/client-test/test-support.c
r8721 r8722 132 132 133 133 /* print to buffer */ 134 ret = _snprintf(line, line_size, "%s %s %d % 2s %d %s",134 ret = _snprintf(line, line_size, "%s %s %d %s %d %s", 135 135 test_name, 136 136 (expected_result == RESULT_SUCCESS) ? "EXPECT_SUCCESS" : "EXPECT_FAILURE",
