testbench: make more reliable shutdown

so far, we checked only the main queue size to become zero, ignoring
the sizes of action queues. For some tests, this caused racieness and
unreliability. Now, we check all queues. This should make matters
much more stable.
regression fix: invalid ptr was passed

happend by merging patches this morning, never released
Merge branch 'v7-stable' into v8-stable