cmd: Add test and fix bugs for dm drivers