These tests were broken because they don't get used very often, mainly because they require root to run. This fixes them (and a few other related problems). These are just framework tests, I'll push these in a few days with or without review (unless there are comments) since I don't think anyone cares about these but me.