Fix issues found moving Windows build to MinGW-w64 clang #105
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The main issue here is to do with the Glulxe interpreter used in the test harness. At the moment, we build that using the makefiles that come with CheapGlk and Glulxe, passing OS_UNIX in as a define, which causes the Unix code in osdepend.c to be used. This uses the non-standard functions random() and setrandom() to generate random numbers. The trouble here is that a) we're relying on the existence of these non-standard Unix functions, and b) we're relying on all implementations of them having the same algorithm, as several tests rely on the same random number sequence being generated for a given seed. When building on Windows with Cygwin that's fine, as the functions exist and are identical in output to the Linux functions. But moving to a Windows environment with a more recent clang, we don't have those functions any more.
However, the Glulxe source code does contain an implementation of a reasonable random number generator. To use this I've added a new file, dumb.c, to the Glulxe source code in the Inform repository. This replaces osdepend.c with code that should work the same everywhere. To use that code, though, we can no longer use the Glulxe makefile as is, so I've changed inform6.mkscript to build CheapGlk and Glulxe in the same way that Frotz is built. Finally, I've updated affected tests with the appropriate ideal results for this changed random number generator.