Skip to content

Commit

Permalink
Add cmake test for apidsl.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Aug 24, 2016
1 parent 503d198 commit 7075c36
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ target_link_libraries(toxencryptsave toxcore)
#
################################################################################

add_test(format_test
${CMAKE_SOURCE_DIR}/other/astyle/format-source "${CMAKE_SOURCE_DIR}")

function(auto_test target)
if(CHECK_FOUND)
add_executable(auto_${target} auto_tests/${target}.c)
Expand Down
26 changes: 26 additions & 0 deletions other/astyle/format-source
Original file line number Diff line number Diff line change
@@ -1,9 +1,35 @@
#!/bin/sh

set -e

SOURCE_DIR="$1"

# Go to the source root.
if [ -z "$SOURCE_DIR" ]; then
SOURCE_DIR=.
fi
cd "$SOURCE_DIR"

if [ -z "$ASTYLE" ]; then
ASTYLE=astyle
fi

if [ -f ../apidsl/_build/apigen.native ]; then
APIDSL=../apidsl/_build/apigen.native
else
APIDSL=apidsl_curl
fi

apidsl_curl() {
curl -X POST --data-binary @"$1" https://apidsl.herokuapp.com/apidsl
}

# Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h.
$APIDSL other/apidsl/tox.in.h > toxcore/tox.h
$APIDSL other/apidsl/toxav.in.h > toxav/toxav.h

SOURCES=`find . -name "*.[ch]" -and -not -name "*.in.*" -and -not -wholename "*crypto_pwhash*" -and -not -wholename "./super_donators/*"`

$ASTYLE -n --options=other/astyle/astylerc $SOURCES

git diff --exit-code
3 changes: 0 additions & 3 deletions other/travis/toxcore-script
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
set -e -u -x
. other/travis/env-$ENV.sh

# Check if toxcore.h and toxav.h match apidsl tox.in.h and toxav.in.h.
../apidsl/_build/apigen.native other/apidsl/tox.in.h > toxcore/tox.h
../apidsl/_build/apigen.native other/apidsl/toxav.in.h > toxav/toxav.h
# Check if the code is formatted according to the astyle configuration.
other/astyle/format-source
git diff --exit-code
Expand Down

0 comments on commit 7075c36

Please sign in to comment.