From 3921d7408c85e61210eced6ab8f8ad0b816f5ed8 Mon Sep 17 00:00:00 2001 From: "builds.sr.ht" Date: Fri, 12 May 2023 21:27:30 +0000 Subject: [PATCH] Squashed 'subprojects/varchunk/' changes from 42c947e..f51441d f51441d release-0.2.0 2782f9a Add support for static analyzer to ci recipe d9cf9d0 Fix clang compiler warnings 61fa626 Add support for meson test suite memcheck 586b41c Update ci recipe git-subtree-dir: subprojects/varchunk git-subtree-split: f51441d9c05cdc57c7fc9618508ef01905ae7f3f --- .build.yml | 17 ---------- .builds/alpine-latest.yml | 65 ++++++++++++++++++++++++++++++++++++ meson.build | 70 ++++++++++++++++++++------------------- meson_options.txt | 6 +++- test/test.c | 6 ++-- 5 files changed, 109 insertions(+), 55 deletions(-) delete mode 100644 .build.yml create mode 100644 .builds/alpine-latest.yml diff --git a/.build.yml b/.build.yml deleted file mode 100644 index f76c316..0000000 --- a/.build.yml +++ /dev/null @@ -1,17 +0,0 @@ -# SPDX-FileCopyrightText: Hanspeter Portner -# SPDX-License-Identifier: CC0-1.0 - -image: alpine/latest -packages: - - reuse - - meson -tasks: - - setup: | - cd varchunk - meson setup build - - build: | - cd varchunk - ninja -C build - - test: | - cd varchunk - ninja -C build test diff --git a/.builds/alpine-latest.yml b/.builds/alpine-latest.yml new file mode 100644 index 0000000..38c4557 --- /dev/null +++ b/.builds/alpine-latest.yml @@ -0,0 +1,65 @@ +# SPDX-FileCopyrightText: Hanspeter Portner +# SPDX-License-Identifier: CC0-1.0 + +--- + +image: alpine/latest + +packages: + - clang15-analyzer + - llvm15 + - reuse + - meson + - git-subtree + - hut + - jq + - valgrind + +environment: + project: varchunk + +secrets: + - 0545580c-42ac-4700-b322-4e9df924eb07 + - 5fe806cd-3af4-4588-9898-8115d9262144 + +sources: + - https://git.open-music-kontrollers.ch/~hp/ci + +tasks: + - gcc: | + . ~/ci/activate + + ci-meson gcc setup + ci-meson gcc build + ci-meson gcc test + ci-meson gcc memcheck + + - clang: | + . ~/ci/activate + + ci-meson clang setup + ci-meson clang build + ci-meson clang test + ci-meson clang memcheck + + - analyzer: | + . ~/ci/activate + + ci-meson analyzer setup + ci-meson analyzer build + ci-meson analyzer test + + - deploy: | + . ~/ci/activate + + if ! ci-isrelease; then + complete-build + fi + + ci-subtreemerge + +triggers: + - action: email + condition: failure + to: "" +... diff --git a/meson.build b/meson.build index 1ae9a38..19cdcbd 100644 --- a/meson.build +++ b/meson.build @@ -8,50 +8,52 @@ project('varchunk', 'c', default_options : [ 'b_lto=true', 'c_std=c11']) +build_tests = get_option('build-tests') + reuse = find_program('reuse', required : false) add_project_arguments('-D_GNU_SOURCE', language : 'c') cc = meson.get_compiler('c') +rt_dep = cc.find_library('rt') -thread_dep = dependency('threads') - -lib_deps = [] - -lib_incs = [] -lib_incs += include_directories('') +lib_deps = [ + rt_dep +] -lib_srcs = [] -lib_srcs += join_paths('src', 'varchunk.c') - -if host_machine.system() == 'linux' - rt_dep = cc.find_library('rt') - lib_deps += rt_dep -endif +lib_srcs = [ + join_paths('src', 'varchunk.c') +] varchunk = declare_dependency( - include_directories : lib_incs, dependencies : lib_deps, sources : lib_srcs) -test_deps = [] -test_deps += varchunk -test_deps += thread_dep - -test_srcs = [] -test_srcs += join_paths('test', 'test.c') - -test_varchunk = executable('Test', test_srcs, - dependencies : test_deps, - install : false) - -test('Test', test_varchunk, - args : ['100000'], - timeout : 360) # seconds - -if reuse.found() - test('REUSE', reuse, args : [ - '--root', meson.current_source_dir(), - 'lint' - ]) +if build_tests + thread_dep = dependency('threads') + + test_deps = [ + varchunk, + thread_dep + ] + + test_srcs = [ + join_paths('test', 'test.c') + ] + + test_varchunk = executable('Test', test_srcs, + dependencies : test_deps, + install : false) + + test('Test', test_varchunk, + args : ['100000'], + timeout : 360, # seconds + suite: ['memcheck']) + + if reuse.found() + test('REUSE', reuse, args : [ + '--root', meson.current_source_dir(), + 'lint' + ]) + endif endif diff --git a/meson_options.txt b/meson_options.txt index 13a6807..ede30b1 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,4 +1,8 @@ # SPDX-FileCopyrightText: Hanspeter Portner # SPDX-License-Identifier: CC0-1.0 -option('version', type : 'string', value : '0.1.135') +option('build-tests', + type : 'boolean', + value : true) + +option('version', type : 'string', value : '0.2.0') diff --git a/test/test.c b/test/test.c index be2cd1e..6b55723 100644 --- a/test/test.c +++ b/test/test.c @@ -47,7 +47,7 @@ producer_main(void *arg) } #endif - written = PAD(rand() * 1024.f / RAND_MAX); + written = PAD(rand() * 1024 / RAND_MAX); size_t maximum; if( (ptr = varchunk_write_request_max(varchunk, written, &maximum)) ) @@ -109,7 +109,7 @@ consumer_main(void *arg) } static void -test_threaded() +test_threaded(void) { pthread_t producer; pthread_t consumer; @@ -189,7 +189,7 @@ varchunk_shm_deinit(varchunk_shm_t *varchunk_shm) } static void -test_shared() +test_shared(void) { const char *name = "/varchunk_shm_test"; pid_t pid = fork(); -- 2.38.5