]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
tests: fix f_pre_1970_date_encoding on systems with a 32-bit time_t
authorTheodore Ts'o <tytso@mit.edu>
Sun, 29 May 2016 05:07:40 +0000 (01:07 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Sun, 29 May 2016 05:07:40 +0000 (01:07 -0400)
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
configure
configure.ac
tests/Makefile.in
tests/f_pre_1970_date_encoding/script

index 3759c9c9dda3c27ebaddffb860b69522d57048d8..8f6d6cb9cc1f6e3d1cd99a24cf7f654b43403d47 100755 (executable)
--- a/configure
+++ b/configure
@@ -650,6 +650,7 @@ FUSE_CMT
 FUSE_LIB
 MAGIC_LIB
 SOCKET_LIB
+SIZEOF_TIME_T
 SIZEOF_OFF_T
 SIZEOF_LONG_LONG
 SIZEOF_LONG
@@ -12593,11 +12594,46 @@ cat >>confdefs.h <<_ACEOF
 _ACEOF
 
 
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of time_t" >&5
+$as_echo_n "checking size of time_t... " >&6; }
+if ${ac_cv_sizeof_time_t+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (time_t))" "ac_cv_sizeof_time_t"        "$ac_includes_default"; then :
+
+else
+  if test "$ac_cv_type_time_t" = yes; then
+     { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "cannot compute sizeof (time_t)
+See \`config.log' for more details" "$LINENO" 5; }
+   else
+     ac_cv_sizeof_time_t=0
+   fi
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_time_t" >&5
+$as_echo "$ac_cv_sizeof_time_t" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_TIME_T $ac_cv_sizeof_time_t
+_ACEOF
+
+
 SIZEOF_SHORT=$ac_cv_sizeof_short
 SIZEOF_INT=$ac_cv_sizeof_int
 SIZEOF_LONG=$ac_cv_sizeof_long
 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
 SIZEOF_OFF_T=$ac_cv_sizeof_off_t
+SIZEOF_TIME_T=$ac_cv_sizeof_time_t
+
 
 
 
index e8e0d68a94b29eeb0ea55204a5289b46d0dfba88..b8e2d4ac7433c6080d11921e20417321d64bdedc 100644 (file)
@@ -971,16 +971,19 @@ AC_CHECK_SIZEOF(int)
 AC_CHECK_SIZEOF(long)
 AC_CHECK_SIZEOF(long long)
 AC_CHECK_SIZEOF(off_t)
+AC_CHECK_SIZEOF(time_t)
 SIZEOF_SHORT=$ac_cv_sizeof_short
 SIZEOF_INT=$ac_cv_sizeof_int
 SIZEOF_LONG=$ac_cv_sizeof_long
 SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long
 SIZEOF_OFF_T=$ac_cv_sizeof_off_t
+SIZEOF_TIME_T=$ac_cv_sizeof_time_t
 AC_SUBST(SIZEOF_SHORT)
 AC_SUBST(SIZEOF_INT)
 AC_SUBST(SIZEOF_LONG)
 AC_SUBST(SIZEOF_LONG_LONG)
 AC_SUBST(SIZEOF_OFF_T)
+AC_SUBST(SIZEOF_TIME_T)
 AC_C_BIGENDIAN
 if test $cross_compiling = no; then
   BUILD_CC="$BUILD_CC" CPP="$CPP" /bin/sh $ac_aux_dir/parse-types.sh
index 9a7d3ff836bcae35da6dd9a1805796ac5fec873b..c130f4abe93cab7ae16dd28880c8b2c200659529 100644 (file)
@@ -20,6 +20,7 @@ test_one: $(srcdir)/test_one.in Makefile mke2fs.conf
        @echo "QUOTA=y" >> test_one
        @echo "SRCDIR=@srcdir@" >> test_one
        @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_one
+       @echo "SIZEOF_TIME_T=@SIZEOF_TIME_T@" >> test_one
        @cat $(srcdir)/test_one.in >> test_one
        @chmod +x test_one
 
index e6d7bbd636f42fa541cd1ce21f03469d5ca1be75..06ff98aaa1016dd13e48002d964198380456d465 100644 (file)
@@ -68,17 +68,29 @@ get_file_xtime_and_extra year-1979
 get_file_xtime_and_extra year-2039
 get_file_xtime_and_extra year-2139
 
-# now we need to check that after the year 2242, e2fsck does not
-# modify dates with extra_xtime=3
+if test $SIZEOF_TIME_T -gt 4
+then
+  # now we need to check that after the year 2242, e2fsck does not
+  # modify dates with extra_xtime=3
 
-# restore the unrepaired filesystem
-mv $TMPFILE.sav $TMPFILE
+  # restore the unrepaired filesystem
+  mv $TMPFILE.sav $TMPFILE
 
-#retry the repair
-E2FSCK_TIME=9270393539 $FSCK $FSCK_OPT $TMPFILE >> $OUT 2>&1
+  #retry the repair
+  E2FSCK_TIME=9270393539 $FSCK $FSCK_OPT $TMPFILE >> $OUT 2>&1
 
-# check that the 1909 file is unaltered (i.e. it has a post-2378 date)
-get_file_xtime_and_extra year-1909
+  # check that the 1909 file is unaltered (i.e. it has a post-2378 date)
+  get_file_xtime_and_extra year-1909
+else
+  rm -f TMPFILE.sav
+cat << EOF >> $TIMESTAMPS
+times for year-1909 =
+ ctime: 0x8e475440:00000003
+ atime: 0x8e475440:00000003
+ mtime: 0x8e475440:00000003
+crtime: 0x8e475440:00000003
+EOF
+fi
 
 cmp -s $TIMESTAMPS $EXP
 status=$?