Rework translation tests

Rework test-languages so that we can test *all* languages as well
if needed and use the same script for both buildlang and testlang.
Add new tox job "publishlang" to publish all languages at once.

Change-Id: Ia8abe50ae798887ed62eaa8c81a4c7472021f718
This commit is contained in:
Andreas Jaeger 2014-06-30 21:01:27 +02:00
parent 6361315dd5
commit b4a93f2de6
2 changed files with 88 additions and 28 deletions

View File

@ -4,34 +4,87 @@ function setup_directory {
SET_LANG=$1
shift
for BOOK_DIR in "$@" ; do
echo " $BOOK_DIR"
openstack-generate-docbook -l $SET_LANG -b $BOOK_DIR
done
}
function test_manuals {
function setup_lang {
SET_LANG=$1
shift
for BOOK in "$@" ; do
echo "Building $BOOK for language $SET_LANG..."
setup_directory $SET_LANG $BOOK
openstack-doc-test --check-build -l $SET_LANG --only-book $BOOK
RET=$?
if [ "$RET" -eq "0" ] ; then
echo "... succeeded"
else
echo "... failed"
echo "Setting up files for $SET_LANG"
echo "======================="
echo " Directories:"
setup_directory $SET_LANG 'openstack-ops'
}
function test_ops_guide {
SET_LANG=$1
shift
setup_lang "$SET_LANG"
case "$PURPOSE" in
test)
openstack-doc-test -v --check-build -l $SET_LANG
RET=$?
;;
publish)
openstack-doc-test -v --publish --check-build -l $SET_LANG
RET=$?
;;
esac
if [ "$RET" -eq "0" ] ; then
echo "... succeeded"
else
echo "... failed"
BUILD_FAIL=1
fi
}
function test_language () {
case "$language" in
all)
test_ops_guide "ja"
;;
ja)
test_ops_guide "$language"
;;
*)
BUILD_FAIL=1
fi
done
}
function test_all {
test_manuals 'ja' 'openstack-ops'
echo "Language $language not handled"
;;
esac
}
function usage () {
echo "Call the script as: "
echo "$0 PURPOSE LANGUAGE1 LANGUAGE2..."
echo "PURPOSE is either 'test', 'publish' or 'publish-install'"
echo "LANGUAGE can also be 'all'."
}
if [ "$#" -lt 2 ] ; then
usage
exit 1
fi
if [ "$1" = "test" ] ; then
PURPOSE="test"
elif [ "$1" = "publish" ] ; then
PURPOSE="publish"
else
usage
exit 1
fi
shift
BUILD_FAIL=0
test_all
for language in "$@" ; do
echo
echo "Building for language $language"
echo
test_language "$language"
done
exit $BUILD_FAIL

27
tox.ini
View File

@ -34,19 +34,26 @@ commands = openstack-doc-test --check-build {posargs}
commands = openstack-doc-test --check-build --nocreate-index --force
[testenv:checklang]
# Generatedocbook needs xml2po which cannot be installed
# in the venv. Since it's installed in the system, let's
# use sitepackages.
# openstack-generate-docbook needs xml2po which cannot be installed in
# the venv. Since it's installed in the system, let's use
# sitepackages.
sitepackages=True
whitelist_externals = bash
commands = bash tools/test-languages.sh
commands = bash tools/test-languages.sh test all
[testenv:buildlang]
# Run as "tox -e buildlang -- $LANG"
# Generatedocbook needs xml2po which cannot be installed
# in the venv. Since it's installed in the system, let's
# use sitepackages.
# openstack-generate-docbook needs xml2po which cannot be installed in
# the venv. Since it's installed in the system, let's use
# sitepackages.
sitepackages=True
commands =
openstack-generate-docbook -l {posargs} -b openstack-ops
openstack-doc-test --check-build --nocreate-index -l {posargs}
whitelist_externals = bash
commands = bash tools/test-languages.sh publish {posargs}
[testenv:publishlang]
# openstack-generate-docbook needs xml2po which cannot be installed in
# the venv. Since it's installed in the system, let's use
# sitepackages.
sitepackages=True
whitelist_externals = bash
commands = bash tools/test-languages.sh publish all