tests: move some of rdpmc code into common library