mirror of
https://cagebreak.project-repo.co/cagebreak.git
synced 2026-08-23 14:04:19 +02:00
Add basic tests
This commit is contained in:
parent
439385750d
commit
1889c60484
3 changed files with 74 additions and 0 deletions
|
|
@ -348,7 +348,9 @@ message('\n'.join(summary))
|
|||
|
||||
test('Build without warnings', find_program('test/build-w-o-warnings'), 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('Clang-format (formatting check)', 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('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('Scan-build (static analysis)', find_program('test/scan-build'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'release')
|
||||
test('Check for strings indicating problems', find_program('test/illegal-strings'), env : [ ''.join('MESONCURRENTCONFIGDIR=', meson.current_source_dir()) ], suite: 'release')
|
||||
|
|
|
|||
42
test/copyright-license
Normal file
42
test/copyright-license
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#! /bin/sh
|
||||
# Copyright 2023, project-repo and the cagebreak contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
readonly declared_deps="${@}"
|
||||
readonly hardcoded_deps="meson_options.txt meson.build"
|
||||
readonly test_deps=$(cd "${MESONCURRENTCONFIGDIR}" ; find . -type f | grep test/)
|
||||
readonly examples_deps=$(cd "${MESONCURRENTCONFIGDIR}" ; find . -type f | grep examples/)
|
||||
readonly example_scripts_deps=$(cd "${MESONCURRENTCONFIGDIR}" ; find . -type f | grep example_scripts/)
|
||||
readonly deps="${declared_deps} ${hardcoded_deps} ${test_deps} ${examples_deps} ${example_scripts_deps}"
|
||||
readonly curryear=$(date +%Y)
|
||||
|
||||
RESULT=0
|
||||
|
||||
for file in ${deps}
|
||||
do
|
||||
echo "${file}"
|
||||
if $(grep -q "Copyright.*${curryear}, project-repo and the cagebreak contributors" "$MESONCURRENTCONFIGDIR/${file}")
|
||||
then
|
||||
echo " [x] Copyright Notice"
|
||||
else
|
||||
RESULT=1
|
||||
echo " [ ] Copyright Notice"
|
||||
fi
|
||||
if $(grep -q "SPDX-License-Identifier: MIT" "$MESONCURRENTCONFIGDIR/${file}")
|
||||
then
|
||||
echo " [x] SPDX-License-Identifier"
|
||||
else
|
||||
RESULT=1
|
||||
echo " [ ] SPDX-License-Identifier"
|
||||
fi
|
||||
done
|
||||
|
||||
[[ "${MESONLICENSE}" = "MIT" ]] || RESULT=1
|
||||
|
||||
cd "${MESONCURRENTCONFIGDIR}"
|
||||
|
||||
[[ $(cat LICENSE) = $(cat README.md | tail -$(wc -l LICENSE)) ]] || RESULT=1
|
||||
|
||||
[[ "Copyright (c) 2020-${curryear} The Cagebreak authors" = $(cat LICENSE | head -1) ]] || RESULT=1
|
||||
|
||||
exit "${RESULT}"
|
||||
30
test/illegal-strings
Normal file
30
test/illegal-strings
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#!/bin/bash
|
||||
# Copyright 2023, project-repo and the cagebreak contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
testdir=$(mktemp -d)
|
||||
|
||||
RESULT=0
|
||||
|
||||
cd "${MESONCURRENTCONFIGDIR}"
|
||||
|
||||
# Check that no TODO statements remain in the release directory
|
||||
if ! grep -Rq "TODO" .
|
||||
then
|
||||
echo "[x] TODO"
|
||||
else
|
||||
echo "[ ] TODO"
|
||||
RESULT=1
|
||||
fi
|
||||
|
||||
# Check that Cagebreak does not falsely claim to be POSIX compliant
|
||||
if ! grep -Rq "_POSIX_C_SOURCE" .
|
||||
then
|
||||
echo "[x] _POSIX_C_SOURCE"
|
||||
else
|
||||
echo "[ ] _POSIX_C_SOURCE"
|
||||
RESULT=1
|
||||
fi
|
||||
|
||||
|
||||
exit "${RESULT}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue