The "cannot load EFI/Drivers/TestSupport.efi" error is due to a firmware compatibility issue with the TestSupport.efi bootloader for the online Apple Diagnostics. Apple broke the diagnostics with a firmware update and decided to ignore it. This is completely normal for may of the older Macs....especially the 2012 models. Unfortunately most Apple techs have no clue about this error. It is not the source of the problem with your iMac.
You should still be able to boot into Internet Recovery Mode using Command + Option + R to try to repair the file system or to reinstall macOS.
Depending on the exact model of your iMac, you may be able to create a bootable macOS USB installer using the instructions in this Apple article if you have access to another compatible Mac:
Create a bootable installer - Apple Support
Another option would be to boot into Internet Recovery Mode (Command + Option + R) and try installing macOS to an external USB3 drive. This would give you access to more options to try to assess the situation with the internal boot drive including possible data recovery if needed.
More than likely the internal hard drive has failed. If you don't have a spare external USB3 drive for installing macOS, then I can provide instructions for creating & using a bootable Linux USB stick to check the health of the internal drive(s)....just let me know if you are interested.