Add man page consistency check.

This commit is contained in:
project-repo 2024-01-03 17:55:59 +01:00
commit d335bf8f97
2 changed files with 39 additions and 1 deletions

View file

@ -373,13 +373,14 @@ run_target('create-artefacts',
test('Build without warnings', find_program('test/build-w-o-warnings'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
test('Example script header is consistent', find_program('test/script-header'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
test('Script executability is consistent', find_program('test/script-header'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
test('Man page consistency', find_program('test/man-pages'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
test('Build without xwayland', find_program('test/build-w-o-xwayland'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
test('Copyright and LICENSE', find_program('test/copyright-license'), args : [ cagebreak_main_file + cagebreak_source_strings + cagebreak_header_strings + fuzz_sources + fuzz_headers + fuzz_override_lib ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()), ''.join('MESONLICENSE=', meson.project_license())], suite: 'devel' )
test('Formatting check (clang-format)', find_program('test/clang-format'), args : [ cagebreak_main_file + cagebreak_source_strings + cagebreak_header_strings + fuzz_sources + fuzz_headers + fuzz_override_lib ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
test('Script linting (shellcheck)', find_program('test/shellcheck'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
test('GPG key validity', find_program('test/gpg-validity'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
test('Illegal Strings', find_program('test/illegal-strings'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel')
test('Scan-build (static analysis)', find_program('test/scan-build'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel-long')
test('Static analysis (scan-build)', find_program('test/scan-build'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'devel-long')
test('Arguments', find_program('test/arguments'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic')
test('Environment Variables', find_program('test/environment-variables'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'basic')
test('Semantic versioning', find_program('test/versions'), args : [ meson.project_version() ], env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'release')

37
test/man-pages Normal file
View file

@ -0,0 +1,37 @@
#!/bin/bash
# Copyright 2024, project-repo and the cagebreak contributors
# SPDX-License-Identifier: MIT
RESULT=0
cd "${MESONCURRENTCONFIGDIR}" || exit 1
tail_license=$(tail -n 17 LICENSE)
tail_man1=$(tail -n 17 man/cagebreak.1.md)
tail_man5=$(tail -n 17 man/cagebreak-config.5.md)
tail_man7=$(tail -n 17 man/cagebreak-socket.7.md)
[[ $tail_license = "$tail_man1" ]] || RESULT=1
[[ $tail_license = "$tail_man5" ]] || RESULT=1
[[ $tail_license = "$tail_man7" ]] || RESULT=1
if [[ $RESULT -eq 0 ]]
then
echo "[x] License ending"
else
echo "[ ] License ending"
fi
for man_page in man/*
do
grep -q "$man_page" manuals.md || RESULT=1
done
if [[ $RESULT -eq 0 ]]
then
echo "[x] All man pages listed in manuals.md"
else
echo "[ ] All man pages listed in manuals.md"
fi
exit "${RESULT}"