mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 15:37:32 +08:00
Refactor most of tool validation for CI into a standalone script.
This commit is contained in:
Regular → Executable
+4
-37
@@ -1,44 +1,11 @@
|
||||
#! /bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
./scripts/common_startup.sh
|
||||
GALAXY_VIRTUAL_ENV="${GALAXY_VIRTUAL_ENV:-.venv}"
|
||||
if [ -d "$GALAXY_VIRTUAL_ENV" ];
|
||||
then
|
||||
printf "Activating virtualenv at $GALAXY_VIRTUAL_ENV\n"
|
||||
. "$GALAXY_VIRTUAL_ENV/bin/activate"
|
||||
fi
|
||||
|
||||
xsd_path="lib/galaxy/tools/xsd/galaxy.xsd"
|
||||
# Lint the XSD
|
||||
xmllint --noout "$xsd_path"
|
||||
|
||||
test_tools_path="test/functional/tools"
|
||||
tool_files_list=`mktemp`
|
||||
err_tmp=`mktemp`
|
||||
# Validate the tools.
|
||||
ls "$test_tools_path"/*xml | grep -v '_conf.xml$' > "$tool_files_list"
|
||||
|
||||
count=`wc -l "$tool_files_list" | cut -f1 -d' '`
|
||||
echo "1..$count"
|
||||
count=0
|
||||
exit=0
|
||||
while read p; do
|
||||
count=$((count+1))
|
||||
path="$p"
|
||||
echo $path
|
||||
PYTHONPATH=lib:$PYTHONPATH
|
||||
export PYTHONPATH
|
||||
result=`python -c "import galaxy.tools.loader; import xml.etree; xml.etree.ElementTree.dump(galaxy.tools.loader.load_tool('$path').getroot())" | xmllint --nowarning --noout --schema "$xsd_path" - 2> "$err_tmp"`
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "ok $count";
|
||||
else
|
||||
echo "not ok $count $path";
|
||||
cat "$err_tmp" | sed 's/^/ /'
|
||||
exit=1
|
||||
fi
|
||||
done <"$tool_files_list"
|
||||
rm "$err_tmp"
|
||||
exit $exit
|
||||
test_tools_path='test/functional/tools'
|
||||
tool_files_list=$(ls "$test_tools_path"/*xml | grep -v '_conf.xml$')
|
||||
sh scripts/validate_tools.sh $tool_files_list
|
||||
|
||||
Executable
+35
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
./scripts/common_startup.sh
|
||||
GALAXY_VIRTUAL_ENV="${GALAXY_VIRTUAL_ENV:-.venv}"
|
||||
if [ -d "$GALAXY_VIRTUAL_ENV" ];
|
||||
then
|
||||
printf "Activating virtualenv at $GALAXY_VIRTUAL_ENV\n"
|
||||
. "$GALAXY_VIRTUAL_ENV/bin/activate"
|
||||
fi
|
||||
|
||||
xsd_path="lib/galaxy/tools/xsd/galaxy.xsd"
|
||||
|
||||
err_tmp=`mktemp`
|
||||
count=0
|
||||
exit=0
|
||||
for p in "$@"; do
|
||||
count=$((count+1))
|
||||
path="$p"
|
||||
echo $path
|
||||
PYTHONPATH=lib:$PYTHONPATH
|
||||
export PYTHONPATH
|
||||
result=`python -c "import galaxy.tools.loader; import xml.etree; xml.etree.ElementTree.dump(galaxy.tools.loader.load_tool('$path').getroot())" | xmllint --nowarning --noout --schema "$xsd_path" - 2> "$err_tmp"`
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "ok $count";
|
||||
else
|
||||
echo "not ok $count $path";
|
||||
cat "$err_tmp" | sed 's/^/ /'
|
||||
exit=1
|
||||
fi
|
||||
done
|
||||
rm "$err_tmp"
|
||||
exit $exit
|
||||
Reference in New Issue
Block a user