Skip to content

Commit 2206544

Browse files
authored
Merge pull request #16593 from joshrwolf/tests/libxml2
add libxml2 tests
2 parents 11702f1 + 4244944 commit 2206544

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

libxml2.yaml

+48
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,40 @@ subpackages:
6464
mkdir -p ${{targets.subpkgdir}}/usr/bin
6565
mv ${{targets.destdir}}/usr/bin ${{targets.subpkgdir}}/usr
6666
description: libxml2 utils
67+
test:
68+
pipeline:
69+
- name: Verify libxml2 installation
70+
runs: |
71+
xml2-config --version || exit 1
72+
- name: Basic XML parsing
73+
runs: |
74+
cat << EOF > example.xml
75+
<note>
76+
<to>User</to>
77+
<from>Assistant</from>
78+
<heading>Reminder</heading>
79+
<body>Don't forget me this weekend!</body>
80+
</note>
81+
EOF
82+
xmllint --noout example.xml || exit 1
83+
- name: XML validation with DTD
84+
runs: |
85+
cat << 'EOF' > example.dtd
86+
<!ELEMENT note (to,from,heading,body)>
87+
<!ELEMENT to (#PCDATA)>
88+
<!ELEMENT from (#PCDATA)>
89+
<!ELEMENT heading (#PCDATA)>
90+
<!ELEMENT body (#PCDATA)>
91+
EOF
92+
cat << 'EOF' > note.xml
93+
<note>
94+
<to>Tove</to>
95+
<from>Jani</from>
96+
<heading>Reminder</heading>
97+
<body>Don't forget me this weekend!</body>
98+
</note>
99+
EOF
100+
xmllint --noout --dtdvalid example.dtd note.xml || exit 1
67101
68102
- name: libxml2-dev
69103
pipeline:
@@ -75,6 +109,20 @@ subpackages:
75109
- xz-dev
76110
- libxml2-utils
77111
description: libxml2 dev
112+
test:
113+
environment:
114+
contents:
115+
packages:
116+
- gcc
117+
- glibc-dev
118+
- libxml2-utils
119+
pipeline:
120+
- name: Verify libxml2-dev installation
121+
runs: |
122+
echo '#include <libxml/parser.h>' > test.c
123+
echo 'int main() {return 0;}' >> test.c
124+
gcc -o test test.c $(xml2-config --cflags) $(xml2-config --libs)
125+
./test || exit 1
78126
79127
update:
80128
enabled: true

0 commit comments

Comments
 (0)