Move test package name space to "stack" and move helper function to a separate file.

This is to make Go coverage introduce in version 1.2 play nicely, as it does
not work (as of yet at least) with multiple packages.

Signed-off-by: Krzysztof Wilczynski <krzysztof.wilczynski@linux.com>