Commit 02ce4e1 Initial commit for upstream inclusion

9 files Merged and Committed by rasibley 2 years ago
Initial commit for upstream inclusion

    
 1 @@ -0,0 +1,63 @@
 2 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 3 + #
 4 + #   Makefile of /CoreOS/expat/Sanity/fuzz
 5 + #   Description: Feed expat with various random input
 6 + #   Author: Petr Splichal <psplicha@redhat.com>
 7 + #
 8 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 9 + #
10 + #   Copyright (c) 2010 Red Hat, Inc. All rights reserved.
11 + #
12 + #   This copyrighted material is made available to anyone wishing
13 + #   to use, modify, copy, or redistribute it subject to the terms
14 + #   and conditions of the GNU General Public License version 2.
15 + #
16 + #   This program is distributed in the hope that it will be
17 + #   useful, but WITHOUT ANY WARRANTY; without even the implied
18 + #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 + #   PURPOSE. See the GNU General Public License for more details.
20 + #
21 + #   You should have received a copy of the GNU General Public
22 + #   License along with this program; if not, write to the Free
23 + #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 + #   Boston, MA 02110-1301, USA.
25 + #
26 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 + 
28 + export TEST=/CoreOS/expat/Sanity/fuzz
29 + export TESTVERSION=1.0
30 + 
31 + BUILT_FILES=
32 + 
33 + FILES=$(METADATA) runtest.sh Makefile PURPOSE
34 + 
35 + .PHONY: all install download clean
36 + 
37 + run: $(FILES) build
38 + »       ./runtest.sh
39 + 
40 + build: $(BUILT_FILES)
41 + »       chmod a+x runtest.sh
42 + 
43 + clean:
44 + »       rm -f *~ $(BUILT_FILES)
45 + 
46 + 
47 + include /usr/share/rhts/lib/rhts-make.include
48 + 
49 + $(METADATA): Makefile
50 + »       @echo "Owner:           Petr Splichal <psplicha@redhat.com>" > $(METADATA)
51 + »       @echo "Name:            $(TEST)" >> $(METADATA)
52 + »       @echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
53 + »       @echo "Path:            $(TEST_DIR)" >> $(METADATA)
54 + »       @echo "Description:     Feed expat with various random input" >> $(METADATA)
55 + »       @echo "Type:            Sanity" >> $(METADATA)
56 + »       @echo "TestTime:        90m" >> $(METADATA)
57 + »       @echo "RunFor:          expat" >> $(METADATA)
58 + »       @echo "Requires:        expat" >> $(METADATA)
59 + »       @echo "Priority:        Normal" >> $(METADATA)
60 + »       @echo "License:         GPLv2" >> $(METADATA)
61 + »       @echo "Confidential:    no" >> $(METADATA)
62 + »       @echo "Destructive:     no" >> $(METADATA)
63 + 
64 + »       rhts-lint $(METADATA)
1 @@ -0,0 +1,7 @@
2 + PURPOSE of /CoreOS/expat/Sanity/fuzz
3 + Description: Feed expat with various random input
4 + Author: Petr Splichal <psplicha@redhat.com>
5 + 
6 + This is a simple fuzzer. Tries to feed the expat library with
7 + various random input. Makes sure it does not crash on it. Files
8 + triggering possible failures are submitted to the scheduler.
 1 @@ -0,0 +1,58 @@
 2 + #!/bin/bash
 3 + # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
 4 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5 + #
 6 + #   runtest.sh of /CoreOS/expat/Sanity/fuzz
 7 + #   Description: Feed expat with various random input
 8 + #   Author: Petr Splichal <psplicha@redhat.com>
 9 + #
10 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 + #
12 + #   Copyright (c) 2010 Red Hat, Inc. All rights reserved.
13 + #
14 + #   This copyrighted material is made available to anyone wishing
15 + #   to use, modify, copy, or redistribute it subject to the terms
16 + #   and conditions of the GNU General Public License version 2.
17 + #
18 + #   This program is distributed in the hope that it will be
19 + #   useful, but WITHOUT ANY WARRANTY; without even the implied
20 + #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
21 + #   PURPOSE. See the GNU General Public License for more details.
22 + #
23 + #   You should have received a copy of the GNU General Public
24 + #   License along with this program; if not, write to the Free
25 + #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 + #   Boston, MA 02110-1301, USA.
27 + #
28 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 + 
30 + # Include rhts environment
31 + . /usr/bin/rhts-environment.sh
32 + . /usr/lib/beakerlib/beakerlib.sh
33 + 
34 + PACKAGE="expat"
35 + COUNT=${COUNT:-1000}
36 + 
37 + rlJournalStart
38 +     rlPhaseStartSetup
39 +         rlAssertRpm $PACKAGE
40 +         rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
41 +         rlRun "pushd $TmpDir"
42 +     rlPhaseEnd
43 + 
44 +     rlPhaseStartTest
45 +         for i in `seq -w $COUNT`; do
46 +             rlRun "dd if=/dev/urandom of=file$i.xml bs=1024 count=100" \
47 +                     0 "Creating file$i.xml with random content"
48 +             if ! rlRun "xmlwf file$i.xml"; then 
49 +                 rlFileSubmit "file$i.xml"
50 +             fi
51 +         done
52 +     rlPhaseEnd
53 + 
54 +     rlPhaseStartCleanup
55 +         rlRun "popd"
56 +         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
57 +     rlPhaseEnd
58 + rlJournalPrintText
59 + rlJournalEnd
 1 @@ -0,0 +1,63 @@
 2 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 3 + #
 4 + #   Makefile of /CoreOS/expat/Sanity/smoke
 5 + #   Description: Basic functionality test using xmlwf
 6 + #   Author: Petr Splichal <psplicha@redhat.com>
 7 + #
 8 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 9 + #
10 + #   Copyright (c) 2009 Red Hat, Inc. All rights reserved.
11 + #
12 + #   This copyrighted material is made available to anyone wishing
13 + #   to use, modify, copy, or redistribute it subject to the terms
14 + #   and conditions of the GNU General Public License version 2.
15 + #
16 + #   This program is distributed in the hope that it will be
17 + #   useful, but WITHOUT ANY WARRANTY; without even the implied
18 + #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19 + #   PURPOSE. See the GNU General Public License for more details.
20 + #
21 + #   You should have received a copy of the GNU General Public
22 + #   License along with this program; if not, write to the Free
23 + #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 + #   Boston, MA 02110-1301, USA.
25 + #
26 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27 + 
28 + export TEST=/CoreOS/expat/Sanity/smoke
29 + export TESTVERSION=1.0
30 + 
31 + BUILT_FILES=
32 + 
33 + FILES=$(METADATA) runtest.sh Makefile PURPOSE
34 + 
35 + .PHONY: all install download clean
36 + 
37 + run: $(FILES) build
38 + »       ./runtest.sh
39 + 
40 + build: $(BUILT_FILES)
41 + »       chmod a+x runtest.sh
42 + 
43 + clean:
44 + »       rm -f *~ $(BUILT_FILES)
45 + 
46 + 
47 + include /usr/share/rhts/lib/rhts-make.include
48 + 
49 + $(METADATA): Makefile
50 + »       @echo "Owner:           Petr Splichal <psplicha@redhat.com>" > $(METADATA)
51 + »       @echo "Name:            $(TEST)" >> $(METADATA)
52 + »       @echo "TestVersion:     $(TESTVERSION)" >> $(METADATA)
53 + »       @echo "Path:            $(TEST_DIR)" >> $(METADATA)
54 + »       @echo "Description:     Basic functionality test using xmlwf" >> $(METADATA)
55 + »       @echo "Type:            Sanity" >> $(METADATA)
56 + »       @echo "TestTime:        5m" >> $(METADATA)
57 + »       @echo "RunFor:          expat" >> $(METADATA)
58 + »       @echo "Requires:        expat" >> $(METADATA)
59 + »       @echo "Priority:        Normal" >> $(METADATA)
60 + »       @echo "License:         GPLv2" >> $(METADATA)
61 + »       @echo "Confidential:    no" >> $(METADATA)
62 + »       @echo "Destructive:     no" >> $(METADATA)
63 + 
64 + »       rhts-lint $(METADATA)
1 @@ -0,0 +1,3 @@
2 + PURPOSE of /CoreOS/expat/Sanity/smoke
3 + Description: Basic functionality test using xmlwf
4 + Author: Petr Splichal <psplicha@redhat.com>
 1 @@ -0,0 +1,93 @@
 2 + #!/bin/bash
 3 + # vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
 4 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5 + #
 6 + #   runtest.sh of /CoreOS/expat/Sanity/smoke
 7 + #   Description: Basic functionality test using xmlwf
 8 + #   Author: Petr Splichal <psplicha@redhat.com>
 9 + #
10 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11 + #
12 + #   Copyright (c) 2009 Red Hat, Inc. All rights reserved.
13 + #
14 + #   This copyrighted material is made available to anyone wishing
15 + #   to use, modify, copy, or redistribute it subject to the terms
16 + #   and conditions of the GNU General Public License version 2.
17 + #
18 + #   This program is distributed in the hope that it will be
19 + #   useful, but WITHOUT ANY WARRANTY; without even the implied
20 + #   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
21 + #   PURPOSE. See the GNU General Public License for more details.
22 + #
23 + #   You should have received a copy of the GNU General Public
24 + #   License along with this program; if not, write to the Free
25 + #   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 + #   Boston, MA 02110-1301, USA.
27 + #
28 + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29 + 
30 + # Include rhts environment
31 + . /usr/bin/rhts-environment.sh
32 + . /usr/lib/beakerlib/beakerlib.sh
33 + 
34 + PACKAGE="expat"
35 + 
36 + rlJournalStart
37 +     rlPhaseStartSetup
38 +         rlAssertRpm $PACKAGE
39 +         rlRun "TmpDir=\`mktemp -d\`" 0 "Creating tmp directory"
40 +         rlRun "pushd $TmpDir"
41 + 
42 +         # create test xml documents
43 +         rlRun "echo '<?xml version=\"1.0\"?>' > empty.xml" 0 "Creating empty.xml"
44 +         rlRun "echo '<tag> <one><two></one></two> </tag>' > nesting.xml" \
45 +                 0 "Creating nesting.xml"
46 +         rlRun "echo '<tag> <quote without=quote>is bad</quote> </tag>' > quoting.xml" \
47 +                 0 "Creating quoting.xml"
48 +         rlRun "echo '<one>content</one><two>content</two>' > roots.xml" \
49 +                 0 "Creating roots.xml"
50 +         rlRun "echo '<!DOCTYPE tag [ <!ENTITY ent SYSTEM \"nesting.xml\"> ]> <tag>&ent;</tag>' > external.xml" \
51 +                 0 "Creating empty.xml"
52 +         rlRun "echo '<tag>Content with <nothing/> something <dive level=\"3\">nested</dive>.</tag>' > well.xml" \
53 +                 0 "Creating well.xml"
54 +         rlRun "echo '<tag>ěščřžýáíé, 測試, בדיקה, परीक्षण, テスト, 테스트, тестирование, ทดสอบ</tag>'> utf8.xml" \
55 +                 0 "Creating utf8.xml"
56 +     rlPhaseEnd
57 + 
58 +     rlPhaseStartTest
59 +         # emtpy
60 +         rlRun "xmlwf empty.xml | tee output" 0 "Testing empty xml"
61 +         rlAssertGrep "no element found" "output"
62 + 
63 +         # proper nesting
64 +         rlRun "xmlwf nesting.xml | tee output" 0 "Testing proper nesting"
65 +         rlAssertGrep "mismatched tag" "output"
66 + 
67 +         # quoting
68 +         rlRun "xmlwf < quoting.xml | tee output" 0 "Testing quoting (and redirection)"
69 +         rlAssertGrep "invalid token" "output"
70 + 
71 +         # two roots
72 +         rlRun "cat roots.xml | xmlwf | tee output" 0 "Testing proper nesting (and pipe)"
73 +         rlAssertGrep "junk after document element" "output"
74 + 
75 +         # external
76 +         rlRun "xmlwf -p external.xml | tee output" 0 "Testing external entity"
77 +         rlAssertGrep "mismatched tag" "output"
78 +         rlAssertGrep "error in processing external entity" "output"
79 + 
80 +         # well formed
81 +         rlRun "xmlwf well.xml | tee output" 0 "Testing well formed document"
82 +         rlAssertNotDiffer "output" "/dev/null"
83 + 
84 +         # utf8 characters
85 +         rlRun "xmlwf utf8.xml | tee output" 0 "Testing document with utf8 characters"
86 +         rlAssertNotDiffer "output" "/dev/null"
87 +     rlPhaseEnd
88 + 
89 +     rlPhaseStartCleanup
90 +         rlRun "popd"
91 +         rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
92 +     rlPhaseEnd
93 + rlJournalPrintText
94 + rlJournalEnd
 1 @@ -0,0 +1,12 @@
 2 + ---
 3 + - hosts: localhost
 4 +   vars:
 5 +     artifacts: ./
 6 +     playbooks: ./test_local.yml
 7 +   vars_prompt:
 8 +   - name: subjects
 9 +     prompt: "A QCow2/raw test subject file"
10 +     private: no
11 + 
12 +   roles:
13 +   - standard-test-cloud
 1 @@ -0,0 +1,11 @@
 2 + ---
 3 + - hosts: localhost
 4 +   vars:
 5 +     artifacts: ./artifacts
 6 +     playbooks: ./test_local.yml
 7 +   vars_prompt:
 8 +   - name: subjects
 9 +     prompt: "Name of Docker image test subject"
10 +     private: no
11 +   roles:
12 +   - standard-test-docker
 1 @@ -0,0 +1,26 @@
 2 + ---
 3 + # This first play always runs on the local staging system
 4 + - hosts: localhost
 5 + 
 6 +   roles:
 7 +   - role: standard-test-selector
 8 +     tests_docker:
 9 +     - smoke
10 +     - fuzz
11 +     #tests_not_docker:
12 +     #- nondockertest1
13 +     #- nondockertest2
14 +     tests_atomic:
15 +     - smoke
16 +     - fuzz
17 +     #tests_not_atomic:
18 +     #- nonatomictest1
19 +     #- nonatomictest2
20 +     tests_all:
21 +     - smoke
22 +     - fuzz
23 + 
24 +   - role: standard-test-beakerlib
25 +     tests: "{{ selected_tests }}"
26 +     #required_packages:
27 +     #- package1          # alltest1 needs foo command