Issue #2078 is a crash (SIGILL) inside the dotnet runtime when running on
macOS on Travis. This is intermittent, so a retry may help. Retry this
specific exit status inside runProcess.
Log the command / stdout / stderr / exit status at three places
during the C# runtime tests.
At these places we are executing subprocesses, but if those fail we
weren't logging the info that we may need to diagnose the problem.
Assert that the dotnet restore / build commands succeeded. If we
get a failure at this point, the test is obviously going to fail, and
we're masking the error by trying to push on with other commands.
BailErrorStrategy is supposed to throw an error that's different from
the ordinary recognition error, specifically so that it can be handled
differently by client code. This was not ported over from Java correctly.
Fix this by moving parseCancellation from ANTLRError to ANTLRException,
adding its RecognitionException argument, and throwing it from the
two handlers in BailErrorStrategy.
Also remove ANTLRException.cannotInvokeStartRule, which is unused.
(The Java runtime uses it when ParseTreePatternMatcher throws a generic
exception, but we don't have that.)
Change the initializer to ANTLRFileStream so that it throws any errors that
occur while reading the file. Previously, it was just dropping any errors on
the floor (inside Utils.readFile).
Remove Utils.readFile, it's not used anywhere else.
This has been ported over from the Java code, but it was deprecated there.
There's no point having it in the Swift runtime because we don't have the
legacy code to support. Also, it wasn't implemented properly, so it
never worked.
Remove {DFA,IntervalSet}.toString(_:[String?]?)
and the inits in ParserInterpreter and DFASerializer for the same reason.
Switch the unit tests to use the alternate toString(_:Vocabulary).
SwiftPM has changed its default layout for new packages (i.e. when we
use "swift package init --type executable" during the test). It now is
<projectName>/Sources/<projectName>/main.swift, so we need to adjust the
paths appropriately.
This includes a small change to print stdout as well as stderr if a
unit test fails to build. swift-build-tool takes the compiler subprocess's
stderr and puts it on stdout. *sheesh* This meant that we were losing
critical error messages.