summaryrefslogtreecommitdiff
path: root/test/libapt/srvrecs_test.cc
Commit message (Collapse)AuthorAgeFilesLines
* Prevent GTest from flooding us with compiler warningsDavid Kalnischkies2018-05-041-3/+3
| | | | | | | | | | | | | | GTest has a bunch of undefined macros which causes the compiler to spit out warnings for each one on each test file. There isn't much we can do, so we just disable the warning for the testcases. Other warnings like sign-promo and sign-compare we can avoid by being more explicit about our expected integer constants being unsigned. As we are just changing testcases, there is no user visible change which would deserve to be noted in the changelog. Gbp-Dch: Ignore Reported-By: gcc-8
* Refactor to avoid loop/dangling gcc warningsDavid Kalnischkies2017-06-261-0/+2
| | | | Gbp-Dch: Ignore
* ensure a good clock() value for usage and testsDavid Kalnischkies2016-08-121-1/+9
| | | | | | | | | | | We use clock() as a very cheap way of getting a "random" value, but the manpage warns that this could return -1, so we should be dealing with this. Additionally, e.g. on hurd-i386 the value increases only slowly – to slow for our fast running tests for randomness hence producing the same range in both samples, so we introduce a simple busy-wait loop (as clock is counting processor time used by the program) in the test which delays the second sample just enough making our randomness a bit more predictable.
* srv test: do 100 pulls twice and compare listDavid Kalnischkies2015-09-141-27/+61
| | | | | | | The previous implementation was still a bit unstable in terms of failing at times. Lets try if we have more luck with this one. Git-Dch: Ignore
* use clock() as source for SRV randomnessDavid Kalnischkies2015-09-011-8/+16
| | | | | | | | | | | | | | | Initializing a random number generator with the time since epoch could be good enough, but reaches its limits in test code as the 100 iterations might very well happen in the same second and hence the seed number is always the same… clock() has a way lower resolution so it changes more often and not unimportant: If many users start the update at the same time it isn't to unlikely the SRV record will be ordered in the same second choosing the same for them all, but it seems less likely that the exact same clock() time has passed for them. And if I have to touch this, lets change a few other things as well to make me and/or compilers a bit happier (clang complained about the usage of a GNU extension in the testcase for example).
* Add basic (non weight adjusted) shuffling for SrvRecords selectionMichael Vogt2015-08-201-0/+33
Also add "Debug::Acquire::SrvRecs" debug option and the option "Acquire::EnableSrvRecods" to allow disabling this lookup.