Skip to content

Commit

Permalink
some test cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
chzchzchz committed Sep 29, 2010
1 parent be6d6aa commit 971ab4b
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 37 deletions.
12 changes: 6 additions & 6 deletions img/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
all: ext2.img vfat.img nilfs.img
all: ext2.img vfat.img nilfs2.img

format: ext2.img vfat.img nilfs.img
format: ext2.img vfat.img nilfs2.img
./loopback_fs_setup.sh ext2.img ext2 && ./gen_files.sh && ./loopback_fs_teardown.sh
./loopback_fs_setup.sh vfat.img vfat && ./gen_files.sh && ./loopback_fs_teardown.sh
./loopback_fs_setup.sh nilfs.img nilfs2 && ./gen_files.sh && ./loopback_fs_teardown.sh
./loopback_fs_setup.sh nilfs2.img nilfs2 && ./gen_files.sh && ./loopback_fs_teardown.sh

clean:
rm -f *.img
Expand All @@ -17,6 +17,6 @@ vfat.img:
dd if=/dev/zero of=vfat.img bs=`expr 1024 \* 1024` count=100
yes | /usr/sbin/mkfs.vfat vfat.img

nilfs.img:
dd if=/dev/zero of=nilfs.img bs=`expr 1024 \* 1024` count=256
yes | /sbin/mkfs.nilfs2 -L mkfsnilfs -b 4096 nilfs.img
nilfs2.img:
dd if=/dev/zero of=nilfs2.img bs=`expr 1024 \* 1024` count=256
yes | /sbin/mkfs.nilfs2 -L mkfsnilfs2 -b 4096 nilfs2.img
24 changes: 12 additions & 12 deletions src/tool/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ EXT2_OBJS= fsl.ext2.table.o fsl.ext2.types.o
EXT2_TOOLS= scantool-ext2 browser-ext2
VFAT_OBJS= fsl.vfat.table.o fsl.vfat.types.o
VFAT_TOOLS= scantool-vfat browser-vfat
NILFS_OBJS= fsl.nilfs.table.o fsl.nilfs.types.o
NILFS_TOOLS= scantool-nilfs browser-nilfs
NILFS_OBJS= fsl.nilfs2.table.o fsl.nilfs2.types.o
NILFS_TOOLS= scantool-nilfs2 browser-nilfs2
RT_OBJS=../runtime/runtime.o \
../runtime/type_info.o \
../runtime/virt.o \
Expand Down Expand Up @@ -34,10 +34,10 @@ browser-vfat: $(VFAT_OBJS)
scantool-vfat: $(VFAT_OBJS)
gcc $(CFLAGS) -o $@ $^ $(SCANTOOL_OBJS)

browser-nilfs: $(NILFS_OBJS)
browser-nilfs2: $(NILFS_OBJS)
gcc $(CFLAGS) -o $@ $^ $(BROWSER_OBJS)

scantool-nilfs: $(NILFS_OBJS)
scantool-nilfs2: $(NILFS_OBJS)
gcc $(CFLAGS) -o $@ $^ $(SCANTOOL_OBJS)


Expand Down Expand Up @@ -81,21 +81,21 @@ fsl.vfat.table.o: fsl.vfat.table.c
gcc $(CFLAGS) -I.. -c $^ -o $@


fsl.nilfs.types.o: fsl.nilfs.types.s
fsl.nilfs2.types.o: fsl.nilfs2.types.s
as $< -o $@

fsl.nilfs.types.s: fsl.nilfs.types.bc
fsl.nilfs2.types.s: fsl.nilfs2.types.bc
llc -O3 $< -o $@

fsl.nilfs.types.bc: fsl.nilfs.types.ll
fsl.nilfs2.types.bc: fsl.nilfs2.types.ll
opt -O3 $^ >$@

fsl.nilfs.types.ll: ../../fs/nilfs2.fsl
../lang nilfs <$^
fsl.nilfs2.types.ll: ../../fs/nilfs2.fsl
../lang nilfs2 <$^

fsl.nilfs.table.c: ../../fs/nilfs2.fsl
../lang nilfs <$^
fsl.nilfs2.table.c: ../../fs/nilfs2.fsl
../lang nilfs2 <$^

fsl.nilfs.table.o: fsl.nilfs.table.c
fsl.nilfs2.table.o: fsl.nilfs2.table.c
gcc $(CFLAGS) -I.. -c $^ -o $@

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 4 additions & 3 deletions tests/do_all_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ function scan_startup
cmd="${src_root}/src/tool/scantool-$fs ${src_root}/img/$fs.img"
echo "$cmd" >>tests.log
echo "$cmd" >failed_test_cmd
outstr=`eval $cmd`
eval $cmd >cur_test.out
cat cur_test.out
retval=$?
if [ $retval -ne 0 ]; then
echo "Test failed: $fs."
echo "Output: '$outstr'"
exit $retval
fi
echo -n "$outstr">"${src_root}"/$fs.scan.out
cp cur_test.out "${src_root}"/tests/scantool-$fs/$fs.scan.out
}

function specific_tests
Expand Down Expand Up @@ -75,7 +76,7 @@ cd "${src_root}"
rm -f failed_test_cmd
rm -f tests.log

for a in ext2 vfat nilfs; do
for a in ext2 vfat nilfs2; do
scan_startup $a
browser_startup $a
specific_tests $a
Expand Down
File renamed without changes.
Binary file added tests/scantool-ext2/ext2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added tests/scantool-vfat/vfat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion tests/test_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function run_test
TESTNUM="$1"
TESTNAME="$2"

cmd="${src_root}/src/tool/${tool_name} ${src_root}/img/${img_name} 2>&1 <${src_root}/tests/${tool_name}-test-input-$TESTNUM"
cmd="${src_root}/src/tool/${tool_name} ${src_root}/img/${img_name} 2>&1 <${src_root}/tests/${tool_name}/test-input-$TESTNUM"
echo "$cmd" >failed_test_cmd
echo "$cmd" >>tests.log
test_outstr=`eval $cmd`
Expand Down
31 changes: 16 additions & 15 deletions util/draw_all_scans.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,33 @@

# as if run from src_root

function draw_ext2
function draw_fs
{
if [ ! -f ext2.scan.out ]; then
FS=$1
REGEX=$2
SCANOUTFNAME=tests/scantool-$FS/$FS.scan.out
if [ ! -f $SCANOUTFNAME ]; then
echo "No files generated? Run some tests first."
exit -1
fi

grep Mode ext2.scan.out | egrep "(dir|sb|group_desc|bmp|ext2_inode'|ext2_data_block)" >ext2.scan.processed.out
ext2_sz=`ls -l img/ext2.img | awk '{ print $5; }'`
processed_fname="tests/scantool-${FS}/${FS}.scan.processed.out"
grep Mode $SCANOUTFNAME | egrep "$REGEX" >${processed_fname}
src_sz=`ls -l img/$FS.img | awk '{ print $5; }'`

./util/draw_scan.py ext2.scan.processed.out $ext2_sz ext2.png >ext2.draw.log
}
./util/draw_scan.py "${processed_fname}" $src_sz tests/scantool-$FS/$FS.png >tests/scantool-$FS/$FS.draw.log

}

function draw_vfat
function draw_ext2
{
if [ ! -f vfat.scan.out ]; then
echo "No files generated? Run some tests first."
exit -1
fi

grep Mode vfat.scan.out | egrep "(fat'|fat_de|fat_ent|bpb|'voff' : 0.*cluster)" >vfat.scan.processed.out
vfat_sz=`ls -l img/vfat.img | awk '{ print $5; }'`
draw_fs ext2 "(dir|sb|group_desc|bmp|ext2_inode'|ext2_data_block)"
}

./util/draw_scan.py vfat.scan.processed.out $vfat_sz vfat.png >vfat.draw.log

function draw_vfat
{
draw_fs vfat "(fat'|fat_de|fat_ent|bpb|'voff' : 0.*cluster)"
}

draw_ext2
Expand Down

0 comments on commit 971ab4b

Please sign in to comment.