TC: do not use rt_sem_trytake to clean the sem

There can be a race condition that the sem has alread been detached
after we did the cleanup. Besides, there is a RT_IPC_CMD_RESET command
in rt_sem_control which is more clear in setting the sem values.
TC: release the sem in cleanup

The sem that has been created should be deleted. The sem that has been
inited should be detached.
TC: semaphore_dynamic: code cleanup
TC: heap_realloc: check for realloc(ptr, 0)
TC: always print the test result despite the wait time
TC: code cleanup
TC: fix the heap tests
dfs: refine code

decrease indentation to make cleaner code
fix mkfs bug when there is no mkfs implementation
Merge pull request #212 from grissiom/fix-tc

Fix tc
dfs: refine more code

clean code with pointer rather than index
Merge pull request #210 from prife/master

dfs: refine code
TC: clear the TC_STAT_RUNNING flag when tc forgot to do so

TCs are supposed to exit with the TC_STAT_RUNNING cleared. If it forgot
to do this, do it by ourselves.
TC: fix the thread_delete

The tc thread should delay more time than tid2 in order to let it run
the test. The hard-coded "27" is not enough in some cases.
Merge pull request #213 from grissiom/more-tc

More tc
dfs: rename varialbe name in dfs_filesystem_lookup

empty is confused in dfs_filesystem_lookup.
kernel: add rt_critical_level that return the lock count of scheduler

Out side world may be interested in whether the scheduler is locked or
not. Provide an API to tell that.
kernel: let rt_thread_idle_excute loop until there is no dead thread

Out side world is difficult to tell whethere there is dead thread
remaining. If rt_thread_idle_excute only do one cleanup, it's hard to
finish cleanups outside the idle thread. So let is loop and do all the
cleanups in one call.
dfs: fix dfs_unmount bug

fix #211
TC: print a summary after all the tests
TC: format code, expand TABs

No functional changes.