]> git.ipfire.org Git - thirdparty/e2fsprogs.git/blame - tests/f_detect_junk/script
tests: clean up $DEBUGFS_EXE usage in scripts
[thirdparty/e2fsprogs.git] / tests / f_detect_junk / script
CommitLineData
b291c11f
DW
1#!/bin/bash
2
3819bff4
AD
3if [ "$(grep -c 'define HAVE_MAGIC_H' ../lib/config.h)" -eq 0 ]; then
4 echo "$test_name: skipped (no magic)"
5 exit 0
6fi
b291c11f
DW
7
8FSCK_OPT=-fn
9IMAGE=$test_dir/image.bz2
10
11bzip2 -d < $IMAGE > $TMPFILE
ec3a69bb 12$DD if=/dev/zero of=$TMPFILE conv=notrunc oflag=append bs=1024k count=16 > /dev/null 2>&1
b291c11f
DW
13
14# Run fsck to fix things?
15if [ -x $DEBUGFS_EXE ]; then
16 EXP=$test_dir/expect
17else
18 EXP=$test_dir/expect.nodebugfs
19fi
20OUT=$test_name.log
21rm -rf $test_name.failed $test_name.ok
22
23echo "*** e2fsck" > $OUT
24$FSCK $FSCK_OPT $TMPFILE >> $OUT 2>&1
25echo "*** debugfs" >> $OUT
3819bff4 26test -x $DEBUGFS_EXE && $DEBUGFS -R 'quit' $TMPFILE >> $OUT 2>&1
b291c11f
DW
27echo "*** tune2fs" >> $OUT
28$TUNE2FS -i 0 $TMPFILE >> $OUT 2>&1
29echo "*** mke2fs" >> $OUT
30$MKE2FS -n $TMPFILE >> $OUT 2>&1
31
63a801de
DW
32sed -f $cmd_dir/filter.sed -e "s|$TMPFILE|test.img|g" < $OUT > $OUT.new
33mv $OUT.new $OUT
b291c11f
DW
34
35# Figure out what happened
36if cmp -s $EXP $OUT; then
37 echo "$test_name: $test_description: ok"
38 touch $test_name.ok
39else
40 echo "$test_name: $test_description: failed"
41 diff -u $EXP $OUT >> $test_name.failed
42fi
43unset EXP OUT FSCK_OPT IMAGE