Skip to content

Commit

Permalink
Refactors how source files are aggregated for testing
Browse files Browse the repository at this point in the history
This also implicitly runs tests and static analysis against src/filedata/filedata.cc
  • Loading branch information
xsdg committed May 31, 2024
1 parent 07a77fd commit 2f86e46
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
16 changes: 10 additions & 6 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ add_global_arguments('-Wno-overlength-strings', language : 'c')
add_global_arguments('-Wno-error=deprecated-declarations', language : 'cpp')

# Project requirements
# code_sources is all human-written geeqie C/C++ code
code_sources = []
# project_sources will include code_sources, as well as auto-generated code,
# third-party code, and some other code-like dependencies.
project_sources = []
gnome = import('gnome')
thread_dep = dependency('threads')
Expand Down Expand Up @@ -729,7 +733,7 @@ if running_from_git
if clang_tidy_exe.found()
git_exe = find_program('git', required : true)

foreach source_file : main_sources + pan_view_sources + view_file_sources
foreach source_file : code_sources
if fs.name(source_file).endswith('.cc')
source_file_name = fs.name(source_file)
config_file = join_paths(meson.project_source_root(), '.clang-tidy')
Expand All @@ -749,7 +753,7 @@ endif
# Single value enum checks
enum_check_sh = find_program('enum-check.sh', dirs : scriptsdir, required : true)
if enum_check_sh.found()
foreach source_file : main_sources + pan_view_sources + view_file_sources
foreach source_file : code_sources
source_file_name = fs.name(source_file)
test('Single Value enum_ ' + source_file_name, enum_check_sh, args : [source_file], timeout : 100, suite : 'analysis')
endforeach
Expand All @@ -762,7 +766,7 @@ endif
# Debug statement checks
debug_check_sh = find_program('debug-check.sh', dirs : scriptsdir, required : true)
if debug_check_sh.found()
foreach source_file : main_sources + pan_view_sources + view_file_sources
foreach source_file : code_sources
source_file_name = fs.name(source_file)
if (source_file_name != 'debug.h')
test('Debug Statements_ ' + source_file_name, debug_check_sh, args : [source_file], timeout : 100, suite : 'analysis')
Expand All @@ -777,7 +781,7 @@ endif
# Temporary comments checks
tmp_comments_check_sh = find_program('temporary-comments-check.sh', dirs : scriptsdir, required : true)
if tmp_comments_check_sh.found()
foreach source_file : main_sources + pan_view_sources + view_file_sources
foreach source_file : code_sources
source_file_name = fs.name(source_file)
if (source_file_name != 'debug.h')
test('Temporary Comments_ ' + source_file_name, tmp_comments_check_sh, args : [source_file], timeout : 100, suite : 'analysis')
Expand All @@ -794,7 +798,7 @@ gtk4_migration_check_sh = find_program('gtk4-migration-regression-check.sh', dir
if gtk4_migration_check_sh.found()
compat_cc = join_paths(meson.project_source_root(), 'src', 'compat.cc')
compat_h = join_paths(meson.project_source_root(), 'src', 'compat.h')
foreach source_file : main_sources + pan_view_sources + view_file_sources
foreach source_file : code_sources
source_file_name = fs.name(source_file)
if (source_file_name != 'debug.h')
test('GTK4 migration_ ' + source_file_name, gtk4_migration_check_sh, args : [source_file, compat_cc, compat_h], timeout : 100, suite : 'analysis')
Expand All @@ -809,7 +813,7 @@ endif
# Untranslated text checks
untranslated_text_sh = find_program('untranslated-text.sh', dirs : scriptsdir, required : true)
if untranslated_text_sh.found()
foreach source_file : main_sources + pan_view_sources + view_file_sources
foreach source_file : code_sources
if fs.name(source_file).endswith('.cc')
source_file_name = fs.name(source_file)
test('Untranslated Text_ ' + source_file_name, untranslated_text_sh, args : [source_file], timeout : 200, suite : 'analysis')
Expand Down
2 changes: 1 addition & 1 deletion src/filedata/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@

filedata_sources = files('filedata.cc')

project_sources += filedata_sources
code_sources += filedata_sources
5 changes: 4 additions & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ if conf_data.get('HAVE_WEBP', 0) == 1
)
endif

project_sources += main_sources
code_sources += main_sources

subdir('authors')
subdir('filedata')
Expand All @@ -314,6 +314,9 @@ if conf_data.get('ENABLE_UNIT_TESTS', 0) == 1
subdir('tests')
endif

# We assume that code_sources is only set above.
project_sources += code_sources

gq_marshal = gnome.genmarshal('gq-marshal', prefix : 'gq_marshal', sources : 'gq-marshal.list')

project_sources += gq_marshal[1]
Expand Down
3 changes: 2 additions & 1 deletion src/pan-view/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ pan_view_sources = files('pan-calendar.cc',
'pan-view.h',
'pan-view-search.cc',
'pan-view-search.h')
project_sources += pan_view_sources

code_sources += pan_view_sources
2 changes: 1 addition & 1 deletion src/tests/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@

unit_test_sources = files('pixbuf-util.cc')

project_sources += unit_test_sources
code_sources += unit_test_sources

0 comments on commit 2f86e46

Please sign in to comment.