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: I7c7a5622df219f8ffa2dd1b824179de749ea2fed
This commit is contained in:
parent
fdf714dfee
commit
1eaaf99b5c
@ -4,6 +4,7 @@ function setup_directory {
|
||||
SET_LANG=$1
|
||||
shift
|
||||
for BOOK_DIR in "$@" ; do
|
||||
echo " $BOOK_DIR"
|
||||
openstack-generate-docbook -l $SET_LANG -b $BOOK_DIR -r ./
|
||||
done
|
||||
}
|
||||
@ -18,34 +19,115 @@ function setup_lang {
|
||||
cp pom.xml generated/$SET_LANG/pom.xml
|
||||
}
|
||||
|
||||
function test_manuals {
|
||||
function test_api_quick_start {
|
||||
SET_LANG=$1
|
||||
shift
|
||||
setup_lang $SET_LANG
|
||||
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"
|
||||
|
||||
case "$PURPOSE" in
|
||||
test)
|
||||
setup_directory $SET_LANG 'api-quick-start'
|
||||
openstack-doc-test -v --check-build -l $SET_LANG \
|
||||
--only-book api-quick-start
|
||||
RET=$?
|
||||
;;
|
||||
publish)
|
||||
setup_directory $SET_LANG 'api-quick-start'
|
||||
openstack-doc-test -v --publish --check-build -l $SET_LANG \
|
||||
--only-book api-quick-start
|
||||
RET=$?
|
||||
;;
|
||||
esac
|
||||
if [ "$RET" -eq "0" ] ; then
|
||||
echo "... succeeded"
|
||||
else
|
||||
echo "... failed"
|
||||
BUILD_FAIL=1
|
||||
fi
|
||||
}
|
||||
|
||||
function test_de {
|
||||
setup_lang 'de'
|
||||
test_api_quick_start 'de'
|
||||
}
|
||||
|
||||
function test_es {
|
||||
setup_lang 'es'
|
||||
test_api_quick_start 'es'
|
||||
}
|
||||
|
||||
function test_fr {
|
||||
setup_lang 'fr'
|
||||
test_api_quick_start 'fr'
|
||||
}
|
||||
|
||||
function test_ko_KR {
|
||||
setup_lang 'ko_KR'
|
||||
test_api_quick_start 'ko_KR'
|
||||
}
|
||||
|
||||
function test_ja {
|
||||
setup_lang 'ja'
|
||||
test_api_quick_start 'ja'
|
||||
}
|
||||
|
||||
function test_language () {
|
||||
|
||||
case "$language" in
|
||||
all)
|
||||
test_de
|
||||
test_es
|
||||
test_fr
|
||||
test_ja
|
||||
test_ko_KR
|
||||
;;
|
||||
de)
|
||||
test_de
|
||||
;;
|
||||
es)
|
||||
test_es
|
||||
;;
|
||||
fr)
|
||||
test_fr
|
||||
;;
|
||||
ja)
|
||||
test_ja
|
||||
;;
|
||||
ko_KR)
|
||||
test_ko_KR
|
||||
;;
|
||||
*)
|
||||
BUILD_FAIL=1
|
||||
fi
|
||||
done
|
||||
echo "Language $language not handled"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function test_all {
|
||||
test_manuals 'de' 'api-quick-start'
|
||||
test_manuals 'es' 'api-quick-start'
|
||||
test_manuals 'fr' 'api-quick-start'
|
||||
test_manuals 'ja' 'api-quick-start'
|
||||
test_manuals 'ko_KR' 'api-quick-start'
|
||||
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
|
||||
|
25
tox.ini
25
tox.ini
@ -42,25 +42,26 @@ commands =
|
||||
mv publish-docs/api-ref-guides publish-docs/api-ref/
|
||||
|
||||
[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"
|
||||
# openstack-generate-docbook needs xml2po which cannot be installed
|
||||
# in the venv. Since it's installed in the system, let's
|
||||
# use sitepackages.
|
||||
# For now this only builds api-quick-start
|
||||
sitepackages=True
|
||||
whitelist_externals = bash
|
||||
commands =
|
||||
openstack-generate-docbook -l {posargs} -b api-quick-start -r ./
|
||||
# tox 1.7 does not parse the following line:
|
||||
# cp doc/pom.xml generated/{posargs}/pom.xml
|
||||
# Thus replaced by the next one:
|
||||
bash ./tools/copy_pom {posargs}
|
||||
openstack-doc-test --check-build --publish -l {posargs} --only-book api-quick-start
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user