Skip to content

Commit

Permalink
test: Rework skip and xfails (addressing a fail with latest jq)
Browse files Browse the repository at this point in the history
Rework the testsuite using bash mappings, making things simpler
and faster.

Also fix a failing test due to jq changes.

Signed-off-by: Pantelis Antoniou <[email protected]>
  • Loading branch information
pantoniou committed Sep 27, 2024
1 parent 2cf9f45 commit f101eb2
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 47 deletions.
28 changes: 13 additions & 15 deletions test/testsuite-evstream.test
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ done
# output plan
echo 1..$count

skiplist="2JQS"
xfaillist=""
declare -A skips=(
[2JQS]="duplicate keys in testcase; cannot load as document"
)
declare -A xfails=()

i=0
for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
Expand Down Expand Up @@ -50,15 +52,13 @@ for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
t=`mktemp`

directive=""
for skip in $skiplist; do
if [ "$test_subtest_id" == "$skip" ]; then
directive=" # skip: duplicate keys in testcase; cannot load as document"
break
fi
done
skip_reason="${skips[$test_subtest_id]}"
if [ "x$skip_reason" != "x" ]; then
directive=" # SKIP: ${skip_reason}"
fi

res="ok"
if [ "x$directive" == "x" ]; then
if [ "x$skip_reason" == "x" ]; then
res="not ok"
# run the test using document-event-stream
${TOP_BUILDDIR}/src/fy-tool --testsuite --document-event-stream "$tst/in.yaml" >"$t"
Expand All @@ -75,12 +75,10 @@ for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do

rm -f "$t"

for xfail in $xfaillist; do
if [ "$test_subtest_id" == "$xfail" ]; then
directive=" # TODO: known failure."
break
fi
done
xfail_reason="${xfails[$test_subtest_id]}"
if [ "x$xfail_reason" != "x" ]; then
directive=" # TODO: ${xfail_reason}"
fi
fi

echo "$res $i $test_subtest_id - $desctxt$directive"
Expand Down
31 changes: 15 additions & 16 deletions test/testsuite-json.test
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ done
# output plan
echo 1..$count

skiplist="C4HZ"
xfaillist=""
declare -A skips=(
[UGM3]="Later jq versions rewrite numbers like 12.00 -> 12 which breaks diff"
)
declare -A xfails=(
[C4HZ]="requires schema support which libfyaml does not support yet."
)

i=0
for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
Expand Down Expand Up @@ -51,16 +55,13 @@ for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
desctxt=`cat 2>/dev/null "$tst/==="`

directive=""
for skip in $skiplist; do
if [ "$test_subtest_id" == "$skip" ]; then
directive="# SKIP: does not apply to libfyaml"
break
fi
done
skip_reason="${skips[$test_subtest_id]}"
if [ "x$skip_reason" != "x" ]; then
directive=" # SKIP: ${skip_reason}"
fi

res="ok"

if [ "x$directive" == "x" ]; then
if [ "x$skip_reason" == "x" ]; then
t1=`mktemp`
t2=`mktemp`

Expand All @@ -79,12 +80,10 @@ for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do

rm -f "$t1" "$t2"

for xfail in $xfaillist; do
if [ "$test_subtest_id" == "$xfail" ]; then
directive=" # TODO: known failure."
break
fi
done
xfail_reason="${xfails[$test_subtest_id]}"
if [ "x$xfail_reason" != "x" ]; then
directive=" # TODO: ${xfail_reason}"
fi
fi

echo "$res $i $test_subtest_id - $desctxt (JSON)$directive"
Expand Down
31 changes: 15 additions & 16 deletions test/testsuite-resolution.test
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ done
# output plan
echo 1..$count

# X38W has duplicate keys after resolution
skiplist="2JQS X38W"
xfaillist=""
declare -A skips=(
[2JQS]="duplicate keys in testcase; cannot load as document"
[X38W]="duplicate keys after resolution"
)
declare -A xfails=(
)

i=0
for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
Expand Down Expand Up @@ -63,15 +66,13 @@ for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do
t2=`mktemp`

directive=""
for skip in $skiplist; do
if [ "$test_subtest_id" == "$skip" ]; then
directive=" # skip: duplicate keys in testcase; cannot load as document"
break
fi
done
skip_reason="${skips[$test_subtest_id]}"
if [ "x$skip_reason" != "x" ]; then
directive=" # SKIP: ${skip_reason}"
fi

res="ok"
if [ "x$directive" == "x" ]; then
if [ "x$skip_reason" == "x" ]; then
res="not ok"

${TOP_BUILDDIR}/src/fy-tool --dump --resolve "$tst/in.yaml" | ${TOP_BUILDDIR}/src/fy-tool --testsuite --disable-flow-markers - >"$t1"
Expand All @@ -86,12 +87,10 @@ for basetst in test-suite-data/[A-Z0-9][A-Z0-9][A-Z0-9][A-Z0-9]/; do

rm -f "$t1" "$t2"

for xfail in $xfaillist; do
if [ "$test_subtest_id" == "$xfail" ]; then
directive=" # TODO: known failure."
break
fi
done
xfail_reason="${xfails[$test_subtest_id]}"
if [ "x$xfail_reason" != "x" ]; then
directive=" # TODO: ${xfail_reason}"
fi
fi

echo "$res $i $test_subtest_id - $desctxt$directive"
Expand Down

0 comments on commit f101eb2

Please sign in to comment.