aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Lehtinen <petri@digip.org>2019-10-19 20:46:34 +0300
committerPetri Lehtinen <petri@digip.org>2019-10-21 08:56:03 +0300
commitf912430cda4a9c3379d5781057297ff2ed453ba0 (patch)
tree99a412173e482498810e59c0f4151e2d2dd1caea
parenta8f5fa5f5a2b7613aa2aa27b4a4df83b5a0ecd1b (diff)
downloadjansson-f912430cda4a9c3379d5781057297ff2ed453ba0.zip
jansson-f912430cda4a9c3379d5781057297ff2ed453ba0.tar.gz
jansson-f912430cda4a9c3379d5781057297ff2ed453ba0.tar.bz2
Run clang-format with make check
-rw-r--r--.gitignore2
-rw-r--r--.travis.yml2
-rw-r--r--Makefile.am2
-rwxr-xr-xscripts/clang-format-check (renamed from scripts/clang-format-ci)6
-rw-r--r--test/.gitignore4
5 files changed, 11 insertions, 5 deletions
diff --git a/.gitignore b/.gitignore
index 4d62549..0a985b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,5 @@ stamp-h1
*.exe
.idea
cmake-build-debug/
+*.log
+*.trs \ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index df74eb2..a1f736b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -29,4 +29,4 @@ script:
- if [ "$JANSSON_BUILD_METHOD" = "cmake" ]; then mkdir build && cd build && cmake $JANSSON_CMAKE_OPTIONS .. && cmake --build . && ctest --output-on-failure; fi
- if [ "$JANSSON_BUILD_METHOD" = "coverage" ]; then mkdir build && cd build && cmake $JANSSON_CMAKE_OPTIONS .. && cmake --build . && cmake --build . --target coveralls; fi
- if [ "$JANSSON_BUILD_METHOD" = "fuzzer" ]; then ./test/ossfuzz/travisoss.sh; fi
- - if [ "$JANSSON_BUILD_METHOD" = "lint" ]; then ./scripts/clang-format-ci 9; fi
+ - if [ "$JANSSON_BUILD_METHOD" = "lint" ]; then ./scripts/clang-format-check 9; fi
diff --git a/Makefile.am b/Makefile.am
index 0de2ac1..285d2f0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,3 +8,5 @@ dvi:
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = jansson.pc
+
+TESTS = scripts/clang-format-check
diff --git a/scripts/clang-format-ci b/scripts/clang-format-check
index 6854fc2..f3f0f6d 100755
--- a/scripts/clang-format-ci
+++ b/scripts/clang-format-check
@@ -5,6 +5,12 @@ if [ -n "$1" ]; then
clangformat="clang-format-$1"
fi
+if ! type $clangformat >/dev/null; then
+ # clang-format not found. If running tests, mark this test as
+ # skipped.
+ exit 77
+fi
+
errors=0
paths=$(find . -type f -a '(' -name '*.c' -o -name '*.h' ')')
for path in $paths; do
diff --git a/test/.gitignore b/test/.gitignore
index d643dc8..6a33dea 100644
--- a/test/.gitignore
+++ b/test/.gitignore
@@ -18,7 +18,3 @@ suites/api/test_simple
suites/api/test_sprintf
suites/api/test_unpack
suites/api/test_version
-run-suites.log
-run-suites.trs
-test-suite.log
-