-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathxslt-regression-test.sh
executable file
·34 lines (32 loc) · 1.94 KB
/
xslt-regression-test.sh
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
#!/bin/bash
# Using bash strict mode
# see http://redsymbol.net/articles/unofficial-bash-strict-mode/
set -euo pipefail
IFS=$'\n\t'
# test input, ouput and reference follow a pattern according to the test name and ODF version:
TEST_NAMES=("frames-without-wrap" "floating_image_as_character" "frames-without-wrap" "tdf146264" "floating" "spec-fragment" "default-styles" "tdf156093-image" "RedSquare" "DefaultSquare")
ODF_VERSION=odf1.4
TEST_INPUT_FILE=content.xml
TEST_STYLESHEET=src/test/resources/${ODF_VERSION}/tools/odf2html/export/xhtml/opendoc2xhtml.xsl
for TEST_NAME in ${TEST_NAMES[@]}; do
echo Starting transformation of $TEST_NAME to HTML:
# DO NOT ALTER BELOW..
TEST_INPUT_DIR=src/test/resources/html-export/input/${TEST_NAME}
TEST_OUTPUT_FILE=${TEST_NAME}.html
TEST_REFERENCE_FILE=src/test/resources/${ODF_VERSION}/references/xslt-html/${TEST_NAME}.html
# OUTPUT FILE is named like the TEST_INPUT_FILE just with html suffix
# OUTPUT directory is originally: ./target/generated-resources/xml/xslt/
# Final OUTPUT DIR is ./target
# Results from previous build are at ./target/generated-resources/last-build-deliverables
# the XSLT plugin does not transform if the output already exists
# remove if only there is something to move (without error if not existent), doing the following move silently:
[[ -e ./target/generated-resources/xml/xslt/$TEST_INPUT_FILE ]] && rm ./target/generated-resources/xml/xslt/$TEST_INPUT_FILE
mvn test -Ptestfile -DtestInputDir=$TEST_INPUT_DIR -DtestInputFile=$TEST_INPUT_FILE -DtestStylesheet=$TEST_STYLESHEET
[[ -e ./target/generated-resources/xml/xslt/$TEST_INPUT_FILE ]] && cp ./target/generated-resources/xml/xslt/$TEST_INPUT_FILE ./target/$TEST_OUTPUT_FILE
outputTruncName="${TEST_OUTPUT_FILE%.*}"
echo
echo Comparing:
echo ref: ${TEST_REFERENCE_FILE}
echo new: ./target/${outputTruncName}.html
diff ${TEST_REFERENCE_FILE} ./target/$TEST_OUTPUT_FILE
done