Rethinking Test-time Likelihood: The Likelihood Path Principle and Its Application to OOD Detection