[Fuego] [PATCH v2] quota: Add test cases of quota.
Wang Mingyu
wangmy at cn.fujitsu.com
Mon Mar 25 09:19:27 UTC 2019
This test case is used to display disk usage and limits.
Signed-off-by: Wang Mingyu <wangmy at cn.fujitsu.com>
---
tests/Functional.quota/fuego_test.sh | 18 ++++++++++++++++++
tests/Functional.quota/parser.py | 20 ++++++++++++++++++++
tests/Functional.quota/quota_test.sh | 4 ++++
tests/Functional.quota/spec.json | 6 ++++++
tests/Functional.quota/tests/quota_help.sh | 13 +++++++++++++
tests/Functional.quota/tests/quota_quotastats.sh | 13 +++++++++++++
6 files changed, 74 insertions(+)
create mode 100644 tests/Functional.quota/fuego_test.sh
create mode 100644 tests/Functional.quota/parser.py
create mode 100755 tests/Functional.quota/quota_test.sh
create mode 100644 tests/Functional.quota/spec.json
create mode 100644 tests/Functional.quota/tests/quota_help.sh
create mode 100644 tests/Functional.quota/tests/quota_quotastats.sh
diff --git a/tests/Functional.quota/fuego_test.sh b/tests/Functional.quota/fuego_test.sh
new file mode 100644
index 0000000..1bdf334
--- /dev/null
+++ b/tests/Functional.quota/fuego_test.sh
@@ -0,0 +1,18 @@
+function test_pre_check {
+ assert_has_program quota
+ assert_has_program quotastats
+}
+
+function test_deploy {
+ put $TEST_HOME/quota_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+ put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+ report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+ ./quota_test.sh"
+}
+
+function test_processing {
+ log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
diff --git a/tests/Functional.quota/parser.py b/tests/Functional.quota/parser.py
new file mode 100644
index 0000000..f25a608
--- /dev/null
+++ b/tests/Functional.quota/parser.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+# See common.py for description of command-line arguments
+
+import os, sys, collections
+import common as plib
+
+measurements = {}
+measurements = collections.OrderedDict()
+
+regex_string = '^ -> (.*): TEST-(.*)$'
+matches = plib.parse_log(regex_string)
+
+if matches:
+ for m in matches:
+ measurements['default.' + m[0]] = 'PASS' if m[1] == 'PASS' else 'FAIL'
+
+# split the output for each testcase
+plib.split_output_per_testcase(regex_string, measurements)
+
+sys.exit(plib.process(measurements))
diff --git a/tests/Functional.quota/quota_test.sh b/tests/Functional.quota/quota_test.sh
new file mode 100755
index 0000000..dd5ce37
--- /dev/null
+++ b/tests/Functional.quota/quota_test.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+ sh $i
+done
diff --git a/tests/Functional.quota/spec.json b/tests/Functional.quota/spec.json
new file mode 100644
index 0000000..c5b371f
--- /dev/null
+++ b/tests/Functional.quota/spec.json
@@ -0,0 +1,6 @@
+{
+ "testName": "Functional.quota",
+ "specs": {
+ "default": {}
+ }
+}
diff --git a/tests/Functional.quota/tests/quota_help.sh b/tests/Functional.quota/tests/quota_help.sh
new file mode 100644
index 0000000..b775421
--- /dev/null
+++ b/tests/Functional.quota/tests/quota_help.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# In target, run command quota.
+# option: --help
+
+test="help"
+
+if quota --help 2>&1| grep Usage
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
diff --git a/tests/Functional.quota/tests/quota_quotastats.sh b/tests/Functional.quota/tests/quota_quotastats.sh
new file mode 100644
index 0000000..aae4655
--- /dev/null
+++ b/tests/Functional.quota/tests/quota_quotastats.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+# In target, run command quotastats.
+# option: --help
+
+test="quotastats"
+
+if quotastats | grep "Kernel quota version"
+then
+ echo " -> $test: TEST-PASS"
+else
+ echo " -> $test: TEST-FAIL"
+fi;
--
1.8.3.1
More information about the Fuego
mailing list