I understand that it is also helpful to have your engine fully warmed up (by travelling several miles) before you go in for the smog check.
If after trying the remedies above, your vehicle still fails the smog test, in California you can get assistance in several ways. Here is the link for some of that info.
Basically, if you can prove that you spent at least $650 in repairs to get your vehicle to pass smog and it still doesn’t pass, you can try to get a one-time waiver. You don’t have to worry about the smog test for another 2 years, but you can only use this waiver only once.
The other assistance is you can get $500 for smog repairs if your income is below a certain level. Again, check the link above.
Finally, you can sell your vehicle back to the state for $1000 (or $1500 if your income is below a certain level).
In summary, if you can get the waiver, then the next time a smog test is due, your car will be 20 years old. I don’t think it would be worth $1000 if it doesn’t even pass smog. Turning it over to the state for $1000 seems like a good idea.