diff --git a/TESTING.md b/TESTING.md index 7bc5a02..d9a99b3 100644 --- a/TESTING.md +++ b/TESTING.md @@ -2,6 +2,16 @@ Tested with .Net framework code generator xsd.exe Not verified with JAXB. +== Schema regression (libxml2) + +`tests/schema/run.sh` validates the VAST 4.4 InLine/Wrapper cardinality fix +(InteractiveAdvertisingBureau/vast#58) with xmllint: + + ./tests/schema/run.sh + +Requires `xmllint` from libxml2. Empty ``, empty ``, and +repeated `` must fail against this tree. The same three documents +still validate against `origin/master` `vast_4.4.xsd`, which is the bug. == Using xsd.exe from Visual Studio command line diff --git a/tests/schema/accept-minimal-inline.xml b/tests/schema/accept-minimal-inline.xml new file mode 100644 index 0000000..cba48aa --- /dev/null +++ b/tests/schema/accept-minimal-inline.xml @@ -0,0 +1,23 @@ + + + + + iabtechlab + + a532d16d-4d7f-4440-bd29-2ec05553fc80 + Minimal inline + + + + 00:00:16 + + + + + + + + + + + diff --git a/tests/schema/accept-minimal-wrapper.xml b/tests/schema/accept-minimal-wrapper.xml new file mode 100644 index 0000000..7980cfe --- /dev/null +++ b/tests/schema/accept-minimal-wrapper.xml @@ -0,0 +1,10 @@ + + + + + iabtechlab + + + + + diff --git a/tests/schema/accept-nonlinear-pause.xml b/tests/schema/accept-nonlinear-pause.xml new file mode 100644 index 0000000..85c70e9 --- /dev/null +++ b/tests/schema/accept-nonlinear-pause.xml @@ -0,0 +1,25 @@ + + + + + iabtechlab + + a532d16d-4d7f-4440-bd29-2ec05553fc80 + CTV pause + + + + + 00:00:15 + + + + + + + + + + + + diff --git a/tests/schema/reject-empty-inline.xml b/tests/schema/reject-empty-inline.xml new file mode 100644 index 0000000..0d6985a --- /dev/null +++ b/tests/schema/reject-empty-inline.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tests/schema/reject-empty-wrapper.xml b/tests/schema/reject-empty-wrapper.xml new file mode 100644 index 0000000..0605a97 --- /dev/null +++ b/tests/schema/reject-empty-wrapper.xml @@ -0,0 +1,4 @@ + + + + diff --git a/tests/schema/reject-repeated-adsystem.xml b/tests/schema/reject-repeated-adsystem.xml new file mode 100644 index 0000000..fe7579f --- /dev/null +++ b/tests/schema/reject-repeated-adsystem.xml @@ -0,0 +1,10 @@ + + + + + A + B + C + + + diff --git a/tests/schema/run.sh b/tests/schema/run.sh new file mode 100755 index 0000000..64beab1 --- /dev/null +++ b/tests/schema/run.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# Regression tests for InteractiveAdvertisingBureau/vast#58. +# Empty InLine/Wrapper and repeated AdSystem must fail against this tree's +# vast_4.4.xsd. They still validate against origin/master, which is the bug. +set -euo pipefail + +ROOT="$(cd "$(dirname "$0")/../.." && pwd)" +DIR="$(cd "$(dirname "$0")" && pwd)" +XSD="$ROOT/vast_4.4.xsd" +XMLLINT="${XMLLINT:-xmllint}" + +if ! command -v "$XMLLINT" >/dev/null 2>&1; then + echo "xmllint not found. Install libxml2-utils." >&2 + exit 1 +fi + +expect_invalid() { + local file="$1" + if "$XMLLINT" --noout --schema "$XSD" "$file" >/dev/null 2>&1; then + echo "FAIL: expected invalid: $(basename "$file")" >&2 + exit 1 + fi + echo "ok reject $(basename "$file")" +} + +expect_valid() { + local file="$1" + if ! "$XMLLINT" --noout --schema "$XSD" "$file" >/dev/null 2>&1; then + echo "FAIL: expected valid: $(basename "$file")" >&2 + "$XMLLINT" --noout --schema "$XSD" "$file" || true + exit 1 + fi + echo "ok accept $(basename "$file")" +} + +expect_invalid "$DIR/reject-empty-inline.xml" +expect_invalid "$DIR/reject-empty-wrapper.xml" +expect_invalid "$DIR/reject-repeated-adsystem.xml" +expect_valid "$DIR/accept-minimal-inline.xml" +expect_valid "$DIR/accept-minimal-wrapper.xml" +expect_valid "$DIR/accept-nonlinear-pause.xml" + +if git -C "$ROOT" rev-parse --verify origin/master >/dev/null 2>&1; then + master_xsd="$(mktemp)" + trap 'rm -f "$master_xsd"' EXIT + git -C "$ROOT" show origin/master:vast_4.4.xsd > "$master_xsd" + for file in "$DIR"/reject-empty-inline.xml "$DIR"/reject-empty-wrapper.xml "$DIR"/reject-repeated-adsystem.xml; do + if ! "$XMLLINT" --noout --schema "$master_xsd" "$file" >/dev/null 2>&1; then + echo "FAIL: $(basename "$file") should still validate against origin/master vast_4.4.xsd (the #58 bug)." >&2 + exit 1 + fi + echo "ok master still accepts $(basename "$file")" + done +fi + +echo "vast 4.4 InLine/Wrapper cardinality tests passed." diff --git a/vast_4.4.xsd b/vast_4.4.xsd index d946005..ce09058 100644 --- a/vast_4.4.xsd +++ b/vast_4.4.xsd @@ -98,36 +98,36 @@ - + - - - - - - - - - - + + + + + + + + + - - + + + - + + + + + + + + - - - - - - - - +