tests: Improve ability to run tests against LD_LIBRARY_PATH Steam Runtime
-
tests: Skip some tests if already in the Steam Runtime environment
We'll get an unintended result for these tests if we are, because they set up a mock environment that doesn't match the one we're already in.
-
test-init: If running in the LD_LIBRARY_PATH runtime, set helpers path
Otherwise, the SrtSystemInfo in test-system-info-cli will be unable to find the necessary helpers, because its path relative to the runtime is unlikely to be what it would be when installed "properly" into a sysroot.
-
tests: Write out JSON files so we can diff them nicely
Comparing two giant strings of JSON in g_assert_cmpstr() output is not straightforward, so let's try to write them out to files and run diff on them.
The AUTOPKGTEST_ARTIFACTS variable set by Debian's autopkgtest framework is as good a mechanism as any for signalling where would be a good place; or if that's not set, use a temporary directory.
-
tests: Pretty-print expected and actual JSON with the same libjson-glib
When we're running tests in the LD_LIBRARY_PATH Steam Runtime, the test will generally use the system copy of libjson-glib (if there is one), but steam-runtime-system-info will use the Steam Runtime copy of libjson-glib via its RPATH. This can result in them being pretty-printed differently: old versions of json-glib like the one in scout will consistently add a newline after the opening bracket or brace of an array or object, but newer versions fold the empty array or object into a single line.