libxml2
Checking out the libxml2 sources
In path/to/examples/libxml2
, initialize the git submodule:
git submodule update --init repo
Create a Makefile
in libxml2/repo
:
./autogen.sh
and optionally ./configure
(autogen.sh
currently runs this automatically,
so you're not required to).
Create a compile_commands.json
in libxml2/repo
:
intercept-build make check
If your compile_commands.json
enables optimizations(-O2
) you will need to remove them so that unsupported compiler_builtins are less likely to be generated and leave you in an uncompilable state.
Run rm .libs/*.o
here to get rid of gcc generated staticlibs or else you may see CRITICAL:root:error: some ELF objects were not compiled with clang:
in the next step
Generate Rust Code
in libxml2
:
./translate.py
to translate all required c files (including tests) into the libxml2/repo/rust/src
and libxml2/repo/rust/examples
directories.
Fix Known Translation Issues
in libxml2
:
./patch_translated_code.py
to apply patches to some known issues in the generated code.
Run Libxml2 C Tests
Since each of these tests have their own main file, we decided to move them to the rust examples directory instead of trying to wrap them in the test framework.
You can run a test like so: cargo run --example EXAMPLE
where EXAMPLE
is one of the files in libxml2/repo/rust/examples
, not including the file extension.
Outstanding Test Issues
Runnable
testReader
seems to be mostly working identically but with some slight differences. TrytestReader --valid test/japancrlf.xml
. It produces an extra "Ns verBoom: Validation failed: no DTD found !, (null), (null)"
Working
runtest
seems to be consistently successful nowtestRelax
seems to work equivalently with files as in CtestXPath
seems to work equivalently with files as in Cxmllint
seems to work equivalently with files as in CtestSAX
prints out nothing on success, just like C versiontestModule
prints "Success!"testHTML
works with input files fromtest/HTML
and produces same output as C versiontestRegexp
works with files fromtest/regexp
and produces same output as C versiontestrecurse
prints "Total 9 tests, no errors"testlimits
prints "Total 514 tests, no errors"- Note: text output seems noticeably slower than the C version
testThreads
prints nothing (but no longer prints parsing errors)testapi
runs successfully and prints "Total: 1172 functions, 280928 tests, 0 errors"testC14N
prints parsed output when given a file to read fromtest/c14n
testSchemas
no longer crashes when provided a file fromtest/schemas/*.xsd
testchar
prints tests completedtestdict
prints "dictionary tests succeeded 20000 strings"testAutomata
takes a file fromtest/automata
and produces equivalent output to C runtestURI
waits on input from stdin, needs example input fromtest/URI
. SeeMakefile.am
andresult/URI/uri.data
for examples
Working cross-checks
testchar
all cross-checks matchtestdict
all cross-checks matchtestapi
all cross-checks match (345 million)runtest
all cross-checks matchtestlimits
all cross-checks match, but requires-fno-builtin
as a compiler argumenttestSAX
workstestHTML
workstestRegexp
workstestModule
requirestestdso.so
, doesn't work yettestAutomata
workstestSchemas
works on all files fromtest/schemas
testRelax
works on all files fromtest/relaxng
testURI
workstestC14N
workstestXPath
works on files undertest/XPath/expr
andtest/xmlid
testThreads
deadlocks, still investigatingxmlllint
does not compile