Commit Graph

318 Commits

Author SHA1 Message Date
Pietro Gagliardi 637c7a7e2c Oops 2019-05-10 21:36:38 -04:00
Pietro Gagliardi 07dc3ee025 Finished the test set implementation, moving the tester itself to use it. This also moves uiInit() into main(); in TestInit, we'll hook into uiInit() to avoid actually doing the initialization. 2019-05-10 21:16:29 -04:00
Pietro Gagliardi 7f986ef073 Started adding more flexible test set functionality. 2019-05-09 22:54:14 -04:00
Pietro Gagliardi bc0d3120c8 Added verbosity to the test suite. Now we can move on. 2019-05-05 15:59:59 -04:00
Pietro Gagliardi 3ebc58a5bf Fixed build issues in MinGW-w64. 2019-05-05 15:20:54 -04:00
Pietro Gagliardi b7f06074fb Converted testing.c to buffer test output. Also reordered test logs to be after the status line, like in Go. Now we can add verbosity control, and then maybe later even subtests! 2019-05-05 14:26:38 -04:00
Pietro Gagliardi 8b70e6d247 Cleaned up internal helper functions in testing.c, including adding one for vsnprintf() and snprintf(). This is the first step toward buffering test output and adding verbosity control. 2019-05-05 13:35:07 -04:00
Pietro Gagliardi d49f8ae7e6 Switched the macOS code to use timerprivInt128ToUint64(). Also rearranged the arguments of timerprivInt128ToInt64() and added proper timerDurationMin/Max constants instead of the incorrect-for-that-function timerTimeMin/Max in the Windows code. 2019-05-05 11:16:17 -04:00
Pietro Gagliardi ff803bf792 And implemented 128-bit muldiv on Windows. 2019-05-05 11:03:17 -04:00
Pietro Gagliardi 288c74b026 Implemented the new MulDiv128 stuff on macOS. To make things easier in regards to signedness, this implementation also uses a base, like the Unix one, and the mach_timebase_info() conversion is done in timerMonotonicTime() instead. (Also added the admittedly-redundant-since-the-current(ish)-implementation-cannot-fail error check to mach_timebase_info().) As a result, timerTimeSub() can now be end - start on all platforms. Also found and fixed bugs in the actual muldiv128 algorithm implementation. Next up: Windows. 2019-05-05 03:17:11 -04:00
Pietro Gagliardi 952b36b1c2 Added proper 128-bit muldiv() stuff for macOS and Windows. Will actually use them next. Also fixed compiling on non-Windows. 2019-05-05 02:17:11 -04:00
Pietro Gagliardi ee3e587ddc Fixed build errors on Windows. 2019-05-04 21:47:04 -04:00
Pietro Gagliardi 98093ed46e Formatted test results across multiple lines in the same way as in Go. Also prettyprinted diffs in initmain.c. 2019-05-04 21:13:47 -04:00
Pietro Gagliardi 4c097f93f7 Implemented error checks in test/initmain.c. 2019-05-04 19:21:57 -04:00
Pietro Gagliardi 09e98af110 Removed a stale TODO caused by inaccurate timer code (that was in response to the old clock()-based Unix code). 2019-05-04 19:04:32 -04:00
Pietro Gagliardi 00411a4d07 Moved all the test infrasturcture files into a subdirectory of test/ called lib/. 2019-05-04 16:53:54 -04:00
Pietro Gagliardi 57abc83fe3 And split all the thread stuff into their own file. Almost done with all this test library cleanup! 2019-05-04 16:47:56 -04:00
Pietro Gagliardi 89e882c4a8 And fixed build errors on non-macOS systems. We're good! 2019-05-04 14:44:29 -04:00
Pietro Gagliardi bfd608cf8e And of course setitimer() doesn't allow us to override the struct sigvalue, so we can't chain out to outer SIGALRM calls. Hooray for global state! 2019-05-04 14:31:33 -04:00
Pietro Gagliardi 5836a2a236 Ugh, macOS doesn't support timer_create() and friends :| (Even up to 10.13, it seems; not sure about 10.14!) Switch back to setitimer(). Also rename oldsig to prevSig and remove a needless (for now???) cast. 2019-05-04 14:24:22 -04:00
Pietro Gagliardi 8655bbf19c Finished porting over the timer functions from testing_darwinunix.c to timer_darwinunix.c. This also includes changing timerRunWIthTimeout() from using setitimer() to using timer_create() and friends, and removing the fallbacks from timerSleep().
Also fixed a possible incorrect use of TlsSetValue() in the Windows code that I spotted while writing an intermediate version of the Unix code.
2019-05-04 12:13:07 -04:00
Pietro Gagliardi 6a25efce63 Started writing the new timer_darwinunix.c file; implemented the monotonic time functions for now. On non-macOS, we now require clock_gettime() to be successful, as GLib also does (at least as far back as the version that ships with Ubuntu 14.04); we also gather the time at first call and use that as the basis for returning a single integer from timerMonotonicNow(), so timerTimeSub() is a simple subtraction now. The logic for this conversion is based on the logic of timevalsub() in macOS's sys/time.h, though this is really simple to understand. 2019-05-03 23:03:38 -04:00
Pietro Gagliardi e9fd8cc878 And made timerRunWithTimeout() use the non-reentrant code on all architectures. Windows code done. 2019-05-03 10:41:27 -04:00
Pietro Gagliardi 020cabc61e Fixed build issues. Now to fix runtime issues: we'll have to use reentrancy everywhere, because rcx is clobbered by GetMessage(). 2019-05-03 10:32:31 -04:00
Pietro Gagliardi dbfea28313 And finished adjusting the tests accordingly. Now to test. 2019-05-03 02:02:20 -04:00
Pietro Gagliardi e2baa5bb5c And finished rewriting timerRunWithTimeout() on Windows, including reentrancy improvements, race condition elimination, setjmp() volatility correctness fixes, and global state reduction. 2019-05-03 01:54:26 -04:00
Pietro Gagliardi 8b5b03794c Started moving testingRunWithTimeout() into timer.h. 2019-05-02 23:15:49 -04:00
Pietro Gagliardi 313f5864f5 Fixed the timer functions on Windows. 2019-05-02 22:03:57 -04:00
Pietro Gagliardi 42623f92e9 And started breaking apart the timer functions. 2019-05-02 12:38:59 -04:00
Pietro Gagliardi 5537e823ef Started splitting out the timer stuff into its own mini-library. Also I decided to drop the fallback stuff, since we run on new enough systems anyway, and nanosleep() is available on every version of macOS we need anyway. 2019-05-02 12:14:08 -04:00
Pietro Gagliardi 99a0f9084c Fixed building on Ubuntu Trusty. 2019-05-02 02:01:42 -04:00
Pietro Gagliardi 796a9cf010 Resolved some TODOs in testing_darwinunix.c, including writing a more elaborate implementation of testingSleep(). 2019-04-30 21:00:52 -04:00
Pietro Gagliardi 7d29c4346d Decided not to make the thread functions report errors to the testingT object; I'm still not a big fan of the thread model here, but I'd like to actually split the thread functions out of the testing library entirely, since they are only used for the tests in initmain.c. 2019-04-30 13:15:36 -04:00
Pietro Gagliardi 25d4021269 Resolved timer/duration variable name TODO. 2019-04-30 09:32:48 -04:00
Pietro Gagliardi 965dec0157 Settled the PostThreadMessage() TODOs in the Windows testing code. 2019-04-30 02:31:08 -04:00
Pietro Gagliardi 848c3813ee Cleaned up the error handling in the Windows testing code by also creating HRESULT functions for whatever it calls. This resolves a bunch of the TODOs in that file. 2019-04-30 01:18:48 -04:00
Pietro Gagliardi db6b6fd97b Provided a mechanism for the testing library to abort on an internal error; redefined memory allocation to do so. This will also be used for resolving many of the TODOs on the Windows testing code. 2019-04-29 23:46:08 -04:00
Pietro Gagliardi 05af10aade Added ARM64 to the CPU-specific Windows testing code. 2019-04-29 22:34:28 -04:00
Pietro Gagliardi 2282ee2cf8 Removed TODOs about overflow; we really can't handle overflow properly anyway, so eh. 2019-04-29 00:18:26 -04:00
Pietro Gagliardi f948c30a3b Simplified testingTimerNsec() on Windows. _div128() would make this super simple, but that's only available on VS2019, and it seems no one has implemented this in software elsewhere (the most I can find are unsigned ones...). 2019-04-28 23:20:01 -04:00
Pietro Gagliardi 3257710fb7 Fixed bad timers on GTK+ tests. Turns out that clock() doesn't count when the process isn't actively running code (for instance, if it's waiting for I/O) :| 2019-04-28 21:49:54 -04:00
Pietro Gagliardi 74468bb38f And implemented the multithreading stuff on Unix and Darwin. We can finally continue re-adding stuff to libui! 2019-04-28 21:22:11 -04:00
Pietro Gagliardi df8eadb980 And added the multithreaded uiQueueMain() tests. 2019-04-28 20:45:53 -04:00
Pietro Gagliardi 6c41fb712e More notes. 2019-04-28 19:11:52 -04:00
Pietro Gagliardi 74ca863c1b More TODOs. 2019-04-28 19:07:41 -04:00
Pietro Gagliardi 5fb4e4403e And implemented testingRunWithTimeout() on Windows. All tests currently pass on all platforms! Woo! 2019-04-28 19:04:27 -04:00
Pietro Gagliardi 8ffb2b1b1e Fixed build warnings and errors. Now we just need to implement testingRunWithTimeout() on Windows. 2019-04-28 16:35:25 -04:00
Pietro Gagliardi 49bde22f81 More TODOs. 2019-04-28 14:54:33 -04:00
Pietro Gagliardi bdf80516c5 Reimplemented uiMain() and friends on GTK+. 2019-04-28 14:52:39 -04:00
Pietro Gagliardi b20bf2d1c9 Wrote TestQueueMain_Sequence. 2019-04-28 14:41:30 -04:00