[Fuego] [PATCH] perl-xml-simple: add test case for perl-xml-simple.

Tim.Bird at sony.com Tim.Bird at sony.com
Tue Sep 11 22:39:29 UTC 2018


Looks OK. Applied.

Note, however, that on 3 of my boards, this fails, and I get the following message in my testlog:
Can't locate XML/Simple.pm in @INC (you may need to install the XML::Simple module) (@INC contains: /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base) at data/xml-simple-test line 1.
BEGIN failed--compilation aborted at data/xml-simple-test line 1.
 -> xml-simple-test01: TEST-FAIL

It might be nice to have a mechanism to detect needed perl modules, and add that to our dependency
checking system.

I will happily take a patch to do this... ;-)
 -- Tim


> -----Original Message-----
> From: Zheng Ruoqin
> 
> Signed-off-by: Zheng Ruoqin <zhengrq.fnst at cn.fujitsu.com>
> ---
>  .../data/xml-simple-test                           |  8 ++++++++
>  .../tests/Functional.perl-xml-simple/fuego_test.sh | 20
> ++++++++++++++++++++
>  engine/tests/Functional.perl-xml-simple/parser.py  | 22
> ++++++++++++++++++++++
>  .../perl-xml-simple_test.sh                        |  4 ++++
>  engine/tests/Functional.perl-xml-simple/spec.json  |  6 ++++++
>  .../tests/perl-xml-simple_01.sh                    | 15 +++++++++++++++
>  6 files changed, 75 insertions(+)
>  create mode 100644 engine/tests/Functional.perl-xml-simple/data/xml-
> simple-test
>  create mode 100644 engine/tests/Functional.perl-xml-simple/fuego_test.sh
>  create mode 100644 engine/tests/Functional.perl-xml-simple/parser.py
>  create mode 100644 engine/tests/Functional.perl-xml-simple/perl-xml-
> simple_test.sh
>  create mode 100644 engine/tests/Functional.perl-xml-simple/spec.json
>  create mode 100644 engine/tests/Functional.perl-xml-simple/tests/perl-
> xml-simple_01.sh
> 
> diff --git a/engine/tests/Functional.perl-xml-simple/data/xml-simple-test
> b/engine/tests/Functional.perl-xml-simple/data/xml-simple-test
> new file mode 100644
> index 0000000..50ff426
> --- /dev/null
> +++ b/engine/tests/Functional.perl-xml-simple/data/xml-simple-test
> @@ -0,0 +1,8 @@
> +use XML::Simple;
> +
> +my $p = {
> +      test  => "XML::Simple.test",
> +           };
> +my $x = new XML::Simple;
> +my $xml = $x->XMLout($p,NoAttr=>1);
> +print $xml;
> diff --git a/engine/tests/Functional.perl-xml-simple/fuego_test.sh
> b/engine/tests/Functional.perl-xml-simple/fuego_test.sh
> new file mode 100644
> index 0000000..205ff1b
> --- /dev/null
> +++ b/engine/tests/Functional.perl-xml-simple/fuego_test.sh
> @@ -0,0 +1,20 @@
> +function test_pre_check {
> +    is_on_target_path perl PROGRAM_PERL
> +    assert_define PROGRAM_PERL "Missing 'perl' program on target board"
> +}
> +
> +function test_deploy {
> +    put $TEST_HOME/perl-xml-simple_test.sh
> $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/
> +    put -r $TEST_HOME/data $BOARD_TESTDIR/fuego.$TESTDIR/
> +}
> +
> +function test_run {
> +    report "cd $BOARD_TESTDIR/fuego.$TESTDIR; \
> +        sh -v perl-xml-simple_test.sh"
> +}
> +
> +function test_processing {
> +    log_compare "$TESTDIR" "1" "TEST-PASS" "p"
> +    log_compare "$TESTDIR" "0" "TEST-FAIL" "n"
> +}
> diff --git a/engine/tests/Functional.perl-xml-simple/parser.py
> b/engine/tests/Functional.perl-xml-simple/parser.py
> new file mode 100644
> index 0000000..d85abd7
> --- /dev/null
> +++ b/engine/tests/Functional.perl-xml-simple/parser.py
> @@ -0,0 +1,22 @@
> +#!/usr/bin/python
> +# See common.py for description of command-line arguments
> +
> +import os, sys, collections
> +
> +sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser')
> +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/engine/tests/Functional.perl-xml-simple/perl-xml-simple_test.sh
> b/engine/tests/Functional.perl-xml-simple/perl-xml-simple_test.sh
> new file mode 100644
> index 0000000..dd5ce37
> --- /dev/null
> +++ b/engine/tests/Functional.perl-xml-simple/perl-xml-simple_test.sh
> @@ -0,0 +1,4 @@
> +#!/bin/sh
> +for i in tests/*.sh; do
> +    sh $i
> +done
> diff --git a/engine/tests/Functional.perl-xml-simple/spec.json
> b/engine/tests/Functional.perl-xml-simple/spec.json
> new file mode 100644
> index 0000000..2db39d0
> --- /dev/null
> +++ b/engine/tests/Functional.perl-xml-simple/spec.json
> @@ -0,0 +1,6 @@
> +{
> +    "testName": "Functional.perl-xml-simple",
> +    "specs": {
> +        "default": {}
> +    }
> +}
> diff --git a/engine/tests/Functional.perl-xml-simple/tests/perl-xml-
> simple_01.sh b/engine/tests/Functional.perl-xml-simple/tests/perl-xml-
> simple_01.sh
> new file mode 100644
> index 0000000..2e5e712
> --- /dev/null
> +++ b/engine/tests/Functional.perl-xml-simple/tests/perl-xml-simple_01.sh
> @@ -0,0 +1,15 @@
> +#!/bin/sh
> +
> +# In target, run script xml-simple-test.
> +# To make sure that the string "<test>XML::Simple.test</test>" is in output.
> +
> +test="xml-simple-test01"
> +
> +if perl data/xml-simple-test | grep ".*<test>XML::Simple.test</test>.*"
> +then
> +    echo " -> $test: TEST-PASS"
> +else
> +    echo " -> $test: TEST-FAIL"
> +fi;
> +
> +rm -f data/xml-simple-test
> --
> 1.8.3.1
> 
> 
> 
> _______________________________________________
> Fuego mailing list
> Fuego at lists.linuxfoundation.org
> https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lists.linuxfoundation.org_mailman_listinfo_fuego&d=DwICAg&c=fP4tf-
> -1dS0biCFlB0saz0I0kjO5v7-
> GLPtvShAo4cc&r=jjTc71ylyJg68rRxrFQuDFMMybIqPCnrHF85A-
> GzCRg&m=8qLxjeZW-_QVHxExfK0AOqMVNUGy3-ASj-
> CPPShwtGw&s=gKUGxT5LTErV7t0tSpsyYhXD9VU9yMkCu5rmVq_qQd8&e=


More information about the Fuego mailing list