Merge branch 'driver-refactoring' into new-driver-refactoring
[yaffs2.git] / direct / timothy_tests / quick_tests / quick_tests.h
index 05b8503df31f35a31182ee4b707c95454edeac21..99675634fe4bf5d9efee96e6f666de833dad0a7e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * YAFFS: Yet another Flash File System . A NAND-flash specific file system. 
  *
- * Copyright (C) 2002-2010 Aleph One Ltd.
+ * Copyright (C) 2002-2011 Aleph One Ltd.
  *   for Toby Churchill Ltd and Brightstar Engineering
  *
  * Created by Timothy Manning <timothy@yaffs.net>
 #ifndef __quick_tests_h__
 #define __quick_tests_h__
 #include <stdio.h>
+#include <getopt.h>
 
 #include "test_yaffs_mount.h"
 #include "test_yaffs_mount_ENODEV.h"
 #include "test_yaffs_mount_ENAMETOOLONG.h"
 #include "test_yaffs_mount_EBUSY.h"
+#include "test_yaffs_mount_NULL.h"
 
 #include "test_yaffs_unmount.h"
 #include "test_yaffs_unmount_ENODEV.h"
@@ -39,6 +41,7 @@
 #include "test_yaffs_open_ELOOP_dir.h"
 #include "test_yaffs_open_EROFS.h"
 #include "test_yaffs_open_EACCES.h"
+#include "test_yaffs_open_NULL.h"
 
 #include "test_yaffs_close_EBADF.h"
 #include "test_yaffs_close_NULL.h"
@@ -52,6 +55,7 @@
 #include "test_yaffs_unlink_ENOENT2.h"
 #include "test_yaffs_unlink_ELOOP_dir.h"
 #include "test_yaffs_unlink_EROFS.h"
+#include "test_yaffs_unlink_NULL.h"
 
 #include "test_yaffs_ftruncate.h"
 #include "test_yaffs_ftruncate_EBADF.h"
@@ -71,6 +75,7 @@
 #include "test_yaffs_truncate_ELOOP_dir.h"
 #include "test_yaffs_truncate_EROFS.h"
 #include "test_yaffs_truncate_ENAMETOOLONG.h"
+#include "test_yaffs_truncate_NULL.h"
 
 #include "test_yaffs_write.h"
 #include "test_yaffs_write_EBADF.h"
 #include "test_yaffs_stat_ELOOP.h"
 #include "test_yaffs_stat_ELOOP_dir.h"
 #include "test_yaffs_stat_ENAMETOOLONG.h"
+#include "test_yaffs_stat_NULL.h"
 
 #include "test_yaffs_fstat.h"
 #include "test_yaffs_fstat_EBADF.h"
 #include "test_yaffs_mkdir_ELOOP_dir.h"
 #include "test_yaffs_mkdir_EROFS.h"
 #include "test_yaffs_mkdir_ENAMETOOLONG.h"
+#include "test_yaffs_mkdir_NULL.h"
 
 #include "test_yaffs_symlink.h"
 #include "test_yaffs_symlink_ENOTDIR.h"
 #include "test_yaffs_symlink_ELOOP_dir.h"
 #include "test_yaffs_symlink_EROFS.h"
 #include "test_yaffs_symlink_ENAMETOOLONG.h"
+#include "test_yaffs_symlink_NULL.h"
+#include "test_yaffs_symlink_NULL2.h"
 
 #include "test_yaffs_mount2.h"
 #include "test_yaffs_mount2_ENODEV.h"
 #include "test_yaffs_unmount2_EINVAL.h"
 #include "test_yaffs_unmount2_with_handle_open_and_forced_mode_on.h"
 #include "test_yaffs_unmount2_with_handle_open_and_forced_mode_off.h"
+#include "test_yaffs_unmount_NULL.h"
 
 #include "test_yaffs_sync.h"
 #include "test_yaffs_sync_ENODEV.h"
 #include "test_yaffs_sync_EROFS.h"
 #include "test_yaffs_sync_ENAMETOOLONG.h"
+#include "test_yaffs_sync_NULL.h"
 
 #include "test_yaffs_remount_force_off_read_only_off.h"
 #include "test_yaffs_remount_force_on_read_only_off.h"
 #include "test_yaffs_remount_ENODEV.h"
 #include "test_yaffs_remount_EINVAL.h"
 #include "test_yaffs_remount_ENAMETOOLONG.h"
-
+#include "test_yaffs_remount_NULL.h"
 
 #include "test_yaffs_freespace.h"
 #include "test_yaffs_freespace_EINVAL.h"
 #include "test_yaffs_freespace_ENAMETOOLONG.h"
+#include "test_yaffs_freespace_NULL.h"
 
 #include "test_yaffs_totalspace.h"
 #include "test_yaffs_totalspace_EINVAL.h"
 #include "test_yaffs_totalspace_ENAMETOOLONG.h"
+#include "test_yaffs_totalspace_NULL.h"
 
 #include "test_yaffs_inodecount.h"
 #include "test_yaffs_inodecount_EINVAL.h"
 #include "test_yaffs_inodecount_ENAMETOOLONG.h"
+#include "test_yaffs_inodecount_NULL.h"
 
 #include "test_yaffs_link.h"
 #include "test_yaffs_link_ENOENT.h"
 #include "test_yaffs_link_EROFS.h"
 #include "test_yaffs_link_ENAMETOOLONG.h"
 #include "test_yaffs_link_ENAMETOOLONG2.h"
+#include "test_yaffs_link_NULL.h"
+#include "test_yaffs_link_NULL2.h"
 
 #include "test_yaffs_rmdir.h"
 #include "test_yaffs_rmdir_EBUSY.h"
 #include "test_yaffs_rmdir_ELOOP_dir.h"
 #include "test_yaffs_rmdir_EROFS.h"
 #include "test_yaffs_rmdir_ENAMETOOLONG.h"
+#include "test_yaffs_rmdir_ENOTEMPTY.h"
 
 #include "test_yaffs_rename.h"
 #include "test_yaffs_rename_ENOENT.h"
 #include "test_yaffs_rename_EROFS.h"
 #include "test_yaffs_rename_ENAMETOOLONG.h"
 #include "test_yaffs_rename_ENAMETOOLONG2.h"
+#include "test_yaffs_rename_NULL.h"
+#include "test_yaffs_rename_NULL2.h"
 
 #include "test_yaffs_lstat.h"
 #include "test_yaffs_lstat_ENOENT.h"
 #include "test_yaffs_lstat_ENOTDIR.h"
 #include "test_yaffs_lstat_ENAMETOOLONG.h"
+#include "test_yaffs_lstat_NULL.h"
 
 #include "test_yaffs_flush.h"
 #include "test_yaffs_flush_EBADF.h"
 #include "test_yaffs_flush_EROFS.h"
-#include "test_yaffs_flush_NULL.h"
+
+#include "test_yaffs_dup.h"
+#include "test_yaffs_dup_EBADF.h"
 
 #include "yaffsfs.h"
-#include "yaffs_error_converter.h"
 #include "lib.h"
 
 
@@ -253,6 +274,7 @@ test_template test_list[]={
        {test_yaffs_mount_ENODEV,test_yaffs_mount_ENODEV_clean,"test_yaffs_mount_ENODEV"},
        {test_yaffs_mount_ENAMETOOLONG,test_yaffs_mount_ENAMETOOLONG_clean,"test_yaffs_mount_ENAMETOOLONG"},
        {test_yaffs_mount_EBUSY,test_yaffs_mount_EBUSY_clean,"test_yaffs_mount_EBUSY"},
+       {test_yaffs_mount_NULL,test_yaffs_mount_NULL_clean,"test_yaffs_mount_NULL"},
 
        {test_yaffs_unmount,test_yaffs_unmount_clean,"test_yaffs_unmount"},
        {test_yaffs_unmount_ENODEV,test_yaffs_unmount_ENODEV_clean,"test_yaffs_unmount_ENODEV"},
@@ -271,7 +293,9 @@ test_template test_list[]={
        {test_yaffs_open_ELOOP_dir,test_yaffs_open_ELOOP_dir_clean,"test_yaffs_open_ELOOP_dir"},
        {test_yaffs_open_EROFS,test_yaffs_open_EROFS_clean,"test_yaffs_open_EROFS"},
        {test_yaffs_open_EACCES,test_yaffs_open_EACCES_clean,"test_yaffs_open_EACCES"},
-       
+       {test_yaffs_open_NULL,test_yaffs_open_NULL_clean,"test_yaffs_open_NULL"},
+
+
        {test_yaffs_close_EBADF,test_yaffs_close_EBADF_clean,"test_yaffs_close_EBADF"},
        {test_yaffs_close_NULL,test_yaffs_close_NULL_clean,"test_yaffs_close_NULL"},
 
@@ -296,7 +320,7 @@ test_template test_list[]={
        {test_yaffs_unlink_ENOENT2,test_yaffs_unlink_ENOENT2_clean,"test_yaffs_unlink_ENOENT2"},
        {test_yaffs_unlink_ELOOP_dir,test_yaffs_unlink_ELOOP_dir_clean,"test_yaffs_unlink_ELOOP_dir"},
        {test_yaffs_unlink_EROFS,test_yaffs_unlink_EROFS_clean,"test_yaffs_unlink_EROFS"},
-
+       {test_yaffs_unlink_NULL,test_yaffs_unlink_NULL_clean,"test_yaffs_unlink_NULL"},
 
        {test_yaffs_lseek,test_yaffs_lseek_clean,"test_yaffs_lseek"},
        {test_yaffs_lseek_EBADF,test_yaffs_lseek_EBADF_clean,"test_yaffs_lseek_EBADF"},
@@ -305,7 +329,7 @@ test_template test_list[]={
 
        {test_yaffs_write,test_yaffs_write_clean,"test_yaffs_write"},
        {test_yaffs_write_EBADF,test_yaffs_write_EBADF_clean,"test_yaffs_write_EBADF"},
-       {test_yaffs_write_big_file,test_yaffs_write_big_file_clean,"test_yaffs_write_big_file"},
+//     {test_yaffs_write_big_file,test_yaffs_write_big_file_clean,"test_yaffs_write_big_file"},
        {test_yaffs_write_EROFS,test_yaffs_write_EROFS_clean,"test_yaffs_write_EROFS"},
 
        {test_yaffs_read,test_yaffs_read_clean,"test_yaffs_read"},
@@ -317,8 +341,8 @@ test_template test_list[]={
        {test_yaffs_stat_ENOTDIR,test_yaffs_stat_ENOTDIR_clean,"test_yaffs_stat_ENOTDIR"},
        {test_yaffs_stat_ENOENT2,test_yaffs_stat_ENOENT2_clean,"test_yaffs_stat_ENOENT2"},
        {test_yaffs_stat_ELOOP,test_yaffs_stat_ELOOP_clean,"test_yaffs_stat_ELOOP"},
-       {test_yaffs_truncate_ELOOP_dir,test_yaffs_truncate_ELOOP_dir_clean,"test_yaffs_truncate_ELOOP_dir"},
        {test_yaffs_stat_ENAMETOOLONG,test_yaffs_stat_ENAMETOOLONG_clean,"test_yaffs_stat_ENAMETOOLONG"},
+       {test_yaffs_stat_NULL,test_yaffs_stat_NULL_clean,"test_yaffs_stat_NULL"},
 
        {test_yaffs_fstat,test_yaffs_fstat_clean,"test_yaffs_fstat"},
        {test_yaffs_fstat_EBADF,test_yaffs_fstat_EBADF_clean,"test_yaffs_fstat_EBADF"},
@@ -336,8 +360,10 @@ test_template test_list[]={
        {test_yaffs_truncate_ENOENT,test_yaffs_truncate_ENOENT_clean,"test_yaffs_truncate_ENOENT"},
        {test_yaffs_truncate_ENOENT2,test_yaffs_truncate_ENOENT2_clean,"test_yaffs_truncate_ENOENT2"},
        {test_yaffs_truncate_ELOOP,test_yaffs_truncate_ELOOP_clean,"test_yaffs_truncate_ELOOP"},
+       {test_yaffs_truncate_ELOOP_dir,test_yaffs_truncate_ELOOP_dir_clean,"test_yaffs_truncate_ELOOP_dir"},
        {test_yaffs_truncate_EROFS,test_yaffs_truncate_EROFS_clean,"test_yaffs_truncate_EROFS"},
        {test_yaffs_truncate_ENAMETOOLONG,test_yaffs_truncate_ENAMETOOLONG_clean,"test_yaffs_truncate_ENAMETOOLONG"},
+       {test_yaffs_truncate_NULL,test_yaffs_truncate_NULL_clean,"test_yaffs_truncate_NULL"},
 //     {test_yaffs_truncate_big_file,test_yaffs_truncate_big_file_clean,"test_yaffs_truncate_big_file"}, //this test does not work because the large number becomes 0 when the file is compiled.
 
        {test_yaffs_chmod,test_yaffs_chmod_clean,"test_yaffs_chmod"},
@@ -372,6 +398,7 @@ test_template test_list[]={
        {test_yaffs_mkdir_ELOOP_dir,test_yaffs_mkdir_ELOOP_dir_clean,"test_yaffs_mkdir_ELOOP_dir"},
        {test_yaffs_mkdir_EROFS,test_yaffs_mkdir_EROFS_clean,"test_yaffs_mkdir_EROFS"},
        {test_yaffs_mkdir_ENAMETOOLONG,test_yaffs_mkdir_ENAMETOOLONG_clean,"test_yaffs_mkdir_ENAMETOOLONG"},
+       {test_yaffs_mkdir_NULL,test_yaffs_mkdir_NULL_clean,"test_yaffs_mkdir_NULL"},
 
 
        {test_yaffs_symlink,test_yaffs_symlink_clean,"test_yaffs_symlink"},
@@ -382,6 +409,8 @@ test_template test_list[]={
        {test_yaffs_symlink_ELOOP_dir,test_yaffs_symlink_ELOOP_dir_clean,"test_yaffs_symlink_ELOOP_dir"},
        {test_yaffs_symlink_EROFS,test_yaffs_symlink_EROFS_clean,"test_yaffs_symlink_EROFS"},
        {test_yaffs_symlink_ENAMETOOLONG,test_yaffs_symlink_ENAMETOOLONG_clean,"test_yaffs_symlink_ENAMETOOLONG"},
+       {test_yaffs_symlink_NULL,test_yaffs_symlink_NULL_clean,"test_yaffs_symlink_NULL"},
+       {test_yaffs_symlink_NULL2,test_yaffs_symlink_NULL2_clean,"test_yaffs_symlink_NULL2"},
 
        {test_yaffs_mount2,test_yaffs_mount2_clean,"test_yaffs_mount2"},
        {test_yaffs_mount2_ENODEV,test_yaffs_mount2_ENODEV_clean,"test_yaffs_mount2_ENODEV"},
@@ -392,11 +421,13 @@ test_template test_list[]={
        {test_yaffs_unmount2_EINVAL,test_yaffs_unmount2_EINVAL_clean,"test_yaffs_unmount2_EINVAL"},
 {test_yaffs_unmount2_with_handle_open_and_forced_mode_on,test_yaffs_unmount2_with_handle_open_and_forced_mode_on_clean,"test_yaffs_unmount2_with_handle_open_and_forced_mode_on"},
 {test_yaffs_unmount2_with_handle_open_and_forced_mode_off,test_yaffs_unmount2_with_handle_open_and_forced_mode_off_clean,"test_yaffs_unmount2_with_handle_open_and_forced_mode_off"},
+       {test_yaffs_unmount_NULL,test_yaffs_unmount_NULL_clean,"test_yaffs_unmount_NULL"},
 
        {test_yaffs_sync,test_yaffs_sync_clean,"test_yaffs_sync"},
        {test_yaffs_sync_ENODEV,test_yaffs_sync_ENODEV_clean,"test_yaffs_sync_ENODEV"},
        {test_yaffs_sync_EROFS,test_yaffs_sync_EROFS_clean,"test_yaffs_sync_EROFS"},
        {test_yaffs_sync_ENAMETOOLONG,test_yaffs_sync_ENAMETOOLONG_clean,"test_yaffs_sync_ENAMETOOLONG"},
+       {test_yaffs_sync_NULL,test_yaffs_sync_NULL_clean,"test_yaffs_sync_NULL"},
 
 
        {test_yaffs_remount_force_off_read_only_off,test_yaffs_remount_force_off_read_only_off_clean,"test_yaffs_remount_force_off_read_only_off"},
@@ -404,18 +435,22 @@ test_template test_list[]={
        {test_yaffs_remount_ENODEV,test_yaffs_remount_ENODEV_clean,"test_yaffs_remount_ENODEV"},
        {test_yaffs_remount_EINVAL,test_yaffs_remount_EINVAL_clean,"test_yaffs_remount_EINVAL"},
        {test_yaffs_remount_ENAMETOOLONG,test_yaffs_remount_ENAMETOOLONG_clean,"test_yaffs_remount_ENAMETOOLONG"},
+       {test_yaffs_remount_NULL,test_yaffs_remount_NULL_clean,"test_yaffs_remount_NULL"},
 
        {test_yaffs_freespace,test_yaffs_freespace_clean,"test_yaffs_freespace"},
        {test_yaffs_freespace_EINVAL,test_yaffs_freespace_EINVAL_clean,"test_yaffs_freespace_EINVAL"},
        {test_yaffs_freespace_ENAMETOOLONG,test_yaffs_freespace_ENAMETOOLONG_clean,"test_yaffs_freespace_ENAMETOOLONG"},
+       {test_yaffs_freespace_NULL,test_yaffs_freespace_NULL_clean,"test_yaffs_freespace_NULL"},
 
        {test_yaffs_totalspace,test_yaffs_totalspace_clean,"test_yaffs_totalspace"},
        {test_yaffs_totalspace_EINVAL,test_yaffs_totalspace_EINVAL_clean,"test_yaffs_totalspace_EINVAL"},
        {test_yaffs_totalspace_ENAMETOOLONG,test_yaffs_totalspace_ENAMETOOLONG_clean,"test_yaffs_totalspace_ENAMETOOLONG"},
+       {test_yaffs_totalspace_NULL,test_yaffs_totalspace_NULL_clean,"test_yaffs_totalspace_NULL"},
 
        {test_yaffs_inodecount,test_yaffs_inodecount_clean,"test_yaffs_inodecount"},
        {test_yaffs_inodecount_EINVAL,test_yaffs_inodecount_EINVAL_clean,"test_yaffs_inodecount_EINVAL"},
        {test_yaffs_inodecount_ENAMETOOLONG,test_yaffs_inodecount_ENAMETOOLONG_clean,"test_yaffs_inodecount_ENAMETOOLONG"},
+       {test_yaffs_inodecount_NULL,test_yaffs_inodecount_NULL_clean,"test_yaffs_inodecount_NULL"},
 
        {test_yaffs_link,test_yaffs_link_clean,"test_yaffs_link"},
        {test_yaffs_link_ENOENT,test_yaffs_link_ENOENT_clean,"test_yaffs_link_ENOENT"},
@@ -429,6 +464,8 @@ test_template test_list[]={
        {test_yaffs_link_EROFS,test_yaffs_link_EROFS_clean,"test_yaffs_link_EROFS"},
        {test_yaffs_link_ENAMETOOLONG,test_yaffs_link_ENAMETOOLONG_clean,"test_yaffs_link_ENAMETOOLONG"},
        {test_yaffs_link_ENAMETOOLONG2,test_yaffs_link_ENAMETOOLONG2_clean,"test_yaffs_link_ENAMETOOLONG2"},
+       {test_yaffs_link_NULL,test_yaffs_link_NULL_clean,"test_yaffs_link_NULL"},
+       {test_yaffs_link_NULL2,test_yaffs_link_NULL2_clean,"test_yaffs_link_NULL2"},
 
        {test_yaffs_rmdir,test_yaffs_rmdir_clean,"test_yaffs_rmdir"},
        {test_yaffs_rmdir_EBUSY,test_yaffs_rmdir_EBUSY_clean,"test_yaffs_rmdir_EBUSY"},
@@ -438,6 +475,7 @@ test_template test_list[]={
        {test_yaffs_rmdir_ELOOP_dir,test_yaffs_rmdir_ELOOP_dir_clean,"test_yaffs_rmdir_ELOOP_dir"},
        {test_yaffs_rmdir_EROFS,test_yaffs_rmdir_EROFS_clean,"test_yaffs_rmdir_EROFS"},
        {test_yaffs_rmdir_ENAMETOOLONG,test_yaffs_rmdir_ENAMETOOLONG_clean,"test_yaffs_rmdir_ENAMETOOLONG"},
+       {test_yaffs_rmdir_ENOTEMPTY,test_yaffs_rmdir_ENOTEMPTY_clean,"test_yaffs_rmdir_ENOTEMPTY"},
 
        {test_yaffs_stat_ELOOP_dir,test_yaffs_stat_ELOOP_dir_clean,"test_yaffs_stat_ELOOP_dir"},
 
@@ -455,21 +493,28 @@ test_template test_list[]={
        {test_yaffs_rename_EROFS,test_yaffs_rename_EROFS_clean,"test_yaffs_rename_EROFS"},
        {test_yaffs_rename_ENAMETOOLONG,test_yaffs_rename_ENAMETOOLONG_clean,"test_yaffs_rename_ENAMETOOLONG"},
        {test_yaffs_rename_ENAMETOOLONG2,test_yaffs_rename_ENAMETOOLONG2_clean,"test_yaffs_rename_ENAMETOOLONG2"},
+       {test_yaffs_rename_NULL,test_yaffs_rename_NULL_clean,"test_yaffs_rename_NULL"},
+       {test_yaffs_rename_NULL2,test_yaffs_rename_NULL2_clean,"test_yaffs_rename_NULL2"},
 
        {test_yaffs_lstat,test_yaffs_lstat_clean,"test_yaffs_lstat"},
        {test_yaffs_lstat_ENOENT,test_yaffs_lstat_ENOENT_clean,"test_yaffs_lstat_ENOENT"},
        {test_yaffs_lstat_ENOTDIR,test_yaffs_lstat_ENOTDIR_clean,"test_yaffs_lstat_ENOTDIR"},
        {test_yaffs_lstat_ENAMETOOLONG,test_yaffs_lstat_ENAMETOOLONG_clean,"test_yaffs_lstat_ENAMETOOLONG"},
+       {test_yaffs_lstat_NULL,test_yaffs_lstat_NULL_clean,"test_yaffs_lstat_NULL"},
 
        {test_yaffs_flush,test_yaffs_flush_clean,"test_yaffs_flush"},
        {test_yaffs_flush_EBADF,test_yaffs_flush_EBADF_clean,"test_yaffs_flush_EBADF"},
        {test_yaffs_flush_EROFS,test_yaffs_flush_EROFS_clean,"test_yaffs_flush_EROFS"},
-       {test_yaffs_flush_NULL,test_yaffs_flush_NULL_clean,"test_yaffs_flush_NULL"}
 
+       {test_yaffs_dup,test_yaffs_dup_clean,"test_yaffs_dup"},
+       {test_yaffs_dup_EBADF,test_yaffs_dup_EBADF_clean,"test_yaffs_dup_EBADF"},
 
        };
 
+void logical_run_of_tests(void);
 void init_quick_tests(int argc, char *argv[]);
 void quit_quick_tests(int exit_code);
 void get_error(void);
+void run_random_test_loop(void);
+void run_test(int x);
 #endif