<commit_before>#!/bin/sh

check_schema () {

DIRS=$1
SCHEMA="$abs_srcdir/../docs/schemas/$2"

test_intro $this_test

n=0
f=0
for dir in $DIRS
do
  XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1

  for xml in $XML
  do
    n=`expr $n + 1`
    cmd="xmllint --relaxng $SCHEMA --noout $xml"
    result=`$cmd 2>&1`
    ret=$?

    test_result $n $(basename $(dirname $xml))"/"$(basename $xml) $ret
    if test "$verbose" = "1" && test $ret != 0 ; then
        echo -e "$cmd\n$result"
    fi
    if test "$ret" != 0 ; then
        f=`expr $f + 1`
    fi
  done
done

test_final $n $f
<commit_msg>schematestutils.sh: improve shell portability: avoid "echo -e"<commit_after>#!/bin/sh

check_schema () {

DIRS=$1
SCHEMA="$abs_srcdir/../docs/schemas/$2"

test_intro $this_test

n=0
f=0
for dir in $DIRS
do
  XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1

  for xml in $XML
  do
    n=`expr $n + 1`
    cmd="xmllint --relaxng $SCHEMA --noout $xml"
    result=`$cmd 2>&1`
    ret=$?

    test_result $n $(basename $(dirname $xml))"/"$(basename $xml) $ret
    if test "$verbose" = "1" && test $ret != 0 ; then
        printf '%s\n' "$cmd" "$result"
    fi
    if test "$ret" != 0 ; then
        f=`expr $f + 1`
    fi
  done
done

test_final $n $f

{'fraction_non_alphanumeric': 0.18619582664526485, 'fraction_numerical': 0.019261637239165328, 'mean_word_length': 2.7002967359050447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2817380', 'n_tokens_mistral': 544, 'n_tokens_neox': 515, 'n_words': 143}