Skip to content

Commit

Permalink
[sipify] complete test to check the __init__.py core files are up to …
Browse files Browse the repository at this point in the history
…date
  • Loading branch information
3nids committed May 18, 2018
1 parent f267adc commit 7440220
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions tests/code_layout/test_sipfiles_uptodate.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

set -e
#set -e

DIR=$(git rev-parse --show-toplevel)

Expand All @@ -15,22 +15,30 @@ pushd ${DIR} > /dev/null
modules=(core gui analysis server)

code=0
while read -r sipfile; do
header=$(${GP}sed -E 's@(.*)\.sip@src/\1.h@; s@auto_generated/@@' <<< $sipfile)
if [ ! -f $header ]; then
echo "*** Missing header: $header for sipfile $sipfile"
else
outdiff=$(./scripts/sipify.pl $header | diff python/$sipfile.in -)
if [[ -n $outdiff ]]; then
echo " *** SIP file not up to date: $sipfile"
code=1
fi
fi
done < <(
for module in "${modules[@]}"; do
${GP}sed -n -r "s@^%Include auto_generated/(.*\.sip)@${module}/auto_generated/\1@p" python/${module}/${module}_auto.sip
done
module_init=${DIR}/python/${module}/__init__.py
cp ${module_init} ${DIR}/${module}.temp
while read -r sipfile; do
header=$(${GP}sed -E 's@(.*)\.sip@src/\1.h@; s@auto_generated/@@' <<< $sipfile)
if [ ! -f $header ]; then
echo "*** Missing header: $header for sipfile $sipfile"
else
outdiff=$(./scripts/sipify.pl -p ${DIR}/${module}.temp $header | diff python/$sipfile.in -)
if [[ -n "$outdiff" ]]; then
echo " *** SIP file not up to date: $sipfile"
code=1
fi
fi
done < <(
${GP}sed -n -r "s@^%Include auto_generated/(.*\.sip)@${module}/auto_generated/\1@p" python/${module}/${module}_auto.sip
)
outdiff=$(diff ${module_init} ${DIR}/${module}.temp)
if [[ -n "$outdiff" ]]; then
echo " *** Python ${module} (${module_init}) init not up to date: run sipify with -p argument"
code=1
fi
rm ${DIR}/${module}.temp
done


popd > /dev/null
Expand Down

0 comments on commit 7440220

Please sign in to comment.