Skip to content

Commit 1d7ace1

Browse files
committedJun 28, 2017
add test to check that header has a corresponding sip file
1 parent e3dedbd commit 1d7ace1

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed
 

‎tests/code_layout/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ENDIF(WITH_ASTYLE)
55
ADD_TEST(qgis_spelling ${CMAKE_SOURCE_DIR}/scripts/spell_check/spell_test.sh)
66

77
ADD_TEST(qgis_sipify ${CMAKE_SOURCE_DIR}/tests/code_layout/test_sipify.sh)
8+
ADD_TEST(qgis_sip_include ${CMAKE_SOURCE_DIR}/tests/code_layout/test_sip_include.sh)
89
ADD_TEST(qgis_sip_uptodate ${CMAKE_SOURCE_DIR}/tests/code_layout/test_sipfiles_uptodate.sh)
910

1011
IF (WITH_APIDOC)

‎tests/code_layout/test_sip_include.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/usr/bin/env bash
2+
3+
DIR=$(git rev-parse --show-toplevel)
4+
REV=$(git log -n1 --pretty=%H)
5+
6+
# GNU prefix command for mac os support (gsed, gsplit)
7+
GP=
8+
if [[ "$OSTYPE" =~ darwin* ]]; then
9+
GP=g
10+
fi
11+
12+
pushd ${DIR} > /dev/null
13+
14+
code=0
15+
modules=(core gui analysis server)
16+
for module in "${modules[@]}"; do
17+
cp python/${module}/${module}_auto.sip python/${module}/${module}_auto.sip.$REV.bak
18+
done
19+
20+
./scripts/sip_include.sh
21+
22+
for module in "${modules[@]}"; do
23+
outdiff=$(diff python/${module}/${module}_auto.sip python/${module}/${module}_auto.sip.$REV.bak)
24+
if [[ -n $outdiff ]]; then
25+
echo -e " *** SIP include file for \x1B[33m${module}\x1B[0m not up to date."
26+
echo "$outdiff"
27+
code=1
28+
mv python/${module}/${module}_auto.sip.$REV.bak python/${module}/${module}_auto.sip
29+
else
30+
rm python/${module}/${module}_auto.sip.$REV.bak
31+
fi
32+
done
33+
34+
if [[ code -eq 1 ]]; then
35+
echo -e " Run \x1B[33m./scripts/sip_include.sh\x1B[0m to add to fix this."
36+
echo -e " If a header should not have a sip file created, add \x1B[33m#define SIP_NO_FILE\x1B[0m."
37+
fi
38+
39+
popd > /dev/null
40+
41+
exit $code

0 commit comments

Comments
 (0)
Please sign in to comment.