As others have said, the only way to legally virtualize Mac OS X (according toApple's EULA) is on Apple hardware. So the purchase you need to make isn't a software purchase, it's a hardware purchase: you need to buy a Mac.
With Intel (x86) Apple hardware, there's three ways you can do this:
1. Use VMWare ESXi as the host OS
ESXi is VMware's professional server virtualization platform. As the base / host OS on an Apple Mac, VMware ESXi can virtualize Mac OS X guests, as well as virtually any other operating system which runs on x86 hardware, including Linux and Microsoft Windows. The core of ESXi which you would need is cost free; VMWare sells support licenses for ESXi with hefty license fees which you would not require.
I have been down this road and while it works, it's not for the faint of heart: ESXi needs to be managed via a web UI from another machine, and if you're going to use this as a desktop system (with a monitor and keyboard attached) then you need to have hardware (USB controller and GPU card) capable of PCI passthrough. Without PCI passthrough your attached monitor will simply display a text-only ESXi configuration screen.
Check VMWare's Hardware Compatibility List and focus on first or Mac Pro models. A Mac Mini will work but you're very unlikely to get Passthrough working.
At this time, VMWare ESXi does not run on an Apple M1 chips so you'll need an Intel mac for this option. VMWare says "we are committed to delivering VMware virtual machines on Apple Silicon" so this may change.
2. Use Mac OS X as the host OS
Buy a Mac (any recent x86 model) and virtualize Mac OS X, Linux and Windows using Mac OS X as the base / host OS. In this case you may need to purchase software. VMWare Fusion is the software I personally use and can highly recommend. Parallels is another option I am aware of. You can use VirtualBox, which is free, but support for Mac OS X guests is lacking so I would only use this for Linux or Windows guests.
The machine will boot into OS X, but you can configure a Linux VM to launch on boot, and use full-screen, multi-monitor support to use Linux as your every day OS, wither switching to a Mac VM for testing or, just using the Mac OS on the host. Linux runs well under VMWare, though graphics performance is not as good as on bare metal. This is an easy to use solution and the one I have migrated to (I used to use ESXi)
This solution works on an Apple Mac Mini, a Mac Pro, a Macbook Pro, and basically any x86 Apple hardware which is recent and powerful enough. No GPU passthrough is required.
You'll want to stick with Intel Macs and avoid M1 chips for this: VirtualBox only supports x86 virtualization, and while Parallels and VMWare both say they're working on M1 support, it's not here yet and I wouldn't advise being an early adopter.
3. Use Apple Boot Camp or Linux as main OS
Apple x86 hardware is capable of running Linux or Windows as it's main boot OS. Linux runs very well on modern Apple hardware, and if you only need Mac occasionally for testing, you can have the Mac booted into Linux for normal work and reboot into Mac OS X only as needed for testing. Linux can be installed to the Mac's main drive (on a separate partition) or an external drive, or even to an SD card (though I would only recommend that for a read-only root, like a LiveCD)
This option works with any Intel mac; Apple M1 macs do not support boot camp, and while Linux may support booting an M1 mac in the future, it doesn't sound like it will happen soon
4. Just keep an older, used Mac around for testing
Of course there's another option: don't virtualize, just have a cheap Mac that is kept for testing only. In this case, the processor architecture doesn't matter, unless it impacts the testing you will be doing on the mac.