Return-Path: From: Yuan Chao Date: Tue, 4 Jun 2019 02:46:59 -0400 Message-ID: <20190604064702.2096-2-yuanc.fnst@cn.fujitsu.com> In-Reply-To: <20190604064702.2096-1-yuanc.fnst@cn.fujitsu.com> References: <20190604064702.2096-1-yuanc.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH] cpufreq-aperf: Add test cases of command cpufreq-aperf. List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org This is a simple test to check the option help/once of command cpufreq-aperf. Signed-off-by: Yuan Chao --- 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 diff --git a/tests/Functional.cpufreq-aperf/cpufreq-aperf_test.sh b/tests/Functional.cpufreq-aperf/cpufreq-aperf_test.sh new file mode 100644 index 0000000..dd5ce37 --- /dev/null +++ b/tests/Functional.cpufreq-aperf/cpufreq-aperf_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done diff --git a/tests/Functional.cpufreq-aperf/fuego_test.sh b/tests/Functional.cpufreq-aperf/fuego_test.sh new file mode 100644 index 0000000..1bf8d95 --- /dev/null +++ b/tests/Functional.cpufreq-aperf/fuego_test.sh @@ -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" +} diff --git a/tests/Functional.cpufreq-aperf/parser.py b/tests/Functional.cpufreq-aperf/parser.py new file mode 100644 index 0000000..f25a608 --- /dev/null +++ b/tests/Functional.cpufreq-aperf/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.cpufreq-aperf/spec.json b/tests/Functional.cpufreq-aperf/spec.json new file mode 100644 index 0000000..f8c8ced --- /dev/null +++ b/tests/Functional.cpufreq-aperf/spec.json @@ -0,0 +1,6 @@ +{ + "testName": "Functional.cpufreq-aperf", + "specs": { + "default": {} + } +} diff --git a/tests/Functional.cpufreq-aperf/test.yaml b/tests/Functional.cpufreq-aperf/test.yaml new file mode 100644 index 0000000..b2cf45d --- /dev/null +++ b/tests/Functional.cpufreq-aperf/test.yaml @@ -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 +maintainer: Wang Mingyu +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 diff --git a/tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_help.sh b/tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_help.sh new file mode 100644 index 0000000..9d78b23 --- /dev/null +++ b/tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_help.sh @@ -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 diff --git a/tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_once.sh b/tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_once.sh new file mode 100644 index 0000000..6a8a57d --- /dev/null +++ b/tests/Functional.cpufreq-aperf/tests/cpufreq-aperf_once.sh @@ -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 -- 1.8.3.1