Get timothy quick tests building cleanly.
authorCharles Manning <cdhmanning@gmail.com>
Fri, 8 Jul 2016 00:43:57 +0000 (12:43 +1200)
committerCharles Manning <cdhmanning@gmail.com>
Fri, 8 Jul 2016 00:43:57 +0000 (12:43 +1200)
Signed-off-by: Charles Manning <cdhmanning@gmail.com>
43 files changed:
direct/test-framework/timothy_tests/quick_tests/Makefile
direct/test-framework/timothy_tests/quick_tests/lib.h
direct/test-framework/timothy_tests/quick_tests/test_yaffs_access_ENOENT2.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_access_ENOTDIR.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_close_NULL.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_dup.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_fchmod.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_fchmod_NULL.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_fdatasync_NULL.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_flush.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_ftruncate_EBADF.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_ftruncate_big_file.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_lseek.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_lseek_big_file.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_lstat.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_open_ENAMETOOLONG.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_open_ENOENT.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_open_NULL.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_read_EINVAL.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_remount_force_off_read_only_off.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_remount_force_on_read_only_off.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_rename.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_rename_EROFS.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_rename_dir_over_dir.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_rename_file_over_file.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_rename_full_dir_over_dir.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_rmdir_EBUSY.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_rmdir_ENOENT.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_stat.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_stat_ELOOP.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_stat_ELOOP_dir.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_stat_ENAMETOOLONG.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_stat_ENOENT.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_stat_ENOENT2.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_stat_ENOTDIR.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_stat_NULL.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_truncate_EISDIR.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_truncate_big_file.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_unlink_EROFS.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_off.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_unmount2_with_handle_open_and_forced_mode_on.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_unmount_ENODEV.c
direct/test-framework/timothy_tests/quick_tests/test_yaffs_unmount_NULL.c

index 431c883..f2bd02f 100644 (file)
@@ -96,10 +96,10 @@ include $(YDI_FRAMEWORK_DIR)/FrameworkRules.mk
 
 
 yaffs_test: $(FRAMEWORK_SOURCES) $(YAFFS_TEST_OBJS)
-       gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS)
+       gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS) -lpthread
 
 
 
 quick_tests: $(FRAMEWORK_SOURCES) $(YAFFS_TEST_OBJS)
-       gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS)
+       gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS) -lpthread
 
index 5e36ca0..61e734f 100644 (file)
 #include "yaffsfs.h"
 
 
-#define YAFFS_MOUNT_POINT "/yaffs2/"
+#define YAFFS_MOUNT_POINT "/yflash2/"
 #define FILE_NAME "test_dir/foo"
 #define FILE_SIZE 10
 
+#define YAFFS_TEST_LONG_VALUE (100000000000000000LL)
+
 #define FILE_MODE (S_IREAD | S_IWRITE)
 #define FILE_SIZE_TRUNCATED 100
 #define FILE_TEXT "file foo "  /* keep space at end of string */
 #define FILE_TEXT_NBYTES 10
-#define TEST_DIR "/yaffs2/test_dir"
-#define DIR_PATH "/yaffs2/test_dir/new_directory"
-#define DIR_PATH2 "/yaffs2/test_dir/new_directory2"
-#define DIR_PATH2_FILE "/yaffs2/test_dir/new_directory2/foo"
-#define SYMLINK_PATH "/yaffs2/test_dir/sym_foo"
+#define TEST_DIR "/yflash2/test_dir"
+#define DIR_PATH "/yflash2/test_dir/new_directory"
+#define DIR_PATH2 "/yflash2/test_dir/new_directory2"
+#define DIR_PATH2_FILE "/yflash2/test_dir/new_directory2/foo"
+#define SYMLINK_PATH "/yflash2/test_dir/sym_foo"
 
-#define HARD_LINK_PATH "/yaffs2/test_dir/hard_link"
+#define HARD_LINK_PATH "/yflash2/test_dir/hard_link"
 
-#define NODE_PATH "/yaffs2/test_dir/node"
+#define NODE_PATH "/yflash2/test_dir/node"
 
-#define RENAME_PATH "/yaffs2/test_dir/foo2"
+#define RENAME_PATH "/yflash2/test_dir/foo2"
 
-#define RENAME_DIR_PATH "/yaffs2/test_dir/dir2"
+#define RENAME_DIR_PATH "/yflash2/test_dir/dir2"
 
-#define ELOOP_PATH "/yaffs2/test_dir/ELOOP"
-#define ELOOP2_PATH "/yaffs2/test_dir/ELOOP2"
+#define ELOOP_PATH "/yflash2/test_dir/ELOOP"
+#define ELOOP2_PATH "/yflash2/test_dir/ELOOP2"
 
-#define RMDIR_PATH "/yaffs2/test_dir/RM_DIR"
+#define RMDIR_PATH "/yflash2/test_dir/RM_DIR"
 
 /* warning do not define anything as FILE because there seems to be a conflict with stdio.h */ 
-#define FILE_PATH "/yaffs2/test_dir/foo"
-#define FILE_PATH2 "/yaffs2/test_dir/foo2"
+#define FILE_PATH "/yflash2/test_dir/foo"
+#define FILE_PATH2 "/yflash2/test_dir/foo2"
 
 void join_paths(char *path1,char *path2,char *new_path );
 void print_message(char *message,char print_level);
index 99e5021..5af067e 100644 (file)
@@ -11,7 +11,7 @@
  * published by the Free Software Foundation.
  */
 
-/* generates a EBADF error by closing a handle twice */
+/* generates a EBADF error by closing a daft handle*/
 
 #include "test_yaffs_close_NULL.h"
 
@@ -23,7 +23,7 @@ int test_yaffs_close_NULL(void)
        int error_code = 0;
 
 
-       output = yaffs_close(NULL);
+       output = yaffs_close(999);
        if (output < 0){
                error_code = yaffs_get_error();
                if (abs(error_code) == EBADF){
index 2a0f63a..bb55862 100644 (file)
@@ -22,7 +22,7 @@ int test_yaffs_dup(void)
                handle2 =yaffs_dup(handle);
                return handle2;
        }
-       
+       return handle;  
 }
 
 
index f96e0d2..4c70413 100644 (file)
@@ -19,7 +19,7 @@ int test_yaffs_fchmod_NULL(void)
        int error = 0;
        int output = 0;
 
-       output = yaffs_fchmod(NULL,S_IREAD|S_IWRITE);
+       output = yaffs_fchmod(999, S_IREAD|S_IWRITE);
 
        if (output<0){
                error=yaffs_get_error();
index 1320ea4..67f711d 100644 (file)
@@ -19,7 +19,7 @@ int test_yaffs_fdatasync_NULL(void)
 {
        int output = 0;
        int error_code = 0;
-       output = yaffs_fdatasync(NULL);
+       output = yaffs_fdatasync(999);
        if (output==-1){
                error_code=yaffs_get_error();
                if (abs(error_code)==EBADF){
index 484447d..7fe8514 100644 (file)
@@ -22,7 +22,7 @@ int test_yaffs_ftruncate_big_file(void)
        handle = test_yaffs_open();
 
        if (handle >= 0){
-               output = yaffs_ftruncate(handle,10000000000000000000000000000000);
+               output = yaffs_ftruncate(handle,YAFFS_TEST_LONG_VALUE);
                if (output < 0){
                        error_code = yaffs_get_error();
                        if (abs(error_code) == EINVAL){ /* yaffs uses the error EINVAL instead of big_file */
index 84ed1c3..750d350 100644 (file)
@@ -35,9 +35,8 @@ int test_yaffs_lseek(void)
                }
        } else {
                print_message("error opening file\n", 2);
-               return -1;
        }
-       
+       return -1;
 }
 
 int test_yaffs_lseek_clean(void)
index a0f6add..37e2814 100644 (file)
@@ -26,7 +26,7 @@ int test_yaffs_lseek_big_file(void)
                return -1;
        }
        
-       output = yaffs_lseek(handle, 100000000000000000000000000000000000000, SEEK_SET);
+       output = yaffs_lseek(handle, YAFFS_TEST_LONG_VALUE, SEEK_SET);
 
        if (output < 0){
                error_code = yaffs_get_error();
index 06d7581..fdd03f7 100644 (file)
@@ -19,7 +19,6 @@ static int handle = -1;
 
 int test_yaffs_open_ENAMETOOLONG(void)
 {
-       int output = 0;
        int x = 0;
        int error_code = 0;
        int file_name_length = 1000000;
index b5a8dd7..9456e08 100644 (file)
@@ -17,7 +17,6 @@ static int handle = -1;
 
 int test_yaffs_open_ENOENT(void)
 {
-       int output = 0;
        int error_code = 0;
        /*printf("path %s\n",path); */
        handle = yaffs_open("/yaffs2/non_existant_file", O_TRUNC| O_RDWR,FILE_MODE );
index d076b59..d898f8c 100644 (file)
@@ -17,7 +17,6 @@ static int handle = -1;
 
 int test_yaffs_open_NULL(void)
 {
-       int output = 0;
        int error_code = 0;
        /*printf("path %s\n",path); */
        handle = yaffs_open(NULL, O_TRUNC| O_RDWR,FILE_MODE );
index 75bf704..e00e868 100644 (file)
@@ -14,6 +14,7 @@
 /*this is no longer relevent because it is not possiable to read -1 bytes*/
 
 #include "test_yaffs_read_EINVAL.h"
+#include "test_yaffs_write.h"
 
 static int handle = -1;
 static char *file_name = NULL;
index d8797ea..c00ef3b 100644 (file)
@@ -16,8 +16,6 @@
 int test_yaffs_remount_force_off_read_only_off(void)
 {
        int output = -1;
-       int error_code =0;
-
 
        output = yaffs_remount(YAFFS_MOUNT_POINT,0,0);
        if (output>=0){
index 276cb7c..d7e11d5 100644 (file)
  */
 
 #include "test_yaffs_remount_force_on_read_only_off.h"
+#include "test_yaffs_open.h"
 
 int test_yaffs_remount_force_on_read_only_off(void)
 {
        int output = -1;
-       int error_code =0;
+
        output=test_yaffs_open();
        if (output<0) {
                print_message("failed to open file\n",2);
index 170081e..a95ae25 100644 (file)
@@ -17,7 +17,6 @@
 int test_yaffs_rename(void)
 {
        int output=0;
-       int error_code =0;
 
        if (0 !=  yaffs_access(FILE_PATH,0)) {
                output = test_yaffs_open();
index 1a46919..e11345d 100644 (file)
@@ -20,7 +20,6 @@ int  test_yaffs_rename_dir_over_dir(void)
 {
 
        int output=0;
-       int error_code =0;
 
        if (yaffs_mkdir(DIR_PATH,O_CREAT | O_RDWR)==-1){
                print_message("failed to create dir\n",1);
index 70652d6..14d76ab 100644 (file)
@@ -20,7 +20,6 @@ int  test_yaffs_rename_file_over_file(void)
 {
 
        int output=0;
-       int error_code =0;
 
        if (yaffs_close(yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE))==-1){
                print_message("failed to create file\n",1);
index 64317ce..9bcd6bc 100644 (file)
@@ -20,7 +20,6 @@ int  test_yaffs_rename_full_dir_over_dir(void)
 {
 
        int output=0;
-       int error_code =0;
 
        if (yaffs_mkdir(DIR_PATH,O_CREAT | O_RDWR)==-1){
                print_message("failed to create dir\n",1);
index 738a56a..482ad16 100644 (file)
@@ -19,7 +19,6 @@ int test_yaffs_rmdir_EBUSY(void)
        int output=0;
        int error_code =0;
 
-
        output = yaffs_rmdir("/yaffs2/");
        if (output<0){ 
                error_code=yaffs_get_error();
@@ -38,9 +37,6 @@ int test_yaffs_rmdir_EBUSY(void)
 
 int test_yaffs_rmdir_EBUSY_clean(void)
 {
-       int output = 0;
-
        return 1;
-
 }
 
index 5b5cd31..5c6005f 100644 (file)
 
 int test_yaffs_stat(void)
 {
-       char message[100];
-       int mode=0;
-       int size=0;
-       message[0]='\0';
        struct yaffs_stat stat;
+
        if (yaffs_close(yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE))==-1){
                print_message("failed to create file \n",1);
                return -1;
index eee9ada..b7600b3 100644 (file)
@@ -18,8 +18,6 @@ int test_yaffs_stat_ELOOP(void)
        int error_code=0;
        struct yaffs_stat stat;
        int output=0;
-       char text[100];
-       text[0] ='\0';
 
        if (set_up_ELOOP()<0){
                print_message("failed to setup symlinks\n",2);
index c4d9f35..2763aee 100644 (file)
@@ -18,8 +18,6 @@ int test_yaffs_stat_ELOOP_dir(void)
        int error_code=0;
        struct yaffs_stat stat;
        int output=0;
-       char text[100];
-       text[0] ='\0';
 
        if (set_up_ELOOP()<0){
                print_message("failed to setup symlinks\n",2);
index 47ac8c6..a0d4598 100644 (file)
@@ -18,8 +18,6 @@ int test_yaffs_stat_ENAMETOOLONG(void)
        int error_code=0;
        struct yaffs_stat stat;
        int output=0;
-       char text[100];
-       text[0] ='\0';
 
        int file_name_length=1000000;
        char file_name[file_name_length];
index 92938e2..21f7958 100644 (file)
@@ -18,8 +18,7 @@ int test_yaffs_stat_ENOENT(void)
        int error_code=0;
        struct yaffs_stat stat;
        int output=0;
-       char text[100];
-       text[0] ='\0';
+
        output=yaffs_stat("/yaffs2/non-existing_file", &stat);
        if (output<0){ 
                error_code=yaffs_get_error();
index 334cc61..c8facb2 100644 (file)
@@ -18,8 +18,7 @@ int test_yaffs_stat_ENOENT2(void)
        int error_code=0;
        struct yaffs_stat stat;
        int output=0;
-       char text[100];
-       text[0] ='\0';
+
        output=yaffs_stat("/non-existing-dir/foo", &stat);;
        if (output<0){ 
                error_code=yaffs_get_error();
index ce22805..5c3ba77 100644 (file)
@@ -18,8 +18,7 @@ int test_yaffs_stat_ENOTDIR(void)
        int error_code=0;
        struct yaffs_stat stat;
        int output=0;
-       char text[100];
-       text[0] ='\0';
+
        if (yaffs_close(yaffs_open(FILE_PATH,O_CREAT | O_RDWR, FILE_MODE))==-1){
                print_message("failed to create file\n",1);
                return -1;
index 3fb07cd..d8e558b 100644 (file)
@@ -18,8 +18,7 @@ int test_yaffs_stat_NULL(void)
        int error_code=0;
        struct yaffs_stat stat;
        int output=0;
-       char text[100];
-       text[0] ='\0';
+
        output=yaffs_stat(NULL, &stat);
        if (output<0){ 
                error_code=yaffs_get_error();
index 4570db1..c92a041 100644 (file)
@@ -19,7 +19,7 @@ int test_yaffs_truncate_big_file(void)
        int error=0;
        int output=0;
 
-       output= yaffs_truncate("/yaffs2/foo",10000000000000000000000000000000000000000000 );
+       output= yaffs_truncate("/yaffs2/foo", YAFFS_TEST_LONG_VALUE);
        if (output<0){
                error=yaffs_get_error();
                if (abs(error)==EINVAL){        /*in yaffs EINVAL is used instead of big_file */
index e18c803..c7f7651 100644 (file)
  */
 
 #include "test_yaffs_unmount2_with_handle_open_and_forced_mode_off.h"
+#include "test_yaffs_open.h"
 
 int test_yaffs_unmount2_with_handle_open_and_forced_mode_off(void)
 {
        int output = -1;
        int error_code =0;
+
        output=test_yaffs_open();
        if (output<0) {
                print_message("failed to open file\n",2);
index 5a20f88..dc85207 100644 (file)
  */
 
 #include "test_yaffs_unmount2_with_handle_open_and_forced_mode_on.h"
+#include "test_yaffs_open.h"
 
 int test_yaffs_unmount2_with_handle_open_and_forced_mode_on(void)
 {
        int output = -1;
-       int error_code =0;
+
        output=test_yaffs_open();
        if (output<0) {
                print_message("failed to open file\n",2);
index 74283a2..7646b46 100644 (file)
@@ -31,8 +31,8 @@ int test_yaffs_unmount_ENODEV(void)
                }
        } else if (output >=0){
                print_message("non existant directory opened.(which is a bad thing)\n",2);
-               return -1;
        }
+       return -1;
 }
 
 int test_yaffs_unmount_ENODEV_clean(void)
index 9c318dd..94ea612 100644 (file)
@@ -33,6 +33,8 @@ int test_yaffs_unmount_NULL(void)
                print_message("NULL path opened.(which is a bad thing)\n",2);
                return -1;
        }
+       
+       return -1;
 }
 
 int test_yaffs_unmount_NULL_clean(void)