The swabs go into a gas cromatograph-mass spectrometer that gives the molecular weight of things that are volatile enough to enter. I would assume if the weight is close to that of a substance that is explosive or a potential component, or a drug, it is noted. Then the question is whether it is present and in what quantity. A good article is here:
http://theconversation.com/the-scien...trometry-35201
They have no reason to test for drugs, so I doubt the GC measures that.
If you do get swabbed you move to the front of the line. That was taught to me when travelling with a late twenties brown male who had been 'randomly' screened a few times before