Commit Graph

253 Commits

Author SHA1 Message Date
cheatfate 3569e4d553 testutils must be last executed test. 2021-02-18 22:16:04 +02:00
cheatfate 3e9ffae407 Properly fix case when request body size exceeds maximum allowed size. 2021-02-18 22:16:04 +02:00
cheatfate 970e5641d7 Add less strict rules for BoundStream reader/writer. 2021-02-18 22:16:04 +02:00
cheatfate d43a9cb92d HttpServer now supports TLS.
Some TLSStream fixes to properly support EOF.
Some HttpServer to properly support TLS handshake problems.
HttpServer test suite for HTTPS.
2021-02-18 22:16:04 +02:00
cheatfate 1a3e9162a4 Fix multipart end of message handling.
Add apps.nim.
Change copyrights dates.
Add httpserver tests to test suite.
2021-02-18 22:16:04 +02:00
cheatfate 0b396c34d8 Add newline. 2021-02-18 22:16:04 +02:00
cheatfate 2defc4b822 Add sequence of bytes as boundary to BoundStream and tests. 2021-02-18 22:16:04 +02:00
cheatfate 13eddf382d Simplification and fixes for TLSStream state machine. 2021-02-18 22:16:04 +02:00
cheatfate e8d2a3ca0a Attempt #5. 2021-02-18 22:16:04 +02:00
cheatfate 49fd70f504 Attempt #4. 2021-02-18 22:16:04 +02:00
cheatfate bb176ba574 Investigation of Linux freezes #1. 2021-02-18 22:16:04 +02:00
cheatfate ac8b11d6ca close() procedure should not raise, otherwise its impossible to cleanup. 2021-02-18 22:16:04 +02:00
cheatfate 0cb6840f03 Big refactoring of AsyncStreams.
1. Implement all read() primitives using readLoop() like it was done in streams.
2. Fix readLine() bug.
3. Add readMessage() primitive.
4. Fixing exception hierarchy, handling code and simplification of (break/continue + exception).
5. Fix TLSStream closure procedure.
6. Add BoundedStream stream and tests.
7. Remove `result` usage from the code.
2021-02-18 22:16:04 +02:00
cheatfate 46c0bf3c5a
Fix define to skip flaky test on MacOS. 2020-11-27 03:50:38 +02:00
Eugene Kabanov bca5559c6a
Race() call (#142)
* Add `race` procedure call which extends `one` with FutureBase.

* Fix race() and add test procedures.
2020-11-27 00:50:55 +02:00
Eugene Kabanov ac9b3e304f
Fix deadlock for pending write() calls on transport close. (#139)
Add tests for read() and write() deadlocks.
2020-11-18 11:30:33 +02:00
cheatfate 493cb1dbfd Fix behavior of wait() and withTimeout() calls to cancel and wait for result of cancelled Future[T].
Add tests.
2020-11-17 19:28:52 +02:00
Eugene Kabanov b5915ecd29
Small fixes (#134)
* Fix cancellation behavior.
Fix some compilation warnings.

* Fix cancelAndWait() and add proper documentation.

* Add completed(Future) and done(Future) calls to check if Future[T] completed without an error.

* Add stepsAsync() and tests.

* Fix comments.

* Fix new primitive comment, to avoid usage for task switches.
2020-11-13 14:22:58 +02:00
Eugene Kabanov d3018ae908
Fix TLSStream SSL errors while in handshake could stuck connection. (#133)
Fix expired SSL certificate in tests.
2020-10-13 02:12:52 +03:00
Eugene Kabanov 2134980744
Fix AsyncLock.locked flag to be consistent. (#129)
* Fix `locked` flag to be more consistent.
Refactor AsyncLock to not use `result`.
Add test for `locked` flag.

* Fixes.

* Fix imports.

* Fix multiple release() without scheduler.
Add more tests.

* Fix review comments.
2020-09-10 23:28:20 +03:00
Jacek Sieka 483054cda6
small fixes (#127)
* small fixes

* more efficient codegen for nil check (much less code)
* release futures earlier in AsyncEvent
* release finished future earlier in AsyncQueue
* avoid searches for futures (deque variant unused / broken)
* avoid catching defects

* Fix AsyncEvent test, because of optimization.

* delete fix

* avoid seq allocs

* Keep style consistent with other code.
Refactor AsyncEvent and AsyncQueue to not use `result` keyword.

Co-authored-by: cheatfate <eugene.kabanov@status.im>
2020-09-10 11:39:10 +03:00
Eugene Kabanov 126ea4bc56
Fix newFuture[T] location source for generated async procedures. (#125)
Add tests to for locations.
2020-09-03 14:37:53 +03:00
Eugene Kabanov a5442edfc0
Add asyncSpawn() procedure and tests. (#123)
Deprecated asyncDiscard() procedure.
Bump version to 2.5.2.
2020-09-01 21:41:18 +03:00
Zahary Karadjov 03f4a26829 Revert "yieldAsync() (#120)"
This reverts commit 284d677815.

There is no rough consensus for how this should be implemented and
whether it's needed indeed - a use case that cannot be solved with
a queue or a lock/event should be identified before pursuing this
functionality.
2020-08-16 01:48:25 +03:00
Ștefan Talpalaru 284d677815
yieldAsync() (#120) 2020-08-10 15:31:21 +02:00
cheatfate 3968f09ae1
Skip flaky test on MacOS. 2020-07-17 09:38:58 +03:00
Jacek Sieka f856c885fa
fix endian conversion issues (#82)
* fixes call to `bigEndian32` on a uint64 which breaks on big endian
platforms
* prefer endians2 for less and safer code
2020-07-12 18:22:47 +02:00
Eugene Kabanov ce6e7d17b1
Make Future tracking and stack traces optional (#108)
* Make Future tracking optional via -d:chronosDutureTracking compilation flag.
* Stack traces is now optional, use -d:chronosStackTraces.
* Fix mistypes and add test for chronosStackTrace option.
2020-07-08 19:48:01 +03:00
Eugene Kabanov 5629b3c41f
[WIP] Zero-cost unattended Future[T] tracking mechanism. (#106)
* Zero-cost unattended Future[T] tracking mechanism with tests and tracking of test suite.
2020-07-06 09:33:13 +03:00
Eugene Kabanov 16ed169f25
Fix cancellation race when low level futures are already completed, while cancellation process is pending. (#107)
Added test.
2020-07-03 15:03:59 +03:00
Eugene Kabanov 319e2bfc09
Fix Nim's issue #13899 using #14723 and add tests. (#104) 2020-06-24 13:03:36 +03:00
Eugene Kabanov 02b8da986b
Add accept() call (#103)
* Add accept() call and tests.
* Fix rare fd leaks on Windows.
* Fix compilation warnings.
* Add fd leak test.
* Bump version to 2.4.0.
2020-06-24 11:21:52 +03:00
Eugene Kabanov 2ecc5500c2
Undeprecate `or` operation. (#93)
* Undeprecate `or` operation.
Fix `or` for already finished futures.
Add tests.

* Bump version to 2.3.9.
2020-04-21 07:07:49 +03:00
Eugene Kabanov 3d745a4b0c
Fix Nim's issue #13889 https://github.com/nim-lang/Nim/issues/13889. (#90) 2020-04-06 15:49:09 +03:00
Eugene Kabanov 4e2810cfe0
Fix issue with allFinished(), allFutures(), one() behavior when Futures passed are already finished. (#89)
Added test.
2020-04-06 13:56:24 +03:00
Araq f3827a13d1 prepare nim-chronos for Nim version 1.2 2020-03-23 20:17:29 +02:00
Jacek Sieka d8f8e3d9fc
readMsg branch by @arnetheduck with some changes. (#83)
Co-authored-by: Eugene Kabanov <ka@hardcore.kiev.ua>
2020-03-05 10:59:10 +01:00
cheatfate 64583b4269
Fix Windows datagram's AnyAddress issue.
Add test for datagram's AnyAddress.
Bump version to 2.3.6.
2020-02-25 23:50:39 +02:00
cheatfate 80351cb928
Fix #73. 2020-02-12 22:54:05 +02:00
cheatfate e34857364e
Attempt to fix #64. 2020-01-28 12:47:38 +02:00
cheatfate 74700fdcab Fix bug cancellation handlers not called in wait() and withTimeout().
Fix double completion bug because of callback race.
Fix deprecation warnings.
Rename some internal procedures.
Bump version to 2.3.5.
2020-01-27 22:32:08 +02:00
cheatfate 943a961201
Enable --threads:on testing. 2019-11-01 06:42:32 +02:00
cheatfate fb00b20cfa
Fix all compilation warnings for 1.0.2.
Fix all related problems.
2019-10-29 23:19:41 +02:00
cheatfate 5f1391f39f
Fix unused imports. 2019-10-24 16:21:31 +03:00
cheatfate 29d9274e03
Fix some compilation warnings. 2019-10-24 16:01:57 +03:00
Yuriy Glukhov a291f26c82
Merge pull request #55 from status-im/tlsstream
TLS async stream.
2019-10-22 13:32:36 +03:00
cheatfate d008fa2087
Fix make serverName mandatory and check for empty serverName. 2019-10-16 09:07:46 +03:00
cheatfate a92ad6d2d2
Add TLS inbound stream.
Fix some review comments.
2019-10-16 09:01:52 +03:00
cheatfate 3b8874a9e8
Fix issue with Windows connect(0.0.0.0). 2019-10-09 15:12:19 +03:00
cheatfate c27624cfc0
Add TlsStream with client-only connections. 2019-10-08 18:46:27 +03:00
cheatfate c4a99447bd
Fix AsyncLock race and refactor asyncsync.nim to properly support cancellation.
Fix async macro to not transform nested procedures.
2019-07-17 16:12:31 +03:00
cheatfate ec7f2a14a8
Fix compilation warnings in osnet.nim
Fix non stable stream tests.
2019-07-12 10:40:18 +03:00
Eugene Kabanov cd2571e80a
Merge pull request #41 from status-im/cancellation
[WIP] Initial cancellation proposal.
2019-07-06 15:44:21 +03:00
cheatfate 8ba4fc9876
Add `awaitne` command which will have `yield` behavior in async cancellation world.
Add tests for both `await` and `awaitne`.
2019-07-06 11:16:31 +03:00
cheatfate 9c15a09904
Bump version to 2.2.7.
Attempt to fix stability of MacOS test.
2019-07-04 15:30:07 +03:00
cheatfate 43ae07f20c
Fix deprecation warning. 2019-07-04 15:13:39 +03:00
cheatfate fcfb87d2a0
Deprecate oneIndex(), oneValue(), all(), or(), and().
Add allFutures() and one().
Fix deprecation in chunkedstream.
Add tests.
2019-07-04 15:04:59 +03:00
cheatfate 43eeceb8e5
Attempt to fix macos timers. 2019-06-27 13:12:52 +03:00
cheatfate 992cc57377
Fix timeout value. 2019-06-26 15:50:40 +03:00
cheatfate 059433ccad
Add cancellation tests. 2019-06-26 15:36:01 +03:00
Eugene Kabanov 9160dcdbba
Merge pull request #37 from status-im/asyncstream
Asynchronous streams.
2019-06-06 15:05:08 +03:00
cheatfate c27c564d47
Add oneIndex(), oneValue() which are varargs `or` operation.
Fix some deprecation warnings for Nim devel.
Add tests for oneIndex(), oneValue().
2019-06-04 19:51:35 +03:00
cheatfate 317ce3c797
Ignore ECONNRESET and EPIPE errors on sending.
Add test for ECONNRESET error.
2019-05-28 09:29:00 +03:00
cheatfate 6e7a753793
Fix for Windows server close procedure. 2019-05-09 20:59:15 +03:00
cheatfate 454571f943
Fix tests to consume all the bytes from the nested stream.
Add error messages for nested exceptions.
2019-05-08 12:44:00 +03:00
cheatfate 296b8c23a5
Fix tests compilation. 2019-05-07 23:20:06 +03:00
cheatfate 1763c9dcff
Add AsyncStreams.
Add Chunked-Encoding AsyncStream reader/writer.
Add tests.
2019-05-07 23:11:40 +03:00
cheatfate 2f6b36e96d
Cleanup debug echos. 2019-04-15 11:32:58 +03:00
cheatfate bc4fa46566
Add more test vectors from `nim-libp2p`. 2019-04-15 11:30:52 +03:00
cheatfate 2c2e2f7fad
Add getInterfaces() and getBestRoute().
Add IpNet and IpMask.
Add TTL setting for UDP transports with {Broadcast}.
Fix comments.
Add tests.
Bump version to 2.2.5.
2019-04-15 04:27:12 +03:00
cheatfate 6a1f7785a0
Custom tracking mechanism.
1. Add simple tracking of Datagram and Stream transports.
2. Fix leaks in tests.
3. Add leaks tests to Datagram and Stream transport tests.
2019-04-04 12:34:23 +03:00
cheatfate d3b72dbe8b
Add broadcast feature for DatagramTransport.
Add test for it.
2019-03-31 09:18:21 +03:00
cheatfate 80ee289847
Fix rarely appearing Windows bug with close(transport).
Add tests for it.
Add fromProc for all Future[T] in transports.
Add testall to improve tests speed.
Bump version to 2.2.4.
2019-03-31 00:31:10 +02:00
Eugene Kabanov 67e214c5df Introduce monotonic timer functions. (#24)
* Introduce monotonic timer functions.
Old fast timers are available through compiler switch.
Add tests for both timers.
* Bump version to 2.2.2.
2019-03-24 10:57:36 -06:00
cheatfate c05c012d9a
Restore lost tests for all. 2019-03-15 02:54:16 +02:00
cheatfate ea3fb9629a
Fixed all() implementation. 2019-03-15 02:43:51 +02:00
Ștefan Talpalaru 685665ad21
assert() -> doAssert() 2019-03-14 04:03:32 +01:00
cheatfate eac1b1a965 Decrease number of tests. 2019-02-06 18:29:58 +02:00
Mamy Ratsimbazafy 9f15c6b752
Rebrand Asyncdispatch2 to Chronos [WIP] (#20)
* Update file headers, copyright date

* Rename files and hopefully fix nimble

* Forgot to change path in tests

* Update readme
2019-02-06 15:49:11 +01:00
Ștefan Talpalaru ce0f065e98 add "--threads:on" to tests
- reduce duplication in the Nimble "test" task
- delete test binaries
2019-01-15 17:37:51 +02:00
andri lim b6ffaf1dc7 fixes StreamTransport readOnce bug 2018-11-20 13:58:25 +07:00
cheatfate 6b009b26ef Lower number of tests for 64bit platform. 2018-11-07 22:57:54 +02:00
cheatfate e5e710854f Removal of commented code. 2018-10-28 07:55:18 +02:00
cheatfate 56537311af Decrease number of tests. 2018-10-27 21:22:56 +03:00
cheatfate de7fb4ad49 One more attempt to fix freeze. 2018-10-27 21:09:23 +03:00
cheatfate 2bc3932ae2 One more attempt to fix freezing test. 2018-10-27 20:49:36 +03:00
cheatfate 14dd1e9a8e Fix datagram test from freezing. 2018-10-27 19:17:37 +03:00
cheatfate 4df91648e3 Attempt to fix Appveyor stuck bug. 2018-10-27 17:57:41 +03:00
cheatfate 774269f2f0 Fix `sendfile` behavior on BSD/MacOSX. 2018-10-25 22:59:40 +03:00
cheatfate 8a68c66caa Fix datagram problems. 2018-10-25 18:18:36 +03:00
cheatfate 0ea8e65b2c Fix connection refused check. 2018-10-25 13:52:56 +03:00
cheatfate a4c27806ea Add AF_UNIX sockets support.
Add Windows emulation of AF_UNIX sockets via Named Pipes.
Add tests for AF_UNIX sockets.
TransportAddress object change.
2018-10-25 13:19:19 +03:00
cheatfate d2667409ea Fix overflow in timers test. 2018-10-03 03:56:16 +03:00
cheatfate da1fb97c7a Added `code` for TransportOsError exception.
Fixed bug with connect on Windows.
Added test for `Connection Refused`.
Bump version to 2.1.4.
2018-10-03 03:44:39 +03:00
cheatfate 3859aab5c6 Fix race condition, when close transport happens while writing queue is not empty. 2018-10-02 13:50:14 +03:00
cheatfate 49e965bbf4 Disable IPv6 resolve tests. 2018-09-01 02:30:53 +03:00
cheatfate 530905f276 Fix #8 and related issues, added more tests for it.
Fix Unix connection failed bug.
2018-08-24 15:20:08 +03:00
cheatfate f94cedb47b Attempt to fix macos tests. 2018-08-18 00:35:36 +03:00
cheatfate 44565b398e Improved test for #6. 2018-08-06 22:33:52 +03:00
cheatfate 9fb0eb8f36 Fix #6.
Add tests for #6.
2018-08-06 21:13:44 +03:00
cheatfate f4f98d617c Fix #9.
Add tests for #9.
Temporary disable some tests in testaddress.nim.
2018-08-06 21:12:16 +03:00
cheatfate 293f993bed Fix 32bit windows tests. 2018-07-31 13:11:47 +03:00
cheatfate 2e1f45a472 Attempt to fix stuck test on 32bit Windows. 2018-07-31 13:01:51 +03:00
cheatfate d5b887f3d8 Add more utility procedures and tests for AsyncQueue.
Bump version to 2.0.6.
2018-07-31 12:50:22 +03:00
cheatfate 40bfc25ea3 Increase timeout for VM testing. 2018-07-24 17:02:32 +03:00
cheatfate f4803c61ae Improve wait() test. 2018-07-24 16:55:51 +03:00
cheatfate 32bbbb051c Add asynchronous specific exception AsyncError.
Add AsyncTimeoutError.
Add wait[T]() procedure and tests.
Bump version to 2.0.2.
2018-07-20 11:58:01 +03:00
cheatfate 0ca2cd8e5c Fix GC issues with sending, according to latest Nim changes.
Changed datagram.nim API to allow sending parts of strings and seqs.
2018-06-15 13:54:26 +03:00
cheatfate a0c724e9d8 Fix Windows/Unix behavior on datagram CONNRESET.
Add test for CONNRESET
2018-06-15 03:28:02 +03:00
cheatfate 525aaf6837 Comment out asyncmacro2 skipStmtList().
Many changes in datagram.nim.
Fixed testdatagram.nim.
Fixed testserver.nim.
2018-06-14 09:49:59 +03:00
cheatfate 978203691e Add `var` arguments to GC procedures, to disallow runtime exceptions. 2018-06-11 23:50:45 +03:00
cheatfate d2b93f309b Fix createStreamServer[T]().
Add test for bug with createStreamServer[T]().
2018-06-11 22:54:08 +03:00
cheatfate deb22a8b4a Fix Linux. 2018-06-11 02:21:36 +03:00
cheatfate 5815897de6 Fix windows asyncLoop.
Fix OSError -> TransportOSError.
Add inherited objects initialization.
Add tests for inherited objects.
2018-06-11 02:08:17 +03:00
cheatfate 0ee9a148c7 Fix for TransportAddress resolveTAddress behavior.
Added more tests for TransportAddress.
2018-06-10 03:55:19 +03:00
cheatfate 3842120217 Temporary disable DatagramServer test. 2018-06-07 19:06:41 +03:00
cheatfate 5dd9c0b177 Fix testaddress.nim test. 2018-06-07 18:51:00 +03:00
cheatfate 6709d0b78d Added IPv6 specific test for resolveTAddress. 2018-06-07 15:05:22 +03:00
cheatfate a5be5303e3 Add resolveTAddress(string, Port) and test for it. 2018-06-07 01:15:31 +03:00
cheatfate 3eb4a00397 Fix testserver.nim according to latest API changes. 2018-06-07 00:38:13 +03:00
cheatfate 38f30e0f18 Added createStreamServer() for GC userdata types. 2018-06-07 00:29:37 +03:00
cheatfate b8e8d96f3b Fix datagram: for send/sendTo (string, seq[T]) versions.
Fix stream: for write (string, seq[T]) versions
More tests for both datagram/stream.
2018-06-05 23:21:07 +03:00
cheatfate 2e6697d0d7 Disable DatagramServer test. 2018-06-05 11:44:56 +03:00
cheatfate 6f8be9f067 Attempt to fix datagram bug. 2018-06-05 11:31:18 +03:00
cheatfate 3cb521c920 Add datagram transport utility templates send(string) send(seq[byte]).
Fix bugs in stream.nim
Add more tests for stream.nim
2018-06-05 08:51:59 +03:00
cheatfate 2b8eeef7aa Added templates write(string), write(seq[byte])
Added consume()
Added tests for write(string), write(seq[byte]), consume().
2018-06-04 19:42:54 +03:00
cheatfate a834cb1a00 Changed server behavior.
Removed pause function.
Updated testserver.
2018-06-04 12:57:17 +03:00
cheatfate ac32dd24c3 Fix compilation error in testserver.nim. 2018-06-02 17:30:36 +03:00
cheatfate 960b675d62 Changed TransportAddress API.
Introduced resolveTAddress().
Added TransportAddress tests.
2018-06-02 17:25:26 +03:00
cheatfate 6985626e1c Test teststream2 renamed to testserver.
Fix compilation errors.
2018-05-31 11:10:32 +03:00
cheatfate 027e7c02a9 Added DatagramServer.
Changed StreamServer API a bit.
Added test for DatagramServer.
2018-05-31 11:03:58 +03:00
cheatfate 6faceb3b8c Added removeCallback() test. 2018-05-30 07:35:27 +03:00
cheatfate 3fb9a91cbe Investigated Transport close bug and fixed it.
Removed old integrated tests and hexdump
Removed trailing whitespaces.
2018-05-29 12:59:39 +03:00
cheatfate e3171a132a Add more documentation.
Add (#7197) test.
2018-05-27 08:49:47 +03:00
cheatfate 9e63caf694 More tests added. 2018-05-25 23:00:32 +03:00
cheatfate a4528ab705 Add asynchronous posix signal handling.
Add signal tests.
2018-05-25 04:05:13 +03:00
cheatfate d75487948b Fix testsoon for new behavior. 2018-05-23 15:57:07 +03:00
cheatfate 0853b6a216 Add server pause/resume test. 2018-05-23 14:03:39 +03:00
cheatfate 608924d9f4 Added Future[T] tests. 2018-05-23 02:28:16 +03:00
cheatfate bd6375d97c Remove compilation hints from tests. 2018-05-23 01:44:16 +03:00
cheatfate a8212e8910 Added timers test. 2018-05-23 01:29:07 +03:00
cheatfate d28e4d0c49 Enable all tests.
Adding more iterations for UDP stream test.
Fixed bugs in TCP stream.
2018-05-22 18:21:58 +03:00
cheatfate 871af1b60d Final fix testsoon.nim for all platforms. 2018-05-22 14:08:25 +03:00
cheatfate 7330027f7e Fix testsoon.nim for 32 bit systems. 2018-05-22 13:59:47 +03:00
cheatfate fdbeddb49b Fix testsync.nim to remove unnecessary imports.
Refactored new callsoon test testsoon.nim
Replace test1.nim with testsoon.nim
2018-05-22 13:16:56 +03:00
cheatfate c220b05a4c Optimize asyncsync primitives 2018-05-22 11:51:11 +03:00
Your Name e935c7e518 Fix test file path location. 2018-05-22 01:12:30 +03:00
Your Name 23a81b6492 Refactoring, more tests. 2018-05-22 00:52:57 +03:00
Your Name 5c6c723cb9 Fix nasty GC misuse bug 2018-05-18 02:40:42 +03:00
Your Name 570467a306 Attempts to fix #01 2018-05-17 11:45:18 +03:00