summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rwxr-xr-xother/astyle/format-source26
-rwxr-xr-xother/travis/toxcore-script3
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
226add_test(format_test
227 ${CMAKE_SOURCE_DIR}/other/astyle/format-source "${CMAKE_SOURCE_DIR}")
228
226function(auto_test target) 229function(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
3set -e
4
5SOURCE_DIR="$1"
6
7# Go to the source root.
8if [ -z "$SOURCE_DIR" ]; then
9 SOURCE_DIR=.
10fi
11cd "$SOURCE_DIR"
12
3if [ -z "$ASTYLE" ]; then 13if [ -z "$ASTYLE" ]; then
4 ASTYLE=astyle 14 ASTYLE=astyle
5fi 15fi
6 16
17if [ -f ../apidsl/_build/apigen.native ]; then
18 APIDSL=../apidsl/_build/apigen.native
19else
20 APIDSL=apidsl_curl
21fi
22
23apidsl_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
7SOURCES=`find . -name "*.[ch]" -and -not -name "*.in.*" -and -not -wholename "*crypto_pwhash*" -and -not -wholename "./super_donators/*"` 31SOURCES=`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
35git 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 @@
3set -e -u -x 3set -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.
10other/astyle/format-source 7other/astyle/format-source
11git diff --exit-code 8git diff --exit-code