Chip testing firm Cohu to buy Xcerra for about $796 million