• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3if ! test -x $DEBUGFS_EXE; then
4	echo "$test_name: $test_description: skipped (no debugfs)"
5	return 0
6fi
7FSCK_OPT=-fy
8IMAGE=$test_dir/image.gz
9
10gzip -d < $IMAGE > $TMPFILE
11#e2label $TMPFILE test_filesys
12
13# Run fsck to fix things?
14EXP=$test_dir/expect
15OUT=$test_name.log
16
17$FSCK $FSCK_OPT -N test_filesys $TMPFILE > $OUT.new 2>&1
18echo "Exit status is $?" >> $OUT.new
19
20echo "debugfs cat uninit file" >> $OUT.new
21echo "ex /a" > $TMPFILE.cmd
22echo "cat /a" >> $TMPFILE.cmd
23$DEBUGFS -w -f $TMPFILE.cmd $TMPFILE >> $OUT.new 2>&1
24echo >> $OUT.new
25sed -f $cmd_dir/filter.sed < $OUT.new > $OUT
26rm -f $OUT.new $TMPFILE $TMPFILE.cmd
27
28# Figure out what happened
29if cmp -s $EXP $OUT; then
30	echo "$test_name: $test_description: ok"
31	touch $test_name.ok
32else
33	echo "$test_name: $test_description: failed"
34	diff -u $EXP $OUT >> $test_name.failed
35fi
36unset EXP OUT FSCK_OPT IMAGE
37