By law they can not pass a vehicle that has a check engine light on. The light is indicating there there is some type of component malfunction with the vehicle. You need to have it properly diagnosed and repaired. Most smog stations will give you 1 free retest and the place that does the repair will be able to give you a general idea if the emissions are low enough to pass smog before you take it back over there. Just make sure you take the paper work from the smog station to the repair facility so they can see the whole picture.