[dmtest] Factor out select_tests
[dmtest] add a list command