runcmd: Additional test cases and minor cleanup.