diff options
author | Matthias Andree <matthias.andree@gmx.de> | 2017-08-29 01:02:36 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2017-08-29 01:05:58 -0400 |
commit | ec3a69bbb0e01f280d8c7dd6559f3df9be9b53e7 (patch) | |
tree | 736a8cca0ffd3e1a885703b300250b359e54abec | |
parent | f61aa76e456567b622cb0b6e5eb33de394600948 (diff) | |
download | e2fsprogs-ec3a69bbb0e01f280d8c7dd6559f3df9be9b53e7.tar.gz |
Search for GNU-compatible dd for self-tests.
This checks for a dd that supports iflag=fullblock oflag=append,
and looks at gdd and dd for now, and warns of failing self-tests
if neither supports these two flags.
Signed-off-by: Matthias Andree <matthias.andree@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rwxr-xr-x | configure | 22 | ||||
-rw-r--r-- | configure.ac | 19 | ||||
-rw-r--r-- | tests/Makefile.in | 1 | ||||
-rw-r--r-- | tests/f_detect_junk/script | 2 | ||||
-rwxr-xr-x | tests/m_offset/script | 12 | ||||
-rw-r--r-- | tests/r_expand_full/script | 2 | ||||
-rw-r--r-- | tests/test_one.in | 2 | ||||
-rw-r--r-- | tests/u_mke2fs_opt_offset/script | 8 |
8 files changed, 56 insertions, 12 deletions
@@ -655,6 +655,7 @@ SIZEOF_LONG_LONG SIZEOF_LONG SIZEOF_INT SIZEOF_SHORT +DD BUILD_CC MAKEINFO STRIP @@ -12381,6 +12382,27 @@ fi done +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a dd(1) program that supports iflag=fullblock" >&5 +$as_echo_n "checking for a dd(1) program that supports iflag=fullblock... " >&6; } +DD= +for i in dd gdd ; do + if "$i" if=/dev/null of=/dev/null count=1 bs=10k 2>/dev/null iflag=fullblock oflag=append ; then + DD=$i + break + fi +done +if test -n "$DD" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DD" >&5 +$as_echo "$DD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found, using dd" >&5 +$as_echo "not found, using dd" >&6; } + DD=dd + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: No GNU-compatible dd(1) program found, expect some self-test failures." >&5 +$as_echo "$as_me: WARNING: No GNU-compatible dd(1) program found, expect some self-test failures." >&2;} +fi + + for ac_header in net/if.h do : ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" " diff --git a/configure.ac b/configure.ac index 4ede01caa..f69a193ef 100644 --- a/configure.ac +++ b/configure.ac @@ -945,6 +945,25 @@ AC_CHECK_HEADERS(m4_flatten([ sys/un.h sys/wait.h ])) +dnl Check where to find a dd(1) that supports iflag=fullblock +dnl and oflag=append +AC_MSG_CHECKING([for a dd(1) program that supports iflag=fullblock]) +DD= +for i in dd gdd ; do + if "$i" if=/dev/null of=/dev/null count=1 bs=10k 2>/dev/null iflag=fullblock oflag=append ; then + DD=$i + break + fi +done +if test -n "$DD" ; then + AC_MSG_RESULT([$DD]) +else + AC_MSG_RESULT([not found, using dd]) + DD=dd + AC_MSG_WARN([No GNU-compatible dd(1) program found, expect some self-test failures.]) +fi +AC_SUBST([DD]) + AC_CHECK_HEADERS(net/if.h,,, [[ #if HAVE_SYS_TYPES_H diff --git a/tests/Makefile.in b/tests/Makefile.in index c130f4abe..9b4c1b880 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -21,6 +21,7 @@ test_one: $(srcdir)/test_one.in Makefile mke2fs.conf @echo "SRCDIR=@srcdir@" >> test_one @echo "DIFF_OPTS=@UNI_DIFF_OPTS@" >> test_one @echo "SIZEOF_TIME_T=@SIZEOF_TIME_T@" >> test_one + @echo "DD=@DD@" >>test_one @cat $(srcdir)/test_one.in >> test_one @chmod +x test_one diff --git a/tests/f_detect_junk/script b/tests/f_detect_junk/script index 2721c7922..429ff00e4 100644 --- a/tests/f_detect_junk/script +++ b/tests/f_detect_junk/script @@ -6,7 +6,7 @@ FSCK_OPT=-fn IMAGE=$test_dir/image.bz2 bzip2 -d < $IMAGE > $TMPFILE -dd if=/dev/zero of=$TMPFILE conv=notrunc oflag=append bs=1024k count=16 > /dev/null 2>&1 +$DD if=/dev/zero of=$TMPFILE conv=notrunc oflag=append bs=1024k count=16 > /dev/null 2>&1 # Run fsck to fix things? if [ -x $DEBUGFS_EXE ]; then diff --git a/tests/m_offset/script b/tests/m_offset/script index e4bc3c453..d49e555e7 100755 --- a/tests/m_offset/script +++ b/tests/m_offset/script @@ -2,18 +2,18 @@ test_description="mke2fs with offset option (-E offset=N)" OUT="$test_name.log" echo "testing mke2fs with -E offset=524288 option (no fssize)" > "$OUT" -yes a | dd of="$TMPFILE" bs=1k count=2048 iflag=fullblock 2>>"$OUT" +yes a | $DD of="$TMPFILE" bs=1k count=2048 iflag=fullblock 2>>"$OUT" $MKE2FS -F -b 1024 -E offset=524288 "$TMPFILE" >> "$OUT" 2>&1 # compute crc of the first 512 1k blocks -crc_first1=`dd if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM` +crc_first1=`$DD if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM` echo "testing mke2fs with -E offset=524288 option (explicit fssize)" >> "$OUT" -yes a | dd of="$TMPFILE" bs=1k count=2048 iflag=fullblock 2>>"$OUT" +yes a | $DD of="$TMPFILE" bs=1k count=2048 iflag=fullblock 2>>"$OUT" $MKE2FS -F -b 1024 -E offset=524288 "$TMPFILE" 1024 >> "$OUT" 2>&1 # compute crc of the first and last 512 1k blocks -crc_first2=`dd if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM` -crc_last2=`dd if="$TMPFILE" bs=1k count=512 skip=1536 2>/dev/null | $CRCSUM` -crc_exp=`yes a | dd bs=1k count=512 2>/dev/null | $CRCSUM` +crc_first2=`$DD if="$TMPFILE" bs=1k count=512 2>/dev/null | $CRCSUM` +crc_last2=`$DD if="$TMPFILE" bs=1k count=512 skip=1536 2>/dev/null | $CRCSUM` +crc_exp=`yes a | $DD bs=1k count=512 2>/dev/null | $CRCSUM` # a warning should be only emitted by the first mke2fs call warning=`grep -c "offset specified without an explicit file system size." \ "$OUT"` diff --git a/tests/r_expand_full/script b/tests/r_expand_full/script index a2c09db36..861a68a70 100644 --- a/tests/r_expand_full/script +++ b/tests/r_expand_full/script @@ -36,7 +36,7 @@ echo Exit status is $status >> $OUT # convert it echo "resize2fs test.img" >> $OUT -dd if=/dev/zero of=$TMPFILE conv=notrunc bs=1 count=1 seek=3221225471 2> /dev/null +$DD if=/dev/zero of=$TMPFILE conv=notrunc bs=1 count=1 seek=3221225471 2> /dev/null $RESIZE2FS -f $TMPFILE 2>&1 >> $OUT 2>&1 status=$? echo Exit status is $status >> $OUT diff --git a/tests/test_one.in b/tests/test_one.in index fb30e5782..634267dd6 100644 --- a/tests/test_one.in +++ b/tests/test_one.in @@ -1,6 +1,8 @@ #!/bin/sh # run a single regression test +export DD + LC_ALL=C export LC_ALL diff --git a/tests/u_mke2fs_opt_offset/script b/tests/u_mke2fs_opt_offset/script index 036b7b4f0..4b34b7a83 100644 --- a/tests/u_mke2fs_opt_offset/script +++ b/tests/u_mke2fs_opt_offset/script @@ -12,10 +12,10 @@ test_e2undo_mke2fs_off() { rm -f "$TDB_FILE" echo "testing e2undo and mke2fs with the -E offset=$OFF option" >> "$OUT" # prepare $TMPFILE - yes a | dd of="$TMPFILE" bs="$OFF" count=1 iflag=fullblock \ + yes a | $DD of="$TMPFILE" bs="$OFF" count=1 iflag=fullblock \ > /dev/null 2>>"$OUT" - yes b | dd bs=1k count=1024 iflag=fullblock >> "$TMPFILE" 2>>"$OUT" - yes c | dd bs=1k count=3 iflag=fullblock >> "$TMPFILE" 2>>"$OUT" + yes b | $DD bs=1k count=1024 iflag=fullblock >> "$TMPFILE" 2>>"$OUT" + yes c | $DD bs=1k count=3 iflag=fullblock >> "$TMPFILE" 2>>"$OUT" crc_exp=`$CRCSUM "$TMPFILE"` $MKE2FS -F -z "$TDB_FILE" -b 1024 -E offset="$OFF" "$TMPFILE" 1024 \ @@ -69,7 +69,7 @@ supplement_test_2048() { # data again (this might be considered as a bug (for now, # this testcase just documents this behavior)) SEEK_BLOCKS=$(((2048 + 1024 * 1024) / 1024)) - yes d | dd of="$TMPFILE" bs=1k count=2 seek="$SEEK_BLOCKS" \ + yes d | $DD of="$TMPFILE" bs=1k count=2 seek="$SEEK_BLOCKS" \ iflag=fullblock > /dev/null 2>>"$OUT" } |