Your Toyota Echo's gas cap being defective or even not being on tightened properly can cause the check engine light to turn on. The trouble code which would result if your Toyota Echo has a gas cap problem would be related to your Echo's EVAP system. The EVAP system is responsible for keeping fuel tank fumes within the engine air intake system; disallowing it to escape into the atmosphere.
If you've ensured that you always tighten the gas cap fully after refueling, and your Echo's check engine light is still illuminated you might consider replacing the gas cap; and inexpensive fix. Replace the gas cap and drive your car for a few days. Make sure the check engine light stays off. If all is good go ahead with the smog inspection. If the new gas cap doesn't solve this problem you'll need to have a hands-on diagnosis of the EVAP system to find out where exactly gas fumes are leaking out of. It could be a problem with a disconnected, broken, or brittle EVAP hose somewhere near the gas tank or in the engine compartment, or defective EVAP canister.