Return-Path: From: Wang Mingyu Date: Fri, 15 Mar 2019 06:55:34 -0700 Message-ID: <1552658136-65154-8-git-send-email-wangmy@cn.fujitsu.com> In-Reply-To: <1552658136-65154-1-git-send-email-wangmy@cn.fujitsu.com> References: <1552658136-65154-1-git-send-email-wangmy@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain Subject: [Fuego] [PATCH v2] libxml: Add test cases for command xmlcatalog/xmllint of libxml. List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org The libxml library is used to parse XML files. This test set is used to parse and manipulate XML or SGML files. Signed-off-by: Wang Mingyu --- tests/Functional.libxml/fuego_test.sh | 18 ++++++++++++ tests/Functional.libxml/libxml_test.sh | 4 +++ tests/Functional.libxml/parser.py | 20 ++++++++++++++ tests/Functional.libxml/spec.json | 6 ++++ tests/Functional.libxml/tests/xmlcatalog_create.sh | 13 +++++++++ tests/Functional.libxml/tests/xmlcatalog_debug.sh | 17 ++++++++++++ tests/Functional.libxml/tests/xmlcatalog_help.sh | 13 +++++++++ tests/Functional.libxml/tests/xmllint_checkxml.sh | 32 ++++++++++++++++++++++ tests/Functional.libxml/tests/xmllint_debug.sh | 32 ++++++++++++++++++++++ tests/Functional.libxml/tests/xmllint_format.sh | 19 +++++++++++++ tests/Functional.libxml/tests/xmllint_noout.sh | 32 ++++++++++++++++++++++ 11 files changed, 206 insertions(+) create mode 100644 tests/Functional.libxml/fuego_test.sh create mode 100755 tests/Functional.libxml/libxml_test.sh create mode 100644 tests/Functional.libxml/parser.py create mode 100644 tests/Functional.libxml/spec.json create mode 100644 tests/Functional.libxml/tests/xmlcatalog_create.sh create mode 100644 tests/Functional.libxml/tests/xmlcatalog_debug.sh create mode 100644 tests/Functional.libxml/tests/xmlcatalog_help.sh create mode 100644 tests/Functional.libxml/tests/xmllint_checkxml.sh create mode 100644 tests/Functional.libxml/tests/xmllint_debug.sh create mode 100644 tests/Functional.libxml/tests/xmllint_format.sh create mode 100644 tests/Functional.libxml/tests/xmllint_noout.sh diff --git a/tests/Functional.libxml/fuego_test.sh b/tests/Functional.libxml/fuego_test.sh new file mode 100644 index 0000000..0bb514d --- /dev/null +++ b/tests/Functional.libxml/fuego_test.sh @@ -0,0 +1,18 @@ +function test_pre_check { + assert_has_program xmlcatalog PROGRAM_XMLCATALOG + assert_has_program xmllint PROGRAM_XMLLINT +} + +function test_deploy { + put $TEST_HOME/libxml_test.sh $BOARD_TESTDIR/fuego.$TESTDIR/ + put -r $TEST_HOME/tests $BOARD_TESTDIR/fuego.$TESTDIR/ +} + +function test_run { + report "cd $BOARD_TESTDIR/fuego.$TESTDIR;\ + ./libxml_test.sh" +} + +function test_processing { + log_compare "$TESTDIR" "0" "TEST-FAIL" "n" +} diff --git a/tests/Functional.libxml/libxml_test.sh b/tests/Functional.libxml/libxml_test.sh new file mode 100755 index 0000000..dd5ce37 --- /dev/null +++ b/tests/Functional.libxml/libxml_test.sh @@ -0,0 +1,4 @@ +#!/bin/sh +for i in tests/*.sh; do + sh $i +done diff --git a/tests/Functional.libxml/parser.py b/tests/Functional.libxml/parser.py new file mode 100644 index 0000000..f25a608 --- /dev/null +++ b/tests/Functional.libxml/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.libxml/spec.json b/tests/Functional.libxml/spec.json new file mode 100644 index 0000000..a610acb --- /dev/null +++ b/tests/Functional.libxml/spec.json @@ -0,0 +1,6 @@ +{ + "testName": "Functional.libxml", + "specs": { + "default": {} + } +} diff --git a/tests/Functional.libxml/tests/xmlcatalog_create.sh b/tests/Functional.libxml/tests/xmlcatalog_create.sh new file mode 100644 index 0000000..f9426d1 --- /dev/null +++ b/tests/Functional.libxml/tests/xmlcatalog_create.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# In the target to execute command xmlcatalog and confirm the result. +# option : --create + +test="xmlcatalog2" + +if xmlcatalog --create | grep "DTD" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/tests/Functional.libxml/tests/xmlcatalog_debug.sh b/tests/Functional.libxml/tests/xmlcatalog_debug.sh new file mode 100644 index 0000000..0cd8329 --- /dev/null +++ b/tests/Functional.libxml/tests/xmlcatalog_debug.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# In the target to execute command xmlcatalog and confirm the result. +# option : --create,--verbose + +test="xmlcatalog3" + +xmlcatalog --create > catalog +xmlcatalog --verbose catalog > log 2>&1 +if cat log | grep "Catalogs cleanup" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +rm -f catalog +rm log diff --git a/tests/Functional.libxml/tests/xmlcatalog_help.sh b/tests/Functional.libxml/tests/xmlcatalog_help.sh new file mode 100644 index 0000000..7e1b1a8 --- /dev/null +++ b/tests/Functional.libxml/tests/xmlcatalog_help.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# In the target to execute command xmlcatalog and confirm the result. +# option : --help + +test="xmlcatalog1" + +if xmlcatalog --help | grep "Usage" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi diff --git a/tests/Functional.libxml/tests/xmllint_checkxml.sh b/tests/Functional.libxml/tests/xmllint_checkxml.sh new file mode 100644 index 0000000..1cafb57 --- /dev/null +++ b/tests/Functional.libxml/tests/xmllint_checkxml.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# In the target to execute command xmllint and confirm the result. +# option : none + +test="xmllint1" + +cat >> sample01.xml < + + + + + +]> + + + + favorit + interest + + +EOF + +if xmllint sample01.xml +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +rm sample01.xml diff --git a/tests/Functional.libxml/tests/xmllint_debug.sh b/tests/Functional.libxml/tests/xmllint_debug.sh new file mode 100644 index 0000000..6822234 --- /dev/null +++ b/tests/Functional.libxml/tests/xmllint_debug.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# In the target to execute command xmllint and confirm the result. +# option : --debug + +test="xmllint3" + +cat >> sample01.xml < + + + + + +]> + + + + favorit + interest + + +EOF + +if xmllint --debug sample01.xml | grep ".*DTD.*linux.*" +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +rm sample01.xml diff --git a/tests/Functional.libxml/tests/xmllint_format.sh b/tests/Functional.libxml/tests/xmllint_format.sh new file mode 100644 index 0000000..c2ea653 --- /dev/null +++ b/tests/Functional.libxml/tests/xmllint_format.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# In the target to execute command xmllint and confirm the result. +# option : --format + +test="xmllint4" + +cat >> format.xml <DOCUMENT +TEXT +EOF + +if xmllint --format format.xml | wc -l | grep 11 +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +rm format.xml diff --git a/tests/Functional.libxml/tests/xmllint_noout.sh b/tests/Functional.libxml/tests/xmllint_noout.sh new file mode 100644 index 0000000..959253d --- /dev/null +++ b/tests/Functional.libxml/tests/xmllint_noout.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# In the target to execute command xmllint and confirm the result. +# option : --noout,--valid + +test="xmllint2" + +cat >> sample01.xml < + + + + + +]> + + + + favorit + interest + + +EOF + +if xmllint --noout --valid sample01.xml +then + echo " -> $test: TEST-PASS" +else + echo " -> $test: TEST-FAIL" +fi +rm sample01.xml -- 1.8.3.1