Commit graph

8 commits

Author SHA1 Message Date
a20e233ca0 Library: now using controlled seed and replaced rand (closes #1378)
After augmenting our `lib/random.hpp` abstraction framework to add the necessary flexibility,
a common seeding scheme was ''built into the Test-Runner.''
 * all tests relying on some kind of randomness should invoke `seedRand()`
 * this draws a seed from the `entropyGen` — which is also documented in the log
 * individual tests can now be launched with `--seed` to force a dedicated seed
 * moreover, tests should build a coherent structure of linked generators,
   especially when running concurrently. The existing tests were adapted accordingly

All usages of `rand()` in the code base were investigated and replaced
by suitable calls to our abstraction framework; the code base is thus
isolated from the actual implementation, simplifying further adaptation.
2024-11-17 19:45:41 +01:00
0b9e184fa3 Library: replace usages of rand() in the whole code base
* most usages are drop-in replacements
 * occasionally the other convenience functions can be used
 * verify call-paths from core code to identify usages
 * ensure reseeding for all tests involving some kind of randomness...

__Note__: some tests were not yet converted,
since their usage of randomness is actually not thread-safe.
This problem existed previously, since also `rand()` is not thread safe,
albeit in most cases it is possible to ignore this problem, as
''garbled internal state'' is also somehow „random“
2024-11-13 04:23:46 +01:00
4f50cbc386 Library/Application: rework TypedCounter and tests
The existing TypedCounter_test was excessively clever and convoluted,
yet failed to test the critical elements systematically. Indeed, two
bugs were hidden in synchronisation and instance access.

- build a new concurrent test from scratch, now using the threadBenchmark
  function for the actual concurrent execution and just invoked a
  random selected access to the counter repeatedly from a large number
  of threads.

- rework the TypedContext and counter to use Atomics where applicable;
  measurements indicate however that this has only negligible impact
  on the amortised invocation times, which are around 60ns for single-threaded
  access, yet can increase by factor 100 due to contention.
2023-10-04 22:41:00 +02:00
02c5809707 Global-Layer-Renaming: adjust namespace qualification 2018-11-15 23:59:23 +01:00
2d5ebcd5fa Global-Layer-Renaming: adjust header includes 2018-11-15 23:42:43 +01:00
3395d002bd Library: helper to produce threadsafe member-IDs for a family of objects
This is a little bit of functionality needed again and again;
first I thought to use the TypedCounter, but this would be overkill,
since we do not actually need different instances, and we do not need
to select by type when incrementing the counter. In fact, we do not
even need anything beyond just allocating a number.

So I made a new class, which can be used RAII style
2017-01-14 03:07:48 +01:00
7d448be97a Rectify TypedCounter_test fixture -- Type-IDs are not stable
Hehe...
with GenNode, we started to use these global Type-IDs to generate
unique Names for unnamed Children in a diff::Record. This means,
when running in the test-suite, the TypeID for 'short' and 'long' are
likely to be allready allocated, so our Test can not not observe the
allocateion, nor is it sensible to assume fixed numbers for these Type-IDs.
Instead, we create two local types right within the test function, to force
generation of new unique type-IDs, which we can observe
2015-11-02 00:03:29 +01:00
aa17106c41 link tests with stringent application scope dependencies (closes #938)
- the tests covering threadind support and object monitors
  are located in the backend test-library and linked against liblumierabackend.so
- some fundamental facilities of proc-layer moved from the library tree
  into the basic components tree, since *testing* them requires at least
  to link against liblumieracommon.so
2014-10-17 21:15:59 +02:00
Renamed from tests/library/typed-counter-test.cpp (Browse further)