~hp/patchmatrix

3921d7408c85e61210eced6ab8f8ad0b816f5ed8 — builds.sr.ht 10 months ago 1aa9dd9
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
5 files changed, 109 insertions(+), 55 deletions(-)

D .build.yml
A .builds/alpine-latest.yml
M meson.build
M meson_options.txt
M test/test.c
D .build.yml => .build.yml +0 -17
@@ 1,17 0,0 @@
# SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
# 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

A .builds/alpine-latest.yml => .builds/alpine-latest.yml +65 -0
@@ 0,0 1,65 @@
# SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
# 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: "<dev@open-music-kontrollers.ch>"
...

M meson.build => meson.build +36 -34
@@ 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

M meson_options.txt => meson_options.txt +5 -1
@@ 1,4 1,8 @@
# SPDX-FileCopyrightText: Hanspeter Portner <dev@open-music-kontrollers.ch>
# 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')

M test/test.c => test/test.c +3 -3
@@ 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();