YDI_FRAMEWORK_DIR = ../../
CLEAN_OBJS = yaffs_tester emfile-2k-0
-TESTFILES = yaffs_tester.o message_buffer.o error_handler.o
+TESTFILES = yaffs_tester.o message_buffer.o error_handler.o shared.o
all: yaffs_tester
yaffs_test: $(FRAMEWORK_SOURCES) $(YAFFS_TEST_OBJS)
- gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS)
+ gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS) -lpthread
yaffs_tester: $(FRAMEWORK_SOURCES) $(YAFFS_TEST_OBJS)
- gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS)
+ gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS) -lpthread
* error_handler.c contains code for checking yaffs function calls for errors.
*/
#include "error_handler.h"
-
+#include "shared.h"
typedef struct error_codes_template {
int code;
{ 0, NULL }
};
-const char * error_to_str(int err)
+char * error_to_str(int err)
{
- error_entry *e = error_list;
+ error_entry const *e = error_list;
if (err < 0)
err = -err;
while(e->code && e->text){
}
void yaffs_check_for_errors(char output, buffer *message_buffer,char error_message[],char success_message[]){
- char dummy[10];
- unsigned int x=0;
int yaffs_error=-1;
- char error_found=0;
+
if (output==-1)
{
add_to_buffer(message_buffer, "\nerror##########",MESSAGE_LEVEL_ERROR,PRINT);
--- /dev/null
+/*
+ * YAFFS: Yet another FFS. A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2018 Aleph One Ltd.
+ *
+ * Created by Timothy Manning <timothy@yaffs.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * error_handler.c contains code for checking yaffs function calls for errors.
+ */
+#include "shared.h"
+#include "yaffsfs.h"
+
+void quit_program(){
+ yaffs_unmount(YAFFS_MOUNT_DIR);
+ exit(1);
+}
--- /dev/null
+/*
+ * YAFFS: Yet another Flash File System . A NAND-flash specific file system.
+ *
+ * Copyright (C) 2002-2018 Aleph One Ltd.
+ *
+ * Created by Timothy Manning <timothy@yaffs.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 2.1 as
+ * published by the Free Software Foundation.
+ *
+ * Note: Only YAFFS headers are LGPL, YAFFS C code is covered by GPL.
+ */
+
+#ifndef __shared_h__
+#define __shared_h__
+
+#define YAFFS_TEST_DIR "/yflash2/test_dir" /*the path to the directory where all of the testing will take place*/
+#define YAFFS_MOUNT_DIR "/yflash2/" /*the path to the mount point which yaffs will mount*/
+
+void quit_program();
+#endif
#include "yaffs_tester.h"
+#include "shared.h"
buffer message_buffer; /*create message_buffer */
-char yaffs_test_dir[] ="/yaffs2/test_dir"; /*the path to the directory where all of the testing will take place*/
-char yaffs_mount_dir[]="/yaffs2/"; /*the path to the mount point which yaffs will mount*/
-
int main(int argc, char *argv[]){
- init(yaffs_test_dir,yaffs_mount_dir,argc,argv);
- test(yaffs_test_dir);
- yaffs_unmount(yaffs_mount_dir);
+ init(YAFFS_TEST_DIR, YAFFS_MOUNT_DIR, argc, argv);
+ test(YAFFS_TEST_DIR);
+ yaffs_unmount(YAFFS_MOUNT_DIR);
return 0;
}
}
-void quit_program(){
- yaffs_unmount(yaffs_mount_dir);
- exit(1);
-}
+
+
void join_paths(char *path1,char *path2,char *new_path ){
/* printf("strlen path1:%d\n",strlen(path1));
if (P_open_handles_array->number_of_open_handles<MAX_NUMBER_OF_OPENED_HANDLES)
{
generate_random_string(name,MAX_FILE_NAME_SIZE);
- printf("before %d %d %d\n",strlen(yaffs_test_dir),strlen(name),strlen(path));
+ //printf("before %d %d %d\n",strlen(yaffs_test_dir),strlen(name),strlen(path));
join_paths(yaffs_test_dir,name,path);
- printf("after %d %d %d\n",strlen(yaffs_test_dir),strlen(name),strlen(path));
+ //printf("after %d %d %d\n",strlen(yaffs_test_dir),strlen(name),strlen(path));
add_to_buffer(&message_buffer,"trying to open file: ",MESSAGE_LEVEL_BASIC_TASKS,NPRINT);
append_to_buffer(&message_buffer,path,MESSAGE_LEVEL_BASIC_TASKS,PRINT);
if (yaffs_access(path,0)==0){
}
void test(char*yaffs_test_dir){
- struct yaffs_stat stat;
- int output=0;
+
//char name[MAX_FILE_NAME_SIZE+3 ]="apple\0";
//char path[MAX_FILE_NAME_SIZE];
handle_regster open_handles_array;