diff options
author | Carlos Goncalves <carlos.goncalves@neclab.eu> | 2016-11-30 13:08:20 +0000 |
---|---|---|
committer | Carlos Goncalves <carlos.goncalves@neclab.eu> | 2016-12-14 16:12:13 +0000 |
commit | 18651c07b942abf0060e6478758050dd365619eb (patch) | |
tree | 201428ea4fc2a2f1eeb2e5dda0ffd5f0b050a904 /tests/lib/inspector | |
parent | 40cba233d16e355b078e368772ad4aadbb5f91b1 (diff) |
Refactor inspectors support code
JIRA: DOCTOR-71
Change-Id: I0913d4d0390325cc0cc715572b7525a6bbb795d3
Signed-off-by: Carlos Goncalves <carlos.goncalves@neclab.eu>
Diffstat (limited to 'tests/lib/inspector')
-rw-r--r-- | tests/lib/inspector | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/lib/inspector b/tests/lib/inspector new file mode 100644 index 00000000..2fb7c409 --- /dev/null +++ b/tests/lib/inspector @@ -0,0 +1,30 @@ +#!/bin/bash + +INSPECTOR_TYPE=${INSPECTOR_TYPE:-sample} + +function is_inspector_supported { + local inspector="$1" + [[ -f $TOP_DIR/lib/inspectors/$inspector ]] +} + +function is_inspector { + local inspector="$1" + [[ $inspector == $INSPECTOR_TYPE ]] +} + +function start_inspector { + if ! is_inspector_supported $INSPECTOR_TYPE; then + die $LINENO"INSPECTOR_TYPE=$INSPECTOR_TYPE is not supported." + fi + + source $TOP_DIR/lib/inspectors/$INSPECTOR_TYPE + start_inspector_$INSPECTOR_TYPE +} + +function stop_inspector { + stop_inspector_$INSPECTOR_TYPE +} + +function cleanup_inspector { + cleanup_inspector_$INSPECTOR_TYPE +} |