diff --git a/meson.build b/meson.build index 27c2420..2d47aa2 100644 --- a/meson.build +++ b/meson.build @@ -310,5 +310,6 @@ message('\n'.join(summary)) # Test Suite +test('Clang-format formatting check', find_program('test/clang-format'), args : [ cagebreak_main_file + cagebreak_source_strings + cagebreak_header_strings ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic') test('Arguments', find_program('test/arguments'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic') test('Scan-build static analysis', find_program('test/scan-build'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'release') diff --git a/test/clang-format b/test/clang-format new file mode 100644 index 0000000..f37b545 --- /dev/null +++ b/test/clang-format @@ -0,0 +1,25 @@ +#! /bin/sh + +readonly declared_deps="${@}" +readonly hardcoded_deps="fuzz/execl_override.c fuzz/fuzz-lib.c fuzz/fuzz-lib.h fuzz/fuzz-parse.c" +readonly deps="${declared_deps} ${hardcoded_deps}" + +RESULT=0 + +set -x + +echo $MESONCURRENTCONFIGDIR + +for file in ${deps} +do + echo "${file}" + if $(clang-format -Werror --dry-run "$MESONCURRENTCONFIGDIR/${file}") + then + echo " [x] clang-format" + else + RESULT=1 + echo " [ ] clang-format" + fi +done + +exit "${RESULT}"