From: Timothy Manning Date: Tue, 29 Jun 2021 02:56:45 +0000 (+1200) Subject: Updated timothy_tests/stress_tester X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=cf14d8b71ffe8d524439e7310a165389bc015dfa Updated timothy_tests/stress_tester Updated the mount point's path. Broke out some commonly used shared functions and defines into a shared file. Signed-off-by: Timothy Manning --- diff --git a/direct/test-framework/timothy_tests/stress_tester/Makefile b/direct/test-framework/timothy_tests/stress_tester/Makefile index b730b72..146c223 100644 --- a/direct/test-framework/timothy_tests/stress_tester/Makefile +++ b/direct/test-framework/timothy_tests/stress_tester/Makefile @@ -19,7 +19,7 @@ YDI_DIR = ../../../ 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 @@ -32,10 +32,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 yaffs_tester: $(FRAMEWORK_SOURCES) $(YAFFS_TEST_OBJS) - gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS) + gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS) -lpthread diff --git a/direct/test-framework/timothy_tests/stress_tester/error_handler.c b/direct/test-framework/timothy_tests/stress_tester/error_handler.c index 9d9ac97..ff22260 100644 --- a/direct/test-framework/timothy_tests/stress_tester/error_handler.c +++ b/direct/test-framework/timothy_tests/stress_tester/error_handler.c @@ -14,7 +14,7 @@ * 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; @@ -42,9 +42,9 @@ const error_entry error_list[] = { { 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){ @@ -56,10 +56,8 @@ const char * error_to_str(int err) } 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); diff --git a/direct/test-framework/timothy_tests/stress_tester/shared.c b/direct/test-framework/timothy_tests/stress_tester/shared.c new file mode 100644 index 0000000..75855d4 --- /dev/null +++ b/direct/test-framework/timothy_tests/stress_tester/shared.c @@ -0,0 +1,22 @@ +/* + * YAFFS: Yet another FFS. A NAND-flash specific file system. + * + * Copyright (C) 2002-2018 Aleph One Ltd. + * + * Created by Timothy Manning + * + * 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); +} diff --git a/direct/test-framework/timothy_tests/stress_tester/shared.h b/direct/test-framework/timothy_tests/stress_tester/shared.h new file mode 100644 index 0000000..6bfd6d0 --- /dev/null +++ b/direct/test-framework/timothy_tests/stress_tester/shared.h @@ -0,0 +1,22 @@ +/* + * YAFFS: Yet another Flash File System . A NAND-flash specific file system. + * + * Copyright (C) 2002-2018 Aleph One Ltd. + * + * Created by Timothy Manning + * + * 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 diff --git a/direct/test-framework/timothy_tests/stress_tester/yaffs_tester.c b/direct/test-framework/timothy_tests/stress_tester/yaffs_tester.c index ff1504d..aabe709 100644 --- a/direct/test-framework/timothy_tests/stress_tester/yaffs_tester.c +++ b/direct/test-framework/timothy_tests/stress_tester/yaffs_tester.c @@ -16,6 +16,7 @@ #include "yaffs_tester.h" +#include "shared.h" @@ -25,16 +26,13 @@ int simulate_power_failure = 0; 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; } @@ -88,10 +86,8 @@ void init(char *yaffs_test_dir,char *yaffs_mount_dir,int argc, char *argv[]){ } -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)); @@ -169,9 +165,9 @@ void open_random_file(char *yaffs_test_dir, handle_regster *P_open_handles_array if (P_open_handles_array->number_of_open_handles