X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=direct%2Ftest-framework%2Fbasic-tests%2Fdtest.c;h=bafd6f82ef132d4dbd0c348f1e83b2fb22631b59;hb=27f46b587a0e210a0da59e4064812f7c1fe5d8c6;hp=dbd194fba236872b47ce1b5571f87521f71d37e6;hpb=9545c19fb2de4e3578eb63329f99754dd5041b55;p=yaffs2.git diff --git a/direct/test-framework/basic-tests/dtest.c b/direct/test-framework/basic-tests/dtest.c index dbd194f..bafd6f8 100644 --- a/direct/test-framework/basic-tests/dtest.c +++ b/direct/test-framework/basic-tests/dtest.c @@ -2743,8 +2743,33 @@ void size_utime_test(const char *mountpt) //yaffs_stat already uses 64 bits for both wince and unix times. //To see if we are using 32 or 64 bit time, save a large number into the time and //see if it overflows. + long bitsInTime = 8*sizeof(st.yst_ctime); + printf("the times are %ld bits long\n", bitsInTime); + + //two testcases + if (bitsInTime == 64) { + //no need to test the overflow. Just check that it can be retrieved intact. + + //use u64 variables in case utb truncates the values to 32 bit time by accident. + u64 start = 0xfffff; + u64 end = 0xffffff; + + utb.actime = start; + utb.modtime = end; + + result = yaffs_futime(h,&utb); + yaffs_fstat(h,&st); + if (st.yst_atime == start && st.yst_mtime == end) { + printf("successfully stored and retrevied a 64 bit number for atime and modtime\n"); + } else { + printf("failed to store and retrieve a 64 bit number for atime and modtime\n"); + + } + } else { + //it is a 32 bit number. Check to see that it overflowed. + + } - printf("the times are %ld bits long\n", 8*sizeof(st.yst_ctime)); //here are the last access and modification times. utb.actime = 1000;