From 570274e4eb69cdf1ad88eb24a54eecb3c3dc9aa0 Mon Sep 17 00:00:00 2001 From: Iustin Pop <iustin@google.com> Date: Tue, 18 Dec 2012 14:42:42 +0100 Subject: [PATCH] Add more mon-collector shell tests These test the newly-changed behaviour, and fix an inconsistency in the hs-check target (versus hs-coverage). Signed-off-by: Iustin Pop <iustin@google.com> Reviewed-by: Michele Tartara <mtartara@google.com> --- Makefile.am | 2 +- htest/cli-tests-defs.sh | 1 + htest/shelltests/htools-mon-collector.test | 38 ++++++++++++++++++++-- 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/Makefile.am b/Makefile.am index 90ad0ecac..713abd8e8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1535,7 +1535,7 @@ check-local: check-dirs $(GENERATED_FILES) .PHONY: hs-check hs-check: htest/test htest/hpc-htools htest/hpc-mon-collector $(HS_BUILT_TEST_HELPERS) - @rm -f test.tix + @rm -f *.tix ./htest/test HBINARY="./htest/hpc-htools" ./htest/offline-test.sh diff --git a/htest/cli-tests-defs.sh b/htest/cli-tests-defs.sh index b12cb853d..1facff4b8 100644 --- a/htest/cli-tests-defs.sh +++ b/htest/cli-tests-defs.sh @@ -22,6 +22,7 @@ HBINARY=${HBINARY:-./htest/hpc-htools} export TESTDATA_DIR=${TOP_SRCDIR:-.}/htest/data +export PYTESTDATA_DIR=${TOP_SRCDIR:-.}/test/data hbal() { HTOOLS=hbal $HBINARY "$@" diff --git a/htest/shelltests/htools-mon-collector.test b/htest/shelltests/htools-mon-collector.test index 1208dc182..de276e168 100644 --- a/htest/shelltests/htools-mon-collector.test +++ b/htest/shelltests/htools-mon-collector.test @@ -2,7 +2,27 @@ ./htest/hpc-mon-collector >>>= !0 -# 2. Test that the drbd collector fails parsing /dev/null +# 2. Test that standard options are accepted, both at top level +# and subcommands level +./htest/hpc-mon-collector --help +>>>= 0 + +./htest/hpc-mon-collector --help-completion +>>>= 0 + +./htest/hpc-mon-collector --version +>>>= 0 + +./htest/hpc-mon-collector drbd --help +>>>= 0 + +./htest/hpc-mon-collector drbd --help-completion +>>>= 0 + +./htest/hpc-mon-collector drbd --version +>>>= 0 + +# 3. Test that the drbd collector fails parsing /dev/null ./htest/hpc-mon-collector drbd /dev/null >>>2 Error: "" @@ -10,7 +30,21 @@ Error: "" Failed reading: versionInfo >>>= !0 -# 3. Test that the drbd collector fails parsing /dev/zero, but is not +# 4. Test that a non-existent file is correctly reported +./htest/hpc-mon-collector drbd /dev/no-such-file +>>>2/Error: reading from file: .* does not exist/ +>>>= !0 + +# 5. Test that multiple files are rejected +./htest/hpc-mon-collector drbd /dev/null /dev/null +>>>2/takes only one argument/ +>>>= !0 + +# 6. Test that a standard test file is parsed correctly +./htest/hpc-mon-collector drbd $PYTESTDATA_DIR/proc_drbd83.txt +>>>=0 + +# 7. Test that the drbd collector fails parsing /dev/zero, but is not # stuck forever printing \NUL chars ./htest/hpc-mon-collector drbd /dev/zero >>>2 -- GitLab