Also "discovered" (for myself) a diagnostics mode: hold down the "command-D" key combination when powering up: https://support.apple.com/en-us/HT202731
However, it doesn't reveal any details about what is being checked: on my machine it simply reports that all is OK in Apple's "keep it simple" style, so I don't know what details are shown if there is a problem. Supposedly "reference codes" (with no reference to speakers): https://support.apple.com/en-us/HT203747
Also, without asking/involving the user to confirm that sounds are being produced, I would be surprised if it COULD detect any speaker issues at all (especially physical issues like rubbing/buzzing or torn "cone", trapped/rattling dirt/debris). During my own diagnostics test no audible tones/sounds were produced.
Possibly software self-testing of hardware could detect only an open circuit (speaker disconnect); but, again, I'd be surprised (pleasantly) if that's being done now.
Maybe they should add a test loop using a tone/frequency sweep with the built-in microphone analyzing how clean the audio is that comes out the individual speakers (with appropriate privacy/permission notice, of course, due to the active room recording in progress at the time), and distinguishing between characteristic distortion caused by, say, cone buzz vs circuit overdrive crackling, etc, for a logged report result. That would be pretty cool.