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
Merge pull request #212 from grissiom/fix-tc

Fix tc