1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#!/bin/sh
# Make sure that the examples compile and run
cd $AUTOPKGTEST_TMP
set -e
EXAMPLES_DIR=/usr/share/doc/libnxml0-dev/examples
# Ignoring easy.c as it tries to pull from a dead website
for f in new ; do
gcc ${EXAMPLES_DIR}/${f}.c -lnxml -o $f && ./${f}
rm ${f}
done
# File used in xml examples
echo "<a><b>b</b><c><c1>c1</c1><c2>c2</c2></c></a>" > example.xml
# namespace and parser
for f in namespace parser ; do
gcc ${EXAMPLES_DIR}/${f}.c -lnxml -o $f && ./${f} example.xml
rm ${f}
done
# write
gcc ${EXAMPLES_DIR}/write.c -lnxml -o write
./write example.xml write_output.xml
rm write
# Double-checking that the output of write is the expected one
cat > write_output_ref.xml << __EOF__
<?xml version="1.0" standalone="yes"?>
<a>
<b>b</b>
<c>
<c1>c1</c1>
<c2>c2</c2>
</c>
</a>
__EOF__
diff write_output.xml write_output_ref.xml
rm example.xml write_output.xml write_output_ref.xml
|