Testall and packages test fixes

Various fixes to package testing and a few fixes to the test framework to make it better/easier to use in masterfiles. It's probably best to review this commit by commit.

Unfortunately this revealed a test failure that was previously wrongly passing. See https://cfengine.com/dev/issues/1535.

See also https://github.com/cfengine/core/pull/1309, which is a companion PR, and should be merged at the same time.