From: Timothy Manning Date: Fri, 24 Sep 2021 04:18:35 +0000 (+1200) Subject: Finished the 32 and 64 bit tests. X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=9d9b662225f9b3684bb4ebd3646216f3ab190ed9;hp=5758b7a95a391ac8e4d631fbea9fd409d1130a62 Finished the 32 and 64 bit tests. Signed-off-by: Timothy Manning --- diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/Makefile b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/Makefile index 7c12c25..8842f4b 100644 --- a/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/Makefile +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/Makefile @@ -1,4 +1,4 @@ -# Makefile for 32 bit time test. +# Makefile for 64 bit time test. # # # YAFFS: Yet another Flash File System. A NAND-flash specific file system. @@ -18,22 +18,24 @@ YDI_DIR = ../../../../ YDI_FRAMEWORK_DIR = ../../../ -CLEAN_OBJS = time_32_tests emfile-2k-0 emfile-nand emfile-nand128MB -TESTFILES = time_32_tests.o +MAINFILES = time_32_tests create_32_bit validate_32_bit +MAIN_OBJS = $(addsuffix .o,$(MAINFILES)) -CFLAGS = -DCONFIG_YAFFS_USE_32_BIT_TIME_T -all: time_32_tests +EXTRA_OBJS = shared.o -YAFFS_TEST_OBJS = $(COMMONTESTOBJS) $(TESTFILES) +CLEAN_OBJS = $(MAINFILES) +CFLAGS = -DCONFIG_YAFFS_USE_32_BIT_TIME_T +YAFFS_TEST_OBJS = $(COMMONTESTOBJS) $(EXTRA_OBJS) +ALL_UNSORTED_OBJS += $(YAFFS_TEST_OBJS) $(MAIN_OBJS) -ALL_UNSORTED_OBJS += $(YAFFS_TEST_OBJS) $(FUZZER_OBJS) +all: $(MAINFILES) include $(YDI_FRAMEWORK_DIR)/FrameworkRules.mk phony. test: time_32_tests ./time_32_tests -time_32_tests: $(FRAMEWORK_SOURCES) $(YAFFS_TEST_OBJS) - gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS) -lpthread +$(MAINFILES): $(FRAMEWORK_SOURCES) $(YAFFS_TEST_OBJS) $(MAIN_OBJS) + gcc $(CFLAGS) -o $@ $(YAFFS_TEST_OBJS) $@.o -lpthread -DCONFIG_YAFFS_USE_32_BIT_TIME_T diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/create_32_bit.c b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/create_32_bit.c new file mode 120000 index 0000000..d73d45a --- /dev/null +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/create_32_bit.c @@ -0,0 +1 @@ +../shared/create_file.c \ No newline at end of file diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/shared.c b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/shared.c new file mode 120000 index 0000000..e4b04bb --- /dev/null +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/shared.c @@ -0,0 +1 @@ +../shared/shared.c \ No newline at end of file diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/shared.h b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/shared.h new file mode 120000 index 0000000..ae87f9e --- /dev/null +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/shared.h @@ -0,0 +1 @@ +../shared/shared.h \ No newline at end of file diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/validate_32_bit.c b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/validate_32_bit.c new file mode 120000 index 0000000..c08acf3 --- /dev/null +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/validate_32_bit.c @@ -0,0 +1 @@ +../shared/validate_file.c \ No newline at end of file diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/create_64_bit.c b/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/create_64_bit.c deleted file mode 100644 index 85c29bd..0000000 --- a/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/create_64_bit.c +++ /dev/null @@ -1,10 +0,0 @@ -#include "shared.h" - -int random_seed; -int simulate_power_failure = 0; - -int main(int argc, char *argv[] ){ - int ret = shared_create(argc, argv); - ret = ret && shared_validate_file(argc, argv); - return ret; -} diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/create_64_bit.c b/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/create_64_bit.c new file mode 120000 index 0000000..d73d45a --- /dev/null +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/create_64_bit.c @@ -0,0 +1 @@ +../shared/create_file.c \ No newline at end of file diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/validate_64_bit.c b/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/validate_64_bit.c deleted file mode 100644 index df1fcdb..0000000 --- a/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/validate_64_bit.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "shared.h" - -int random_seed; -int simulate_power_failure = 0; - -int main(int argc, char *argv[] ){ - return shared_validate_file(argc, argv); -} diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/validate_64_bit.c b/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/validate_64_bit.c new file mode 120000 index 0000000..c08acf3 --- /dev/null +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/validate_64_bit.c @@ -0,0 +1 @@ +../shared/validate_file.c \ No newline at end of file diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/shared/create_file.c b/direct/test-framework/unit_tests/64_and_32_bit_time/shared/create_file.c new file mode 100644 index 0000000..85c29bd --- /dev/null +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/shared/create_file.c @@ -0,0 +1,10 @@ +#include "shared.h" + +int random_seed; +int simulate_power_failure = 0; + +int main(int argc, char *argv[] ){ + int ret = shared_create(argc, argv); + ret = ret && shared_validate_file(argc, argv); + return ret; +} diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/shared/shared.c b/direct/test-framework/unit_tests/64_and_32_bit_time/shared/shared.c index 0e0dd8b..31672f2 100644 --- a/direct/test-framework/unit_tests/64_and_32_bit_time/shared/shared.c +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/shared/shared.c @@ -21,7 +21,12 @@ void setup_yaffs() { int shared_create(int argc, char *argv[]){ - + printf("YTIME_T size is %lu bits\n", sizeof(YTIME_T) *8); + #ifdef CONFIG_YAFFS_USE_32_BIT_TIME_T + if (sizeof(YTIME_T)*8 != 32) { + printf("YTIME_T size is incorrect. it is %lu and should be 32\n", sizeof(YTIME_T)); + } + #endif if (argc != 3) { printf("wrong number of arguments\n"); printf("requires $ create file_name time\n"); @@ -45,7 +50,7 @@ int shared_create(int argc, char *argv[]){ assert_exit_yaffs("yaffs_utime", ret); assert_exit_yaffs("yaffs_unmount", yaffs_unmount(YAFFS_MOUNT_POINT)); - return TEST_FAIL; + return 0; } int shared_validate_file(int argc, char *argv[]){ @@ -71,5 +76,5 @@ int shared_validate_file(int argc, char *argv[]){ exit(0); } assert_exit_yaffs("yaffs_unmount", yaffs_unmount(YAFFS_MOUNT_POINT)); - return TEST_FAIL; + return 0; } diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/shared/validate_file.c b/direct/test-framework/unit_tests/64_and_32_bit_time/shared/validate_file.c new file mode 100644 index 0000000..df1fcdb --- /dev/null +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/shared/validate_file.c @@ -0,0 +1,8 @@ +#include "shared.h" + +int random_seed; +int simulate_power_failure = 0; + +int main(int argc, char *argv[] ){ + return shared_validate_file(argc, argv); +} diff --git a/direct/test-framework/unit_tests/64_and_32_bit_time/time_test_runner.sh b/direct/test-framework/unit_tests/64_and_32_bit_time/time_test_runner.sh new file mode 100755 index 0000000..74d1cec --- /dev/null +++ b/direct/test-framework/unit_tests/64_and_32_bit_time/time_test_runner.sh @@ -0,0 +1,14 @@ +make -C 32_bit/ && make -C 64_bit/ && + rm emfile-* && + ./32_bit/create_32_bit /yflash2/foo 100 && + echo created 32 bit file && + ./64_bit/validate_64_bit /yflash2/foo 100 && + echo 32 bit file opened with 64 bit mode correctly + + rm emfile-* && + ./64_bit/create_64_bit /yflash2/foo 100 && + echo created 64 bit file && + ./32_bit/validate_32_bit /yflash2/foo 100 && + echo 64 bit file opened with 32 bit mode correctly && + + echo All tests ran properly