Necessary changes for automatic integration testing

Goes in line with yihui/knitr#627. The commit marked TODO
is probably wrong (or it's a regression in knitr).