Finished the 32 and 64 bit tests. master
authorTimothy Manning <codedraftsman@gmail.com>
Fri, 24 Sep 2021 04:18:35 +0000 (16:18 +1200)
committerTimothy Manning <codedraftsman@gmail.com>
Fri, 24 Sep 2021 04:18:35 +0000 (16:18 +1200)
Signed-off-by: Timothy Manning <codedraftsman@gmail.com>
direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/Makefile
direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/create_32_bit.c [new symlink]
direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/shared.c [new symlink]
direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/shared.h [new symlink]
direct/test-framework/unit_tests/64_and_32_bit_time/32_bit/validate_32_bit.c [new symlink]
direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/create_64_bit.c [changed from file to symlink]
direct/test-framework/unit_tests/64_and_32_bit_time/64_bit/validate_64_bit.c [changed from file to symlink]
direct/test-framework/unit_tests/64_and_32_bit_time/shared/create_file.c [new file with mode: 0644]
direct/test-framework/unit_tests/64_and_32_bit_time/shared/shared.c
direct/test-framework/unit_tests/64_and_32_bit_time/shared/validate_file.c [new file with mode: 0644]
direct/test-framework/unit_tests/64_and_32_bit_time/time_test_runner.sh [new file with mode: 0755]

index 7c12c25..8842f4b 100644 (file)
@@ -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.
 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 (symlink)
index 0000000..d73d45a
--- /dev/null
@@ -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 (symlink)
index 0000000..e4b04bb
--- /dev/null
@@ -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 (symlink)
index 0000000..ae87f9e
--- /dev/null
@@ -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 (symlink)
index 0000000..c08acf3
--- /dev/null
@@ -0,0 +1 @@
+../shared/validate_file.c
\ No newline at end of file
deleted file mode 100644 (file)
index 85c29bd2acef6699519147122784f02171377bea..0000000000000000000000000000000000000000
+++ /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;
-}
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..d73d45a2a63ccf9aa040bb40c26c33130aa9ae48
--- /dev/null
@@ -0,0 +1 @@
+../shared/create_file.c
\ No newline at end of file
deleted file mode 100644 (file)
index df1fcdb79371d3de1cd6bedaf53e2d9c446e5c3f..0000000000000000000000000000000000000000
+++ /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);
-}
new file mode 120000 (symlink)
index 0000000000000000000000000000000000000000..c08acf3d36af363920cd52c08eea2450797d80c5
--- /dev/null
@@ -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 (file)
index 0000000..85c29bd
--- /dev/null
@@ -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;
+}
index 0e0dd8b..31672f2 100644 (file)
@@ -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 (file)
index 0000000..df1fcdb
--- /dev/null
@@ -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 (executable)
index 0000000..74d1cec
--- /dev/null
@@ -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