Skip to contentSkip to conversation

bmaptool: Add test cases of command bmaptool.

PATCH New Yuan Chao 1 participant 5 messages Jun 4, 2019

lore
Share & tools
lore

Yuan Chao

author
#0 lore raw

PATCH 1/1 bmaptool: Add test cases of command bmaptool.

This is a simple test to check the option copy/help/version of command bmaptool.

---
 tests/Functional.bmaptool/bmaptool_test.sh         |  4 ++++
 tests/Functional.bmaptool/fuego_test.sh            | 18 +++++++++++++++
 tests/Functional.bmaptool/parser.py                | 20 ++++++++++++++++
 tests/Functional.bmaptool/spec.json                |  6 +++++
 tests/Functional.bmaptool/test.yaml                | 19 +++++++++++++++
 tests/Functional.bmaptool/tests/bmaptool_copy.sh   | 27 ++++++++++++++++++++++
 tests/Functional.bmaptool/tests/bmaptool_help.sh   | 13 +++++++++++
 .../Functional.bmaptool/tests/bmaptool_version.sh  | 13 +++++++++++
 8 files changed, 120 insertions(+)
 create mode 100644 tests/Functional.bmaptool/bmaptool_test.sh
 create mode 100644 tests/Functional.bmaptool/fuego_test.sh
 create mode 100644 tests/Functional.bmaptool/parser.py
 create mode 100644 tests/Functional.bmaptool/spec.json
 create mode 100644 tests/Functional.bmaptool/test.yaml
 create mode 100644 tests/Functional.bmaptool/tests/bmaptool_copy.sh
 create mode 100644 tests/Functional.bmaptool/tests/bmaptool_help.sh
 create mode 100644 tests/Functional.bmaptool/tests/bmaptool_version.sh
tests/Functional.bmaptool/bmaptool_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.bmaptool/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..0fd3249
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program bmaptool
+}
+
+function test_deploy {
+    put $TEST_HOME/bmaptool_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./bmaptool_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
+
tests/Functional.bmaptool/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.bmaptool/spec.json new file +6 -0
new file mode 100644
index 0000000..f1215b3
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.bmaptool",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.bmaptool/test.yaml new file +19 -0
new file mode 100644
index 0000000..f6a6e48
@@ -0,0 +1,19 @@
+fuego_package_version: 1
+name: Functional.bmaptool
+description: |
+        Bmaptool a tool for creating block maps (bmap) and copying disk images using bmap files.
+        This is a simple test to check the option copy/help/version of command bmaptool.
+license: BSD-3-Clause
+author: Yuan Chao <[email protected]>
+maintainer: Wang Mingyu <[email protected]>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['bmap']
+data_files:
+ - bmaptool_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
tests/Functional.bmaptool/tests/bmaptool_copy.sh new file +27 -0
new file mode 100644
index 0000000..220517e
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+#  In target, run command bmaptool, and check if copy option can execute.
+#  1) Option: copy
+
+test="bmaptool"
+
+test_file="test_bmaptool_copy"
+output_file="test_bmaptool_copy_output"
+
+if [ -f $test_file ]
+then
+    rm -f $test_file
+fi
+
+test_string="bmaptool copy success"
+echo "$test_string" > $test_file
+
+bmaptool copy --nobmap $test_file $output_file
+
+if [ "$(cat $output_file)" = "$test_string" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+rm -f $test_file $output_file
tests/Functional.bmaptool/tests/bmaptool_help.sh new file +13 -0
new file mode 100644
index 0000000..0d9950d
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command bmaptool, and check if help option can execute.
+#  1) Option: -h
+
+test="bmaptool"
+
+if bmaptool -h | grep "[uU]sage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.bmaptool/tests/bmaptool_version.sh new file +13 -0
new file mode 100644
index 0000000..a70b520
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command bmaptool, and check if version option can execute.
+#  1) Option: --version
+
+test="bmaptool"
+
+if bmaptool --version | grep "bmaptool"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
author
#1 lore raw

PATCH 1/1 cpufreq-aperf: Add test cases of command cpufreq-aperf.

This is a simple test to check the option help/once of command cpufreq-aperf.

---
 tests/Functional.cpufreq-aperf/cpufreq-aperf_test.sh |  4 ++++
 tests/Functional.cpufreq-aperf/fuego_test.sh         | 17 +++++++++++++++++
 tests/Functional.cpufreq-aperf/parser.py             | 20 ++++++++++++++++++++
 tests/Functional.cpufreq-aperf/spec.json             |  6 ++++++
 tests/Functional.cpufreq-aperf/test.yaml             | 19 +++++++++++++++++++
 .../tests/cpufreq-aperf_help.sh                      | 13 +++++++++++++
 .../tests/cpufreq-aperf_once.sh                      | 13 +++++++++++++
 7 files changed, 92 insertions(+)
 create mode 100644 tests/Functional.cpufreq-aperf/cpufreq-aperf_test.sh
 create mode 100644 tests/Functional.cpufreq-aperf/fuego_test.sh
 create mode 100644 tests/Functional.cpufreq-aperf/parser.py
 create mode 100644 tests/Functional.cpufreq-aperf/spec.json
 create mode 100644 tests/Functional.cpufreq-aperf/test.yaml
 create mode 100644 tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_help.sh
 create mode 100644 tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_once.sh
tests/Functional.cpufreq-aperf/cpufreq-aperf_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.cpufreq-aperf/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..1bf8d95
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program cpufreq-aperf
+}
+
+function test_deploy {
+    put $TEST_HOME/cpufreq-aperf_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./cpufreq-aperf_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.cpufreq-aperf/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.cpufreq-aperf/spec.json new file +6 -0
new file mode 100644
index 0000000..f8c8ced
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.cpufreq-aperf",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.cpufreq-aperf/test.yaml new file +19 -0
new file mode 100644
index 0000000..b2cf45d
@@ -0,0 +1,19 @@
+fuego_package_version: 1
+name: Functional.cpufreq-aperf
+description: |
+        Cpufreq-aperf a tool for calculating the average frequency over a time period.
+        This is a simple test to check the option help/once of command cpufreq-aperf.
+license: BSD-3-Clause
+author: Yuan Chao <[email protected]>
+maintainer: Wang Mingyu <[email protected]>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['cpu']
+data_files:
+ - cpufreq-aperf_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_help.sh new file +13 -0
new file mode 100644
index 0000000..9d78b23
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command cpufreq-aperf, and check if help option can execute.
+#  1) Option: -h
+
+test="cpufreq-aperf"
+
+if  cpufreq-aperf -h | grep "cpufreq-aperf"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_once.sh new file +13 -0
new file mode 100644
index 0000000..6a8a57d
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command cpufreq-aperf, and check if once option can execute.
+#  1) Option: -o
+
+test="cpufreq-aperf"
+
+if  cpufreq-aperf -o | grep "Average"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
author
#2 lore raw

PATCH 1/1 cpufreq-info: Add test cases of command cpufreq-info.

In reply to Yuan Chao

This is a simple test to check the option help/human/proc of command cpufreq-info.

---
 tests/Functional.cpufreq-info/cpufreq-info_test.sh   |  4 ++++
 tests/Functional.cpufreq-info/fuego_test.sh          | 17 +++++++++++++++++
 tests/Functional.cpufreq-info/parser.py              | 20 ++++++++++++++++++++
 tests/Functional.cpufreq-info/spec.json              |  6 ++++++
 tests/Functional.cpufreq-info/test.yaml              | 19 +++++++++++++++++++
 .../tests/cpufreq-info_help.sh                       | 13 +++++++++++++
 .../tests/cpufreq-info_human.sh                      | 13 +++++++++++++
 .../tests/cpufreq-info_proc.sh                       | 13 +++++++++++++
 8 files changed, 105 insertions(+)
 create mode 100644 tests/Functional.cpufreq-info/cpufreq-info_test.sh
 create mode 100644 tests/Functional.cpufreq-info/fuego_test.sh
 create mode 100644 tests/Functional.cpufreq-info/parser.py
 create mode 100644 tests/Functional.cpufreq-info/spec.json
 create mode 100644 tests/Functional.cpufreq-info/test.yaml
 create mode 100644 tests/Functional.cpufreq-info/tests/cpufreq-info_help.sh
 create mode 100644 tests/Functional.cpufreq-info/tests/cpufreq-info_human.sh
 create mode 100644 tests/Functional.cpufreq-info/tests/cpufreq-info_proc.sh
tests/Functional.cpufreq-info/cpufreq-info_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.cpufreq-info/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..44c74d6
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program cpufreq-info
+}
+
+function test_deploy {
+    put $TEST_HOME/cpufreq-info_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./cpufreq-info_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.cpufreq-info/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.cpufreq-info/spec.json new file +6 -0
new file mode 100644
index 0000000..1b09662
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.cpufreq-info",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.cpufreq-info/test.yaml new file +19 -0
new file mode 100644
index 0000000..9af91e8
@@ -0,0 +1,19 @@
+fuego_package_version: 1
+name: Functional.cpufreq-info
+description: |
+        Cpufreq-info a tool for retrieving cpufreq kernel information.
+        This is a simple test to check the option help/human/proc of command cpufreq-info.
+license: BSD-3-Clause
+author: Yuan Chao <[email protected]>
+maintainer: Wang Mingyu <[email protected]>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['cpu']
+data_files:
+ - cpufreq-info_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
tests/Functional.cpufreq-info/tests/cpufreq-info_help.sh new file +13 -0
new file mode 100644
index 0000000..619d077
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command cpufreq-info, and check if help option can execute.
+#  1) Option: -h
+
+test="cpufreq-info"
+
+if  cpufreq-info -h | grep "[uU]sage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.cpufreq-info/tests/cpufreq-info_human.sh new file +13 -0
new file mode 100644
index 0000000..421b8f0
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command cpufreq-info, and check if print is human-readable output.
+#  1) Option: -m
+
+test="cpufreq-info"
+
+if  cpufreq-info -m | grep "analyzing"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.cpufreq-info/tests/cpufreq-info_proc.sh new file +13 -0
new file mode 100644
index 0000000..b46dce3
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command cpufreq-info, and check if proc option can execute.
+#  1) Option: -o
+
+test="cpufreq-info"
+
+if  cpufreq-info -o | grep "frequency"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1
author
#3 lore raw

PATCH 1/1 cpufreq-set: Add test cases of command cpufreq-set.

In reply to Yuan Chao

This is a simple test to check the option governer/help/max_freq/min_freq of command cpufreq-set.

---
 tests/Functional.cpufreq-set/cpufreq-set_test.sh   |  4 ++++
 tests/Functional.cpufreq-set/fuego_test.sh         | 18 +++++++++++++++++
 tests/Functional.cpufreq-set/parser.py             | 20 +++++++++++++++++++
 tests/Functional.cpufreq-set/spec.json             |  6 ++++++
 tests/Functional.cpufreq-set/test.yaml             | 19 ++++++++++++++++++
 .../tests/cpufreq-set_governor.sh                  | 23 ++++++++++++++++++++++
 .../tests/cpufreq-set_help.sh                      | 13 ++++++++++++
 .../tests/cpufreq-set_max.sh                       | 19 ++++++++++++++++++
 .../tests/cpufreq-set_min.sh                       | 19 ++++++++++++++++++
 9 files changed, 141 insertions(+)
 create mode 100644 tests/Functional.cpufreq-set/cpufreq-set_test.sh
 create mode 100644 tests/Functional.cpufreq-set/fuego_test.sh
 create mode 100644 tests/Functional.cpufreq-set/parser.py
 create mode 100644 tests/Functional.cpufreq-set/spec.json
 create mode 100644 tests/Functional.cpufreq-set/test.yaml
 create mode 100644 tests/Functional.cpufreq-set/tests/cpufreq-set_governor.sh
 create mode 100644 tests/Functional.cpufreq-set/tests/cpufreq-set_help.sh
 create mode 100644 tests/Functional.cpufreq-set/tests/cpufreq-set_max.sh
 create mode 100644 tests/Functional.cpufreq-set/tests/cpufreq-set_min.sh
tests/Functional.cpufreq-set/cpufreq-set_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.cpufreq-set/fuego_test.sh new file +18 -0
new file mode 100644
index 0000000..0eeab9c
@@ -0,0 +1,18 @@
+function test_pre_check {
+    assert_has_program cpufreq-info
+    assert_has_program cpufreq-set
+}
+
+function test_deploy {
+    put $TEST_HOME/cpufreq-set_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./cpufreq-set_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.cpufreq-set/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.cpufreq-set/spec.json new file +6 -0
new file mode 100644
index 0000000..86a78b9
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.cpufreq-set",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.cpufreq-set/test.yaml new file +19 -0
new file mode 100644
index 0000000..d96c15d
@@ -0,0 +1,19 @@
+fuego_package_version: 1
+name: Functional.cpufreq-set
+description: |
+        Cpufreq-set a tool for modifying cpufreq settings.
+        This is a simple test to check the option governer/help/max_freq/min_freq of command cpufreq-set.
+license: BSD-3-Clause
+author: Yuan Chao <[email protected]>
+maintainer: Wang Mingyu <[email protected]>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['cpu']
+data_files:
+ - cpufreq-set_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
tests/Functional.cpufreq-set/tests/cpufreq-set_governor.sh new file +23 -0
new file mode 100644
index 0000000..64aa467
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+#  In target, run command cpufreq-set, and check if governor can be set.
+#  1) Option: -g
+
+test="cpufreq-set"
+
+governor=$(cpufreq-info -p | cut -d ' ' -f 3)
+test_gov=$(cpufreq-info -g | cut -d ' ' -f 1)
+if [ "$test_gov" = "$governor" ]
+then
+    test_gov=$(cpufreq-info -g | cut -d ' ' -f 2)
+fi
+cpufreq-set -g $test_gov
+
+if [ "$(cpufreq-info -p | cut -d ' ' -f 3)" = "$test_gov" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+cpufreq-set -g $governor
tests/Functional.cpufreq-set/tests/cpufreq-set_help.sh new file +13 -0
new file mode 100644
index 0000000..e5e47e3
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+#  In target, run command cpufreq-set, and check if help option can execute.
+#  1) Option: -h
+
+test="cpufreq-set"
+
+if  cpufreq-set -h | grep "[uU]sage"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.cpufreq-set/tests/cpufreq-set_max.sh new file +19 -0
new file mode 100644
index 0000000..65298dc
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#  In target, run command cpufreq-set, and check if maximum frequency can be set.
+#  1) Option: -u
+
+test="cpufreq-set"
+
+max_freq=$(cpufreq-info -p | cut -d ' ' -f 2)
+test_freq=$(($max_freq - 10000))
+cpufreq-set -u $test_freq
+
+if [ $(cpufreq-info -p | cut -d ' ' -f 2) = "$test_freq" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+cpufreq-set -u $max_freq
tests/Functional.cpufreq-set/tests/cpufreq-set_min.sh new file +19 -0
new file mode 100644
index 0000000..5095371
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+#  In target, run command cpufreq-set, and check if minimum frequency can be set.
+#  1) Option: -d
+
+test="cpufreq-set"
+
+min_freq=$(cpufreq-info -p | cut -d ' ' -f 1)
+test_freq=$(($min_freq + 10000))
+cpufreq-set -d $test_freq
+
+if [ $(cpufreq-info -p | cut -d ' ' -f 1) = "$test_freq" ]
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
+
+cpufreq-set -d $min_freq
Signature · 1 line
1.8.3.1
author
#4 lore raw

PATCH 1/1 devmem2: Add test cases of command devmem2.

In reply to Yuan Chao

This is a simple test to check the read/write memory address function of command devmem2.

---
 tests/Functional.devmem2/devmem2_test.sh        |  4 ++++
 tests/Functional.devmem2/fuego_test.sh          | 17 +++++++++++++++++
 tests/Functional.devmem2/parser.py              | 20 ++++++++++++++++++++
 tests/Functional.devmem2/spec.json              |  6 ++++++
 tests/Functional.devmem2/test.yaml              | 19 +++++++++++++++++++
 tests/Functional.devmem2/tests/devmem2_read.sh  | 15 +++++++++++++++
 tests/Functional.devmem2/tests/devmem2_write.sh | 17 +++++++++++++++++
 7 files changed, 98 insertions(+)
 create mode 100644 tests/Functional.devmem2/devmem2_test.sh
 create mode 100644 tests/Functional.devmem2/fuego_test.sh
 create mode 100644 tests/Functional.devmem2/parser.py
 create mode 100644 tests/Functional.devmem2/spec.json
 create mode 100644 tests/Functional.devmem2/test.yaml
 create mode 100644 tests/Functional.devmem2/tests/devmem2_read.sh
 create mode 100644 tests/Functional.devmem2/tests/devmem2_write.sh
tests/Functional.devmem2/devmem2_test.sh new file +4 -0
new file mode 100644
index 0000000..dd5ce37
@@ -0,0 +1,4 @@
+#!/bin/sh
+for i in tests/*.sh; do
+    sh $i
+done
tests/Functional.devmem2/fuego_test.sh new file +17 -0
new file mode 100644
index 0000000..8e8de03
@@ -0,0 +1,17 @@
+function test_pre_check {
+    assert_has_program devmem2
+}
+
+function test_deploy {
+    put $TEST_HOME/devmem2_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/
+    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
+}
+
+function test_run {
+    report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\
+    ./devmem2_test.sh"
+}
+
+function test_processing {
+    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
+}
tests/Functional.devmem2/parser.py new file +20 -0
new file mode 100644
index 0000000..f25a608
@@ -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))
tests/Functional.devmem2/spec.json new file +6 -0
new file mode 100644
index 0000000..b20f4db
@@ -0,0 +1,6 @@
+{
+    "testName": "Functional.devmem2",
+    "specs": {
+        "default": {}
+    }
+}
tests/Functional.devmem2/test.yaml new file +19 -0
new file mode 100644
index 0000000..0853ddf
@@ -0,0 +1,19 @@
+fuego_package_version: 1
+name: Functional.devmem2
+description: |
+        Devmem2 a tool to read/write from/to any location in memory.
+        This is a simple test to check the read/write memory address function of command devmem2.
+license: BSD-3-Clause
+author: Yuan Chao <[email protected]>
+maintainer: Wang Mingyu <[email protected]>
+version: 1.00
+fuego_release: 1
+type: Functional
+tags: ['memory']
+data_files:
+ - devmem2_test.sh
+ - fuego_test.sh
+ - parser.py
+ - spec.json
+ - test.yaml
+ - tests
tests/Functional.devmem2/tests/devmem2_read.sh new file +15 -0
new file mode 100644
index 0000000..1ba4452
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#  In target, run command devmem2, and check if read address function can execute.
+#  1) Option: none
+
+test="devmem2"
+
+test_address="0x90000000"
+
+if devmem2 $test_address | grep "$test_address"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
tests/Functional.devmem2/tests/devmem2_write.sh new file +17 -0
new file mode 100644
index 0000000..4019a0e
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#  In target, run command devmem2, and check if write address function can execute.
+#  1) Option: none
+
+test="devmem2"
+
+test_address="0x90000000"
+write_type="halfword"
+write_value="0x1234"
+
+if devmem2 $test_address $write_type $write_value| grep "readback"
+then
+    echo " -> $test: TEST-PASS"
+else
+    echo " -> $test: TEST-FAIL"
+fi
Signature · 1 line
1.8.3.1