diff options
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rwxr-xr-x | other/astyle/format-source | 26 | ||||
-rwxr-xr-x | other/travis/toxcore-script | 3 |
3 files changed, 29 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 25c8ed15..9061286d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -223,6 +223,9 @@ target_link_libraries(toxencryptsave toxcore) | |||
223 | # | 223 | # |
224 | ################################################################################ | 224 | ################################################################################ |
225 | 225 | ||
226 | add_test(format_test | ||
227 | ${CMAKE_SOURCE_DIR}/other/astyle/format-source "${CMAKE_SOURCE_DIR}") | ||
228 | |||
226 | function(auto_test target) | 229 | function(auto_test target) |
227 | if(CHECK_FOUND) | 230 | if(CHECK_FOUND) |
228 | add_executable(auto_${target} auto_tests/${target}.c) | 231 | add_executable(auto_${target} auto_tests/${target}.c) |
diff --git a/other/astyle/format-source b/other/astyle/format-source index 9571fd7b..fc81f744 100755 --- a/other/astyle/format-source +++ b/other/astyle/format-source | |||
@@ -1,9 +1,35 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | set -e | ||
4 | |||
5 | SOURCE_DIR="$1" | ||
6 | |||
7 | # Go to the source root. | ||
8 | if [ -z "$SOURCE_DIR" ]; then | ||
9 | SOURCE_DIR=. | ||
10 | fi | ||
11 | cd "$SOURCE_DIR" | ||
12 | |||
3 | if [ -z "$ASTYLE" ]; then | 13 | if [ -z "$ASTYLE" ]; then |
4 | ASTYLE=astyle | 14 | ASTYLE=astyle |
5 | fi | 15 | fi |
6 | 16 | ||
17 | if [ -f ../apidsl/_build/apigen.native ]; then | ||
18 | APIDSL=../apidsl/_build/apigen.native | ||
19 | else | ||
20 | APIDSL=apidsl_curl | ||
21 | fi | ||
22 | |||
23 | apidsl_curl() { | ||
24 | curl -X POST --data-binary @"$1" https://apidsl.herokuapp.com/apidsl | ||
25 | } | ||
26 | |||
27 | # Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h. | ||
28 | $APIDSL other/apidsl/tox.in.h > toxcore/tox.h | ||
29 | $APIDSL other/apidsl/toxav.in.h > toxav/toxav.h | ||
30 | |||
7 | SOURCES=`find . -name "*.[ch]" -and -not -name "*.in.*" -and -not -wholename "*crypto_pwhash*" -and -not -wholename "./super_donators/*"` | 31 | SOURCES=`find . -name "*.[ch]" -and -not -name "*.in.*" -and -not -wholename "*crypto_pwhash*" -and -not -wholename "./super_donators/*"` |
8 | 32 | ||
9 | $ASTYLE -n --options=other/astyle/astylerc $SOURCES | 33 | $ASTYLE -n --options=other/astyle/astylerc $SOURCES |
34 | |||
35 | git diff --exit-code | ||
diff --git a/other/travis/toxcore-script b/other/travis/toxcore-script index 6cf544ed..59168b40 100755 --- a/other/travis/toxcore-script +++ b/other/travis/toxcore-script | |||
@@ -3,9 +3,6 @@ | |||
3 | set -e -u -x | 3 | set -e -u -x |
4 | . other/travis/env-$ENV.sh | 4 | . other/travis/env-$ENV.sh |
5 | 5 | ||
6 | # Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h. | ||
7 | ../apidsl/_build/apigen.native other/apidsl/tox.in.h > toxcore/tox.h | ||
8 | ../apidsl/_build/apigen.native other/apidsl/toxav.in.h > toxav/toxav.h | ||
9 | # Check if the code is formatted according to the astyle configuration. | 6 | # Check if the code is formatted according to the astyle configuration. |
10 | other/astyle/format-source | 7 | other/astyle/format-source |
11 | git diff --exit-code | 8 | git diff --exit-code |