Commit Graph

522 Commits

Author SHA1 Message Date
Ewan Mellor e54607d2ae
Change the test asserts so that we can see all the values.
Change the unit test asserts so that we can see all the values in the
event of a failure.  When debugging an error, it's useful to see both
the stdout and stderr for the failure.  Previously we would only see
one or the other (whichever one failed the assert).

This adds a helper function BaseRuntimeTest.assertCorrectOutput.

This also removes SpecialRuntimeTestAssert, which has not been used for
2 years.
2018-11-15 15:33:10 -08:00
Ewan Mellor 3699ea5412
Exclude intermediate build products from the runtime-testsuite jar.
This means that if you build in an unclean source tree, you don't end up with
intermediate classes in the jar.  (This hasn't broken anything that I noticed,
but it bloats the jar and I wanted to make sure it wasn't messing anything up.)

This excludes .build (the Swift runtime's build directory), target (the Java
runtime's build directory) and Swift/*.xcodeproj (which is not in the source tree
but can be created by devs who are using Xcode).
2018-11-15 15:33:10 -08:00
Ewan Mellor 75d4d867ef
[Swift] Suppress "Optional" in the output when printing a value.
Suppress "Optional" in the output when printing a value in the tests and
some debugging messages.

This is a change in behavior in Swift 4.2 (SE-0054) that implicitly
unwrapped optionals are now seen as plain Optional at runtime, and so
print doesn't implicitly unwrap them any more.
2018-11-15 11:26:09 -08:00
Ewan Mellor 8e9b6f1147
Switch to using maven-jdk-tools-wrapper to find tools.jar.
This is in different locations on JDK 9 and up.  maven-jdk-tools-wrapper
does the right thing on all JDK releases.

This was mentioned in a side comment on PR #2280.
2018-11-15 11:24:54 -08:00
Terence Parr f261c36bc4
Merge pull request #2400 from nxtstep/fix/st4-dependency
Fix ST4 Snapshot dependency
2018-11-15 09:29:42 -08:00
Terence Parr d87a55576a
Merge pull request #2403 from ewanmellor/swift-perf-tests
Enable some performance tests on Swift.
2018-11-15 09:27:59 -08:00
Ewan Mellor e6feaeb489
Enable some performance tests on Swift.
These were skipped for the Javascript backends because they're still
too slow, but Swift is fine.  (Go is also excluded from these, maybe
that's a mistake, but I don't know.)
2018-11-14 20:29:56 -08:00
Ewan Mellor 842d3d7597
[Swift] Report InputMismatchException with original context information
Port 0803c74 from the Java runtime to Swift.  This was issue #1922.
Enable the corresponding tests for Swift.
2018-11-14 20:28:24 -08:00
nxtstep 36621bda6d
Fix ST4 Snapshot dependency 2018-11-15 00:13:02 +01:00
parrt 3039dc2411 update jetty server to avoid security risk 2018-11-08 16:51:15 -08:00
parrt 7591bf1705 updated ST version 2018-11-08 12:27:38 -08:00
parrt e37c9fb7ed add anaconda3 to search path. 2018-11-07 12:56:03 -08:00
parrt 1eca79ec3a update python from 3.5 to 3.6 2018-11-07 12:39:30 -08:00
Eric Vergnaud d134b6a12d Fixes #2301 2018-06-03 11:21:37 +08:00
parrt 17b6277502 [maven-release-plugin] prepare for next development iteration 2017-12-09 12:04:26 -08:00
parrt bdc05c87be [maven-release-plugin] prepare release 4.7.1 2017-12-09 12:04:17 -08:00
Terence Parr b5e6147cd5
Merge pull request #2123 from ewanmellor/swift-fix-parse-cancellation
[Swift] Fix parse-cancellation in BailErrorStrategy.
2017-11-29 09:56:09 -08:00
Terence Parr 8b86af6654
Merge pull request #2102 from ewanmellor/swift-antlrfilestream-report-errors
Report errors in ANTLRFileStream.
2017-11-29 09:47:04 -08:00
Ewan Mellor 22337f35c0
[CSharp] Add a retry if we get SIGILL when running dotnet.
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.
2017-11-14 13:33:01 -08:00
Ewan Mellor cbb10279ab
[CSharp] Add extra diagnostics to the C# runtime tests.
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.
2017-11-14 01:40:54 -08:00
Ewan Mellor 0ba9808982
[CSharp] Assert that test compilation succeeded.
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.
2017-11-14 01:40:54 -08:00
Ewan Mellor 2e0ed500dc
[CSharp] Print the stack trace if compilation fails. 2017-11-11 22:24:16 -08:00
Ewan Mellor eb9124fff8
[Swift] Fix parse-cancellation in BailErrorStrategy.
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.)
2017-11-11 10:45:38 -08:00
Ewan Mellor e77d690e36
Report errors in ANTLRFileStream.
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.
2017-11-10 18:06:12 -08:00
Ewan Mellor 6c11160b51
Remove tokenNames / getTokenNames from the Recognizer interface.
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).
2017-10-25 13:28:40 -07:00
Ewan Mellor 39c01f6da7
Update the Swift tests for Swift Package Manager 4.0.
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.
2017-10-20 10:12:47 -07:00
Niels Basjes ac9f75303e Fixed empty CodePointCharStream throwing exception on getText. Fixes #1949 2017-08-02 14:30:46 +02:00
Sam Harwell 0803c74eb2 Report InputMismatchException with original context information
Fixes #1922
2017-07-27 18:34:13 -05:00
Eric Vergnaud 5e0eee056d oops, forgot to flag the dotnet tests 2017-06-28 23:39:54 +08:00
Eric Vergnaud 32fc500102 Fix typo and rebalance 2017-06-27 07:43:59 +08:00
Eric Vergnaud 0e573fb0a5 categorise tests to fix Travis timeout 2017-06-27 00:50:49 +08:00
alimg 60cce436c2 Merge branch 'master' of https://github.com/antlr/antlr4 into py-input-mismatch-error 2017-06-25 19:02:26 +03:00
Eric Vergnaud dbff375c54 fix failing test 2017-06-25 14:13:18 +08:00
Eric Vergnaud 2e56ccfe19 simplify test 2017-06-25 14:13:01 +08:00
Eric Vergnaud 94ca69b727 add test for #1925 2017-06-25 10:13:58 +08:00
alimg 405dc20488 add parser error test case to replicate the Python formatting issue 2017-06-20 16:48:08 +03:00
Hanzhou Shi f15d9a31a3 revert one trivial change in go test. 2017-06-03 22:57:22 -07:00
Hanzhou Shi 77eddc8e76 fix linker issue on travis ubuntu 2017-06-03 22:57:21 -07:00
Hanzhou Shi e8962dad7e reads SWIFT_HOME from environment variables. 2017-06-03 22:57:21 -07:00
Hanzhou Shi 3095de982e All tests passing. But slow. 2017-06-03 22:57:21 -07:00
Hanzhou Shi 8cbd7c0693 Get parser tests working. 2017-06-03 22:57:21 -07:00
Hanzhou Shi 6acec92866 Refactoring swift test framework. 2017-06-03 22:57:21 -07:00
Terence Parr f2ee752a58 Merge pull request #1848 from davesisson/master
Fix tests for PR #1844.
2017-05-12 09:18:46 -07:00
David Sisson e9dd953cf1 Fixed another occurrence of NewFileInputStream. 2017-04-29 19:55:32 -07:00
David Sisson 81b8078860 updated 2017-04-29 17:52:21 -07:00
David Sisson f41ce7fed4 Fix tests for PR #1844. 2017-04-29 17:27:08 -07:00
Dong Xie e94b3acaed [dotnet] fix again for the test speed up 2017-04-28 16:18:36 +01:00
Dong Xie 5fffe4bb2e [dotnet] try to get test run faster; update from 1.0.1 to 1.0.3; fix test dir removal not recursive 2017-04-27 17:23:48 +01:00
Terence Parr efc0a14879 Merge pull request #1810 from xied75/dotnetcore
[dotnet] update to .netcore v1.0.1; add osx build
2017-04-17 09:55:32 -07:00
Terence Parr 9519bfc36f Merge pull request #1818 from parrt/fix-1815-again
Fixes #1815 (for real this time!)
2017-04-06 14:36:22 -07:00
parrt f858cd5948 Fixes #1815 (for real this time!). Fix text set for erroneous escapes so tool doesn't fail later. Remove some duplicate error messages. Add test for #1815. 2017-04-06 14:34:37 -07:00
Dong Xie da4987dc38 [dotnet] update to .netcore v1.0.1; add osx build 2017-04-04 15:26:40 +01:00
Hanzhou Shi 07048fe787 Fixing unit tests. 2017-04-02 09:41:55 -07:00
parrt 62baf4bd0a [maven-release-plugin] prepare for next development iteration 2017-03-30 14:11:59 -07:00
parrt d4d7e3d3bc [maven-release-plugin] prepare release 4.7 2017-03-30 14:11:49 -07:00
parrt b5648f405b tweak documentation about various targets 2017-03-30 10:44:28 -07:00
Terence Parr 6e474eb43e Merge pull request #1776 from bhamiltoncx/js-char-streams
New JavaScript CharStreams functions
2017-03-29 14:38:41 -07:00
Terence Parr 828461337f Merge pull request #1775 from bhamiltoncx/csharp-char-streams
New C# CharStreams static factory class
2017-03-29 14:37:06 -07:00
Ben Hamilton 200379802a Tidy comments and add tests to ensure UTF-16 and UTF-32 support Unicode code points > U+FFF 2017-03-29 10:06:08 -07:00
Ben Hamilton ab0655598e Improve memory usage of CodePointCharStream: Use 8-bit, 16-bit, or 32-bit buffer 2017-03-27 16:46:42 -07:00
parrt eb49080720 add test showing cost to load from a file where we know the size. Add test of small file to load as well. 2017-03-27 11:34:23 -07:00
parrt 4ca382c9b0 add dependence on JOL http://hg.openjdk.java.net/code-tools/jol to compute buffer sizes. Dumps footprint now too. 2017-03-26 13:27:57 -07:00
parrt 00d5781bee update sample lexer timing numbers after IntervalSet binary search update. 2017-03-24 14:01:21 -07:00
parrt 9cf26d0163 add my results to Ben's, small cleanup. 2017-03-24 13:45:37 -07:00
parrt da71ea375f add legacy ascii *load* back. separate out stream locate time / mem overhead from load tests. 2017-03-24 13:39:20 -07:00
Ben Hamilton b2869ee0d7 Fix TimeLexerSpeed when run from jar 2017-03-23 14:18:17 -07:00
parrt 0713128d04 add size information to the load for streams 2017-03-23 10:54:19 -07:00
Ben Hamilton f72e22550c charstreams-js 2017-03-22 11:03:16 -07:00
Ben Hamilton 307df9c68d New C# CharStreams static factory class 2017-03-20 13:07:08 -07:00
parrt 648f517da0 add more load times 2017-03-17 14:08:25 -07:00
parrt b961c86143 add load times 2017-03-17 13:37:01 -07:00
parrt aa177cf415 Forgot to add UTF-8 encoding to legacy. 2017-03-17 13:09:11 -07:00
parrt 553742e149 rm deadcode 2017-03-17 12:07:01 -07:00
parrt 251d27493e add lexer speed tests for new unicode streams 2017-03-17 12:06:07 -07:00
Terence Parr 1f6a329692 Merge pull request #1765 from bhamiltoncx/unicode-cleanup-and-doc
Tidy up CharStreams and add new doc/unicode.md
2017-03-16 17:03:06 -07:00
Ben Hamilton 4f2168600d Tidy up CharStreams API. Add new doc/unicode.md 2017-03-16 17:01:46 -06:00
parrt ae3aadce3f change whitespace for new wildcard test; messed up in python. 2017-03-15 14:10:55 -07:00
parrt d966702d63 add wildcard test. 2017-03-15 09:33:15 -07:00
Dong Xie e49b0977f5 fix #1725; get dotnet target test run 2017-03-04 01:42:44 +00:00
Ivan Kochurkin b07528796e Removed runtime CharSetWithMissingEndRange test. 2017-03-03 13:42:09 +03:00
parrt 3df19fbcc8 make format consistent with most of antlr project 2017-03-02 10:38:48 -08:00
parrt 6215f18ec3 rename 4.6.1 to 4.7 everywhere 2017-02-23 14:48:58 -08:00
Ben Hamilton fd4246cf3f Implement new extended Unicode escape \u{10ABCD}. Bump UUID. Add lots more tests. 2017-02-23 09:39:44 -08:00
parrt e1101caffa resolve conflict 2017-02-17 11:08:15 -08:00
parrt f8e7a2cf08 merge in dotnet stuff 2017-02-17 11:02:52 -08:00
Terence Parr 877f6a396b Merge pull request #1659 from bhamiltoncx/js-use-code-points-for-tests
JavaScript: Allow Unicode code points > U+FFFF in tests
2017-02-16 09:53:43 -08:00
Terence Parr b3f5d1e3d1 Merge pull request #1658 from bhamiltoncx/csharp-use-output-file
C#: Write test output to a file
2017-02-16 09:53:16 -08:00
Ben Hamilton c35bbabc16 PR #1658: Also write stderr to file 2017-02-16 09:44:40 -08:00
Ben Hamilton cd7700939c Use code points for JS tests 2017-02-14 15:26:54 -08:00
Ben Hamilton cd922eb74c Python 2/3 runtime and test harness support for writing test output to file 2017-02-14 15:00:52 -08:00
David Neumann e967463e91 Merge branch 'master' into master 2017-02-14 11:20:02 +01:00
Terence Parr 287f17b796 Merge pull request #1652 from bhamiltoncx/csharp-lexer-parser-output-file
C# support for lexer and parser output to a file
2017-02-13 15:10:54 -08:00
Terence Parr 9b7e2a81ce Merge pull request #1651 from bhamiltoncx/python-lexer-parser-output-file
Python 2 and Python 3 support for lexer and parser output to a file
2017-02-13 15:10:19 -08:00
Terence Parr 51f6ad69b6 Merge pull request #1649 from bhamiltoncx/test-output-reading
New class TestOutputReading to mimic StreamVacuum for tests which write to a file
2017-02-13 15:07:28 -08:00
Terence Parr aa58ba5a2e Merge pull request #1648 from bhamiltoncx/file-encoding-utf-8
Ensure unit tests are run with file.encoding=UTF-8
2017-02-13 15:06:19 -08:00
Terence Parr 3cbc2af0cc Merge pull request #1655 from lionelplessis/fix-#1298-for-csharp
Fix #1298 for CSharp
2017-02-13 10:29:47 -08:00
Terence Parr ae5250685d Merge pull request #1637 from bhamiltoncx/char-streams
Make BaseJavaTest and TestRig work with Unicode values > U+FFFF
2017-02-10 14:11:34 -08:00
Ben Hamilton 6611c1ae27 C# runtime and test harness support for writing test output to file 2017-02-10 13:37:44 -08:00
Ben Hamilton 2c447a2b75 Python 2 and Python 3 support for lexer and parser output to a file instead of stdout 2017-02-10 13:11:24 -08:00
Ben Hamilton cf3b513a58 New TestOutputReading runtime-testsuite class 2017-02-10 11:30:05 -08:00
Ben Hamilton 11aa20c5e7 Ensure tests are run with file.encoding=UTF-8 2017-02-10 11:28:06 -08:00
lionelplessis 895681044e Fix #1298 for CSharp 2017-02-10 17:55:10 +01:00
Ben Hamilton 499e44b03a Pass through source name 2017-01-30 14:16:33 -08:00
Terence Parr 3e61421e59 Merge pull request #1636 from bhamiltoncx/stream-vacuum-utf8
Consolidate multiple copies of StreamVacuum, make use UTF-8
2017-01-30 13:29:32 -08:00
Ben Hamilton 0f52b7c0d9 CharStreams 2017-01-30 10:09:56 -08:00
Ben Hamilton (Ben Gertzfield) f0947f4365 Update copyright in StreamVacuum.java 2017-01-30 09:56:02 -07:00
Ben Hamilton eb54507e42 Consolidate multiple copies of StreamVacuum, make use UTF-8 2017-01-30 08:53:09 -08:00
Ben Hamilton 2defcc3e1f Change default encoding back to 'ascii'. Specify encoding=utf-8 and errors=replace in Python2/Python3 test templates. 2017-01-30 08:45:48 -08:00
Terence Parr b4508d26b2 Merge pull request #1629 from bhamiltoncx/fix-writing-unicode-in-tests
Fix writing Unicode values in runtime tests
2017-01-29 13:02:19 -08:00
Terence Parr bd8a367398 Merge pull request #1627 from bhamiltoncx/utf8-code-point-decoder
New class UTF8CodePointDecoder
2017-01-29 12:54:58 -08:00
Terence Parr 508d2f988f Merge pull request #1626 from bhamiltoncx/new-code-point-char-stream
New class CodePointCharStream (alternative to ANTLRInputStream)
2017-01-29 12:50:44 -08:00
Terence Parr 37adfd4e30 Merge pull request #1625 from bhamiltoncx/integer-list-unicode
New method IntegerList.toCharArray()
2017-01-29 10:38:29 -08:00
Terence Parr bf4fa40ff9 Merge pull request #1606 from hanjoes/spm
Tweak Repo to use SwiftPackageManager.
2017-01-29 10:31:53 -08:00
Terence Parr f5a2b5b509 Merge pull request #1594 from wxio/master
Remove lower case formatting on Go types & super import
2017-01-29 10:31:20 -08:00
Dong Xie 95db50d540 [dotnet] target: use project reference in json instead of nupkg; fix for tests 2017-01-27 15:16:28 +00:00
Ben Hamilton 77067674b9 Fix writing Unicode values in runtime tests 2017-01-25 15:29:33 -08:00
Ben Hamilton 558aa7b011 UTF8CodePointDecoder 2017-01-24 15:23:03 -08:00
Ben Hamilton 212a948656 CodePointCharStream 2017-01-24 13:12:28 -08:00
Ben Hamilton bbf8476c8e New method IntegerList.toCharArray() 2017-01-24 11:30:50 -08:00
Dong Xie 8a08a6ed56 [csharp] dotnet test files added, test passing 2017-01-24 16:21:13 +00:00
Ben Gertzfield cf8fba0715 Look in /usr/local/bin before /usr/bin for mono 2017-01-23 14:09:28 -08:00
Hanzhou Shi 91d8d13b05 Fix travis build. 2017-01-18 23:40:56 -08:00
Johannes Kohnen 5e9ecae281 Change StringType to lower case for Go target.
*  See antlr/antlr4#1594
2017-01-11 22:36:17 +11:00
Terence Parr 9446f5f4b1 Merge pull request #1589 from sharwell/missing-header
Add missing copyright header
2017-01-07 09:54:02 -08:00
Terence Parr b8e0d543e3 Merge pull request #1588 from sharwell/test-sources
Support using the Maven plugin to generate test sources
2017-01-07 09:53:41 -08:00
Sam Harwell 73cfd0592f Add missing copyright header 2017-01-07 11:20:10 -06:00
Sam Harwell 5d4efafe8e Support using the Maven plugin to generate test sources
Fixes #1579
2017-01-07 10:58:43 -06:00
Sam Harwell bcde6f923a Reset BufferedTokenStream.fetchedEOF when calling setTokenSource
Fixes #1584
2017-01-07 09:31:11 -06:00
Sam Harwell d0cd250634 Remove the shared visitor tests
These tests were modeled after the listener tests, but were not implemented
against the standard visitor API semantics. The tests only execute in the
Node.js target, and there is no straightforward way to implement these tests
across multiple targets. New tests which cover both the traversal behavior
and the runtime semantics are now available and should be implemented by
each target.
2017-01-05 21:48:44 -06:00
Sam Harwell 8becb01b06 Add remaining visitor tests for the Java runtime API 2017-01-05 12:54:26 -06:00
Sam Harwell 4cd6156e6b Add first visitor test for Java runtime API 2017-01-05 12:40:29 -06:00
Terence Parr b57843d983 Merge pull request #1546 from sharwell/fix-1545
Fix multiple problems with optional block bypass at end of rule
2016-12-27 21:47:12 -08:00
Sam Harwell 1d066e0a6b Fix test cases affected by recent changes
See #1545
2016-12-26 17:03:51 -06:00
Sam Harwell 33613657a5 Add regression tests for #1545 2016-12-23 16:09:24 -06:00
Mike Lischke e1fb0b68c7 C++ implementation of the LR-loop optimization. 2016-12-21 09:26:08 +01:00
Mike Lischke d324e9a46b Merge branch 'master' into LR-loop-fix 2016-12-19 16:48:10 +01:00
parrt 23313ee44e [maven-release-plugin] prepare for next development iteration 2016-12-15 14:25:41 -08:00
parrt aacd2a2c95 [maven-release-plugin] prepare release 4.6 2016-12-15 14:25:36 -08:00
Ivan Kochurkin bc7678011d Removed CharSetWithReversedRange from runtime testsuite. 2016-12-15 11:08:09 -08:00
parrt e13b008626 ah. cpp should not be in main list of tests. we'll test individually. 2016-12-14 16:20:48 -08:00
parrt 484dd62a39 Merge branch 'master' of github.com:antlr/antlr4 2016-12-14 13:33:00 -08:00
parrt a68fb3a183 convert runtime URL properly to file path. 2016-12-14 13:32:21 -08:00
Terence Parr fd3bd91828 Merge pull request #1508 from janyou/Fixes-1298
Fixes #1298 for Swift target
2016-12-14 13:25:27 -08:00
parrt 8918d0f953 more C++ debugging 2016-12-14 13:17:10 -08:00
parrt 3f00594313 add debugging to C++ 2016-12-14 11:22:47 -08:00
parrt e434560015 simplify runtime test pom, add swift back in. 2016-12-14 10:33:53 -08:00
janyou 0c835a248a Fixes #1298 2016-12-14 11:58:53 +08:00
parrt a3aa610e3d get recognizer name properly. Fixes #958 2016-12-13 11:05:39 -08:00
Mike Lischke 1eeaf20aa0 Initial implementation of the LR loop optimization in the C++ target.
There is an issue with the tests. Some hang forever. Need to investigate yet.
2016-12-13 17:45:23 +01:00
Terence Parr aea034cb45 Merge pull request #1493 from ericvergnaud/realign-csharp-runtime
Realign CSharp runtime with Java runtime, implements #1441
2016-12-12 16:54:36 -08:00