Improved the self-test script
Improved the self-test script

- Moved tests into a function, so that they can be easily called by
  external scripts. Ensured that the tests are only executed once.

Signed-off-by: Haru <f7976dc425bcce048120127956a7ec59259f4452@dotalux.com>

Nipol/Siesta,Nipol/Siesta,Nipol/Siesta