GM has been accused in a lawsuit of rigging hundreds of thousands of diesel trucks with devices similar to those used by Volkswagen to ensure they pass emissions tests.