Necessary changes for automatic integration testing

Goes in line with yihui/knitr#627 and yihui/knitr#642. Fixes yihui/knitr#645.