Add test code for serialthread module