[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] NTP client integration with MirageOS / Mini-OS



On 8 September 2016 at 11:53, Hannes Mehnert <hannes@xxxxxxxxxxx> wrote:
> On 08/09/2016 11:28, Thomas Leonard wrote:
>> On 7 September 2016 at 15:26, Hannes Mehnert <hannes@xxxxxxxxxxx> wrote:
>>> On 22/08/2016 15:16, Thomas Leonard wrote:
>>
>> [ running a test clock at a multiple of the real clock's speed ]
>>
>>>> Right, but this is a hack because we don't have internal state. It
>>>> runs slower that it could (it's still waiting, just for less time) and
>>>> may fail due to timeouts if the real system is under load (or just
>>>> slow). With state, the clock could be set to whatever the unit-tests
>>>> want the time to be, allowing the tests to run at the full speed of
>>>> the CPU and without the behaviour depending on the load.
>>>
>>> I cannot follow, need to see code.
>>
>> I've made a simpler version of the CueKeeper test code I posted earlier:
>>
>>   https://github.com/talex5/mirage-clock-test
>
> Interesting, thanks!  But this still uses the old MirageOS API (<=V2),
> and includes lots of mutable state.
>
> That somehow indicates that even with the earlier API you can do the
> testing you want (without callouts to Unix.sleep/Lwt_unix.sleep)!?
> Which makes me even more confused, since I understood your argument
> above that this is not possible!?

(I previously said "MCLOCK might have internal state for testing,
although a global would work there too if necessary.")

So yes, using a global works too. You just have to remember to call
`reset` at the start of each test to reset the global state (and you
can only have one test clock).

It would also be possible to use first-class modules to generate new
clocks without changing the signature.


-- 
talex5 (GitHub/Twitter)        http://roscidus.com/blog/
GPG: 5DD5 8D70 899C 454A 966D  6A51 7513 3C8F 94F6 E0CC
GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA

_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.