-# Makefile for 32 bit time test.
+# Makefile for 64 bit time test.
#
#
# YAFFS: Yet another Flash File System. A NAND-flash specific file system.
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
--- /dev/null
+../shared/create_file.c
\ No newline at end of file
--- /dev/null
+../shared/shared.c
\ No newline at end of file
--- /dev/null
+../shared/shared.h
\ No newline at end of file
--- /dev/null
+../shared/validate_file.c
\ No newline at end of file
+++ /dev/null
-#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;
-}
--- /dev/null
+../shared/create_file.c
\ No newline at end of file
+++ /dev/null
-#include "shared.h"
-
-int random_seed;
-int simulate_power_failure = 0;
-
-int main(int argc, char *argv[] ){
- return shared_validate_file(argc, argv);
-}
--- /dev/null
+../shared/validate_file.c
\ No newline at end of file
--- /dev/null
+#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;
+}
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");
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[]){
exit(0);
}
assert_exit_yaffs("yaffs_unmount", yaffs_unmount(YAFFS_MOUNT_POINT));
- return TEST_FAIL;
+ return 0;
}
--- /dev/null
+#include "shared.h"
+
+int random_seed;
+int simulate_power_failure = 0;
+
+int main(int argc, char *argv[] ){
+ return shared_validate_file(argc, argv);
+}
--- /dev/null
+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