yaffs Fixed an error in direct/timothy_tests/quick_tests
[yaffs2.git] / direct / timothy_tests / quick_tests / lib.c
index a9aecf78bcfec571954a46202df59b74cef16454..e29764565337d63412b29e24768985b74c8930d8 100644 (file)
@@ -34,15 +34,57 @@ int get_exit_on_error(void)
 }
 
 
+int EROFS_setup(void)
+{
+       int output= -1;
+       output=yaffs_remount(YAFFS_MOUNT_POINT,1,1);
+       if (output<0){
+               print_message("failed to remount yaffs\n",2);
+               return -1;
+       }
+       return 1;
+}
+
+int EROFS_clean(void)
+{
+       int output=-1;
+       output= yaffs_remount(YAFFS_MOUNT_POINT,1,0);
+       if (output<0){
+               print_message("failed to remount yaffs\n",2);
+               return -1;
+       }
+       return 1;
+}
+
+
 int set_up_ELOOP(void){
        int output1=1;
        int output2=1;
-       if (0!=yaffs_access(ELOOP2)){
-               output1=yaffs_symlink(ELOOP,ELOOP2);
-       }       
-       if (0!=yaffs_access(ELOOP)){
-               output2=yaffs_symlink(ELOOP2,ELOOP);
+       int error =0;
+       
+       output1=yaffs_symlink(ELOOP_PATH,ELOOP2_PATH);
+       if (output1 <0){
+               error=yaffs_get_error();
+               if (abs(error)==EEXIST){
+                       output1= 1;
+               } else {
+                       output1=-1;
+               }
        }
+       
+       output2=yaffs_symlink(ELOOP2_PATH,ELOOP_PATH);
+
+       if (output2 <0){
+               error=yaffs_get_error();
+               if (abs(error)==EEXIST){
+                       output2= 1;
+               } else {
+                       output2=-1;
+               }
+       }
+       
+
+       yaffs_set_error(0);     /*reset the last error to 0 */
        return (output1|output2);
 }