Test match has to complete in 7 hrs. 2+2+2 session, 40+20 mins lunch and tea break. If 90 overs are not complete then they can extend 30 mins more. If overs are complete before time then they can bowl as much as they can till 7 hrs are complete.
If it rains for more than half a day then match starts 30 mins early from the next day or 15 mins early if it starts less than half day late due to rain