From 464df1d5e5ab1322e2dd0a7796939fff1aeefa9a Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 17:49:25 +0200 Subject: Adding upstream version 1.47.0. Signed-off-by: Daniel Baumann --- tests/m_error_behavior/expect | 24 +++++++++ tests/m_error_behavior/script | 110 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 134 insertions(+) create mode 100644 tests/m_error_behavior/expect create mode 100755 tests/m_error_behavior/script (limited to 'tests/m_error_behavior') diff --git a/tests/m_error_behavior/expect b/tests/m_error_behavior/expect new file mode 100644 index 0000000..78514bd --- /dev/null +++ b/tests/m_error_behavior/expect @@ -0,0 +1,24 @@ +error default +Errors behavior: Continue +error continue +Errors behavior: Continue +error panic +Errors behavior: Panic +error remount-ro +Errors behavior: Remount read-only +error garbage +error default profile continue +Errors behavior: Continue +error default profile panic +Errors behavior: Panic +error default profile remount-ro +Errors behavior: Remount read-only +error default profile broken +error fs_types profile continue +Errors behavior: Continue +error fs_types profile panic +Errors behavior: Panic +error fs_types profile remount-ro +Errors behavior: Remount read-only +error fs_types profile remount-ro +Errors behavior: Panic diff --git a/tests/m_error_behavior/script b/tests/m_error_behavior/script new file mode 100755 index 0000000..5f999f3 --- /dev/null +++ b/tests/m_error_behavior/script @@ -0,0 +1,110 @@ +test_description="mke2fs with error behavior" + +conf=$TMPFILE.conf +write_defaults_conf() +{ + errors="$1" + cat > $conf << ENDL +[defaults] + errors = $errors +ENDL +} + +write_section_conf() +{ + errors="$1" + cat > $conf << ENDL +[defaults] + errors = broken + +[fs_types] + test_suite = { + errors = $errors + } +ENDL +} + +trap "rm -f $TMPFILE $TMPFILE.conf" EXIT INT QUIT +dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 +OUT=$test_name.log +EXP=$test_dir/expect +rm -f $OUT + +# Test command line option +echo "error default" >> $OUT +$MKE2FS -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +echo "error continue" >> $OUT +$MKE2FS -e continue -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +echo "error panic" >> $OUT +$MKE2FS -e panic -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +echo "error remount-ro" >> $OUT +$MKE2FS -e remount-ro -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +echo "error garbage" >> $OUT +dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 +$MKE2FS -e broken -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +# Test errors= in default +echo "error default profile continue" >> $OUT +write_defaults_conf continue +MKE2FS_CONFIG=$conf $MKE2FS -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +echo "error default profile panic" >> $OUT +write_defaults_conf panic +MKE2FS_CONFIG=$conf $MKE2FS -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +echo "error default profile remount-ro" >> $OUT +write_defaults_conf remount-ro +MKE2FS_CONFIG=$conf $MKE2FS -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +echo "error default profile broken" >> $OUT +write_defaults_conf broken +dd if=/dev/zero of=$TMPFILE bs=1k count=512 > /dev/null 2>&1 +MKE2FS_CONFIG=$conf $MKE2FS -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +# Test errors= in a fs type +echo "error fs_types profile continue" >> $OUT +write_section_conf continue +MKE2FS_CONFIG=$conf $MKE2FS -T test_suite -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +echo "error fs_types profile panic" >> $OUT +write_section_conf panic +MKE2FS_CONFIG=$conf $MKE2FS -T test_suite -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +echo "error fs_types profile remount-ro" >> $OUT +write_section_conf remount-ro +MKE2FS_CONFIG=$conf $MKE2FS -T test_suite -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +# Test command line override +echo "error fs_types profile remount-ro" >> $OUT +write_section_conf remount-ro +MKE2FS_CONFIG=$conf $MKE2FS -T test_suite -e panic -F $TMPFILE > /dev/null 2>&1 +$DUMPE2FS $TMPFILE 2>&1 | grep 'Errors behavior' >> $OUT + +cmp -s $OUT $EXP +status=$? + +if [ "$status" = 0 ] ; then + echo "$test_name: $test_description: ok" + touch $test_name.ok +else + echo "$test_name: $test_description: failed" + diff $DIFF_OPTS $EXP $OUT > $test_name.failed + rm -f $test_name.tmp +fi + -- cgit v1.2.3