From: Charles Manning Date: Sat, 7 Aug 2010 04:30:20 +0000 (+1200) Subject: yaffs Changes to direct tests X-Git-Tag: pre-name-change~28 X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs2.git;a=commitdiff_plain;h=570d9b811895119f6b3411678cbdcaa27226f403;hp=9d8bb3ae8a8362d1899d6565ca6ca1217fb172f0 yaffs Changes to direct tests Add test for lost+found being empty. Make fuzzer less verbose Allow changing of iteration count for simulated power fail testing. Signed-off-by: Charles Manning --- diff --git a/direct/tests/fuzzer.c b/direct/tests/fuzzer.c index deadf95..64d307f 100644 --- a/direct/tests/fuzzer.c +++ b/direct/tests/fuzzer.c @@ -71,7 +71,7 @@ int main(int argc, char *argv[]) srand(time(0)); for(b = 0; b < nbuffers; b++){ - printf("buffer %d\n",b); + /* printf("buffer %d\n",b); */ lseek(h,b * sizeof(buffer),SEEK_SET); bufsize = read(h,buffer,sizeof(buffer)); for(i = 0; i < changesPerBuffer; i++){ diff --git a/direct/tests/launch_tests.sh b/direct/tests/launch_tests.sh index 31e9e95..1005ff2 100755 --- a/direct/tests/launch_tests.sh +++ b/direct/tests/launch_tests.sh @@ -1,5 +1,12 @@ #! /bin/sh set -x + + +iterations=100000 + +[ -z $1 ] || iterations=$1 + + LAUNCHDIR=`pwd` RUNDIR=`pwd`/tmp mkdir $RUNDIR @@ -8,9 +15,9 @@ sudo chmod a+wr $RUNDIR -xterm -e "$LAUNCHDIR/manage_nor_test.sh 0"& -xterm -e "$LAUNCHDIR/manage_nand_test.sh 0"& -xterm -e "$LAUNCHDIR/manage_nor_test.sh 1"& -xterm -e "$LAUNCHDIR/manage_nand_test.sh 1"& -xterm -e "$LAUNCHDIR/manage_nor_test.sh 2"& -xterm -e "$LAUNCHDIR/manage_nand_test.sh 2"& +xterm -e "$LAUNCHDIR/manage_nor_test.sh 0 $iterations"& +xterm -e "$LAUNCHDIR/manage_nand_test.sh 0 $iterations"& +xterm -e "$LAUNCHDIR/manage_nor_test.sh 1 $iterations"& +xterm -e "$LAUNCHDIR/manage_nand_test.sh 1 $iterations"& +xterm -e "$LAUNCHDIR/manage_nor_test.sh 2 $iterations"& +xterm -e "$LAUNCHDIR/manage_nand_test.sh 2 $iterations"& diff --git a/direct/tests/manage_nand_test.sh b/direct/tests/manage_nand_test.sh index 3d985d3..7944873 100755 --- a/direct/tests/manage_nand_test.sh +++ b/direct/tests/manage_nand_test.sh @@ -3,6 +3,10 @@ dir_id=-none [ -z $1 ] || dir_id=$1 +iterations=100000 + +[ -z $2 ] || iterations=$2 + STARTDIR=`pwd` RUNDIR=`pwd`/tmp/nand-$dir_id mkdir $RUNDIR @@ -11,7 +15,7 @@ cp $STARTDIR/*sh . ln -s $STARTDIR/yaffs_test yaffs_test ./init_fw_update_test_nand.sh -./run_fw_update_test_nand.sh +./run_fw_update_test_nand.sh $iterations echo "!!!!!!!!!!!" diff --git a/direct/tests/manage_nor_test.sh b/direct/tests/manage_nor_test.sh index d7a08d3..60b78da 100755 --- a/direct/tests/manage_nor_test.sh +++ b/direct/tests/manage_nor_test.sh @@ -3,6 +3,11 @@ dir_id=-none [ -z $1 ] || dir_id=$1 + +iterations=100000 + +[ -z $2 ] || iterations=$2 + STARTDIR=`pwd` RUNDIR=`pwd`/tmp/nor-$dir_id mkdir $RUNDIR @@ -11,7 +16,7 @@ cp $STARTDIR/*sh . ln -s $STARTDIR/yaffs_test yaffs_test ./init_fw_update_test_nor.sh -./run_fw_update_test_nor.sh +./run_fw_update_test_nor.sh $iterations echo "!!!!!!!!!!!" echo "Tests done" diff --git a/direct/tests/nor_stress.c b/direct/tests/nor_stress.c index 3802837..6f6b4ce 100644 --- a/direct/tests/nor_stress.c +++ b/direct/tests/nor_stress.c @@ -182,6 +182,7 @@ static void dump_directory_tree_worker(const char *dname,int recursive) struct yaffs_stat s; char str[1000]; int error_line = 0; + int nentries; d = yaffs_opendir(dname); @@ -191,11 +192,13 @@ static void dump_directory_tree_worker(const char *dname,int recursive) } else { + nentries = 0; while((de = yaffs_readdir(d)) != NULL) { strcpy(str,dname); strcat(str,"/"); strcat(str,de->d_name); + nentries++; yaffs_lstat(str,&s); @@ -224,10 +227,15 @@ static void dump_directory_tree_worker(const char *dname,int recursive) dump_directory_tree_worker(str,1); if(s.st_ino > 10000) - error_line = __LINE__; + error_line = __LINE__; } + if(strstr(dname,"lost+found") && nentries >0){ + printf("\n\n!!! HEY lost+found not empty, had %d entries\n\n\n",nentries); + error_line = __LINE__; + } + if(error_line && !no_verification) FatalError(error_line); diff --git a/direct/tests/run_fuzz_test_nand.sh b/direct/tests/run_fuzz_test_nand.sh index b9473fc..1faeff5 100755 --- a/direct/tests/run_fuzz_test_nand.sh +++ b/direct/tests/run_fuzz_test_nand.sh @@ -17,6 +17,9 @@ do seed=$RANDOM j=$(( $i % 10 )) + cycles=$RANDOM + cycles=$(( $cycles % 10000 )) + rm -f log-nand-*$j rm -f seed-nand-*$j echo $seed>seed-nand-for-run-$i @@ -45,6 +48,5 @@ do echo "#########" echo "#########" echo "#########" - ./yaffs_test -u -p -s$seed -t 8 -z yaffs2 - # >log-nand-$i + ./yaffs_test -u -p -s$seed -t 8 -n $cycles -z yaffs2 done diff --git a/direct/tests/run_fw_update_test_nor.sh b/direct/tests/run_fw_update_test_nor.sh index 9c9d616..9265336 100755 --- a/direct/tests/run_fw_update_test_nor.sh +++ b/direct/tests/run_fw_update_test_nor.sh @@ -33,6 +33,7 @@ do echo "#########" echo "#########" echo "#########" - ./yaffs_test -u -f -p -s$seed -t0 M18-1 >log-nor-$i + ./yaffs_test -u -f -p -s$seed -t0 M18-1 + #>log-nor-$i done